Context Manager that delegates ThreadLocal management to the default OpenTelemetry Context storage.
Obtaining the current context value is delegated to
io.opentelemetry.context.Context.current()
.
Initializing a new context value is delegated to
io.opentelemetry.context.Context.makeCurrent()
.
Adding the context-manager-opentelemetry
jar to the classpath
is all that is needed to include the OpenTelemetry Context
in ContextSnapshots.
This propagates the context to other threads using the
ContextAwareExecutorService
or ContextAwareCompletableFuture
.
Also, any function ..WithContext in the core.function
package
automatically activates the context snapshot around the function body.
Add it to your classpath.
<dependency>
<groupId>nl.talsmasoftware.context.managers</groupId>
<artifactId>context-manager.opentelemetry</artifactId>
<version>[see maven-central badge above]</version>
</dependency>
Done!