-
Notifications
You must be signed in to change notification settings - Fork 767
Description
Why you need this feature?
Elastic is proposing a donation of our continuous profiler (open-telemetry/community#1918). In order to do correlation of profiling data with traces collected by language sdks we need to provide to the profiler current thread trace id, span id and root span id.
Describe the solution you'd like
Following java implementation I thought an hook on the context api may work, I've done a quick POC here:
https://gist.github.com/xrmx/fc81e710e7a860ca229839b10e780dfd
On the technical side I'm unsure if the optional hook callback should be configured via an environment variable or via an entrypoint.
Describe alternatives you've considered
An alternative if the context is the right place to hook would be to provide a custom context storage implementation but that would not be generic or upstreamable.
Additional context
In the java sdk they have https://javadoc.io/doc/io.opentelemetry/opentelemetry-context/latest/io/opentelemetry/context/ContextStorage.html#addWrapper(java.util.function.Function)