grafana / grafana/pyroscope-nodejs

make `.stop()` flush

Open
#26 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
51
Forks
36
PR merge metrics
No merged PRs in 30d

Description

This is going to be tricky.

When stopping the profiler, it only sets up a stop flag
https://github.com/pyroscope-io/pyroscope-nodejs/blob/09d3f4d1b77d8640181e871db0fa3d60919e4a7d/src/index.ts#L284
Which only affects the next profiling round
https://github.com/pyroscope-io/pyroscope-nodejs/blob/09d3f4d1b77d8640181e871db0fa3d60919e4a7d/src/index.ts#L257-L264

That means that it may take up to 10 seconds (the profiling round) to exit
https://github.com/pyroscope-io/pyroscope-nodejs/blob/09d3f4d1b77d8640181e871db0fa3d60919e4a7d/src/index.ts#L204

This behaviour is pretty clear when running tests, where the test runner hangs up to 10 seconds, and the last profile captured is full of `idle`, since the program it's not doing anything.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.