-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: added nodejs cpu profiler support #19
Conversation
src/cpu.ts
Outdated
cpuProfiler.labels = { ...cpuProfiler.labels, [key]: value } | ||
} | ||
|
||
export function tagCall( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@petethepig what should this function be called to be consistent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tagWrapper
All timing values are below 0.01s Here is a sample profile JSON of a sample nodejs I can see following problems:
Maybe i'm missing something important about |
https://gist.github.com/shaleynikov/1870d4529a3c9ac982e0b2c47accfce5 Okay the issue I found is |
This reverts commit c9c017f.
Idle on walltime profiler was intentionally removed by DataDog |
What's the status of this PR? It looks good to me and I'd be keen to see this released |
btw period bug was fixed DataDog/pprof-nodejs#61 |
both wall and cpu right now write to our ".cpu" application, we may want to change that |
src/cpu.ts
Outdated
return | ||
} | ||
|
||
cpuProfilingTimer = setInterval(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am trying to run the profiler, while calculating fibonacci. This callback only gets called AFTER my fib code is ran, which is due to how js works: https://nodejs.org/en/docs/guides/dont-block-the-event-loop/#why-should-i-avoid-blocking-the-event-loop-and-the-worker-pool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, that's correct, the problem is that data is never flushed. Since when I call stop
it simply cancels this setInterval, never getting the chance to upload the profile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stopCpuProfile not uploads last profile, should be better now
@shaleynikov, I guess you need to sign the CLA? as per #19 (comment) |
What is holding this back ? |
please merge this, the old version is giving audit issues. |
Hello guys! Any chances of this merge happening? I'm trying to implement Pyroscope for my company but I can't run this lib on NodeJS 18 and 20. I was hopping this PR could solve my issues because of the usage o @datadog/pprof. Thanks! |
This looks great, but @korniltsev I don't mind giving you a hand with the update if that helps this PR to be merged. I would prefer having an official grafana library rather than a thousand forks. |
We want to have this update but It seems like I'm not going to work on it in the near future. |
@korniltsev it would be my pleasure, I will submit the PR in the upcoming days |
…to feat/cpu-profiler-tags
@korniltsev I will be working on #39 to provide the datadog integration. There're multiple aspects to be discussed, but I think we will be able to do it :) |
Proof of concept of CPU nodejs profiler with tags support
Usage examples are here grafana/pyroscope@1ddf73b
TODO: