grafana / pyroscope-nodejs

Pyroscope NodeJS integration
Apache License 2.0
27 stars 21 forks source link

replace path when running using workspaces #25

Open eh-am opened 1 year ago

eh-am commented 1 year ago

https://docs.npmjs.com/cli/v7/using-npm/workspaces When running using workspaces, the cwd (aka current directory from what yarn/npm is running from) doesn't necessarily match what's in the stack trace.

Therefore the following piece of code doesn't replace the current path with . correctly: https://github.com/pyroscope-io/pyroscope-nodejs/blob/09d3f4d1b77d8640181e871db0fa3d60919e4a7d/src/index.ts#L123-L127

Here's an example flamegraph https://flamegraph.com/share/00f3cbd1-a17d-11ed-87c6-42e8e9dddd83 And an example repository https://github.com/eh-am/example-pyroscope-nodejs-workspace