Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using the
SourceMapper
in a TypeScript project, the following error occurs:The critical piece being:
This comes from this method:
pyroscope-nodejs/src/sourcemapper.ts
Lines 232 to 237 in 4c286e7
The cause is that we can't use the
@pyroscope/nodejs
SourceMapper
type in place of the@ddog/pprof
SourceMapper
type because private methods aren't considered when matching type shapes in TypeScript. See microsoft/TypeScript#7755 (comment) for an example and explanation.As a result, we should not expose the
@ddog/pprof
SourceMapper
type in thePyroscopeConfig
type. Rather, we should expose our own implementation ofSourceMapper
then do a conversion to the DataDog type internally.The critical change is this method:
https://github.com/grafana/pyroscope-nodejs/pull/101/files#diff-068acd199ee4e6261a4645ae640daf8a4f48c526e60caf6bf55a3ae770faadd9R126-R134