TelemetryContext

An abstraction for a telemetry context, capable of bridging into ThreadLocal storage via its attach and detach methods for synchronous tracing, or being carried across coroutine boundaries via asContextElement.

Functions

Link copied to clipboard

Converts this context into a CoroutineContext.Element for propagation in coroutines.

Link copied to clipboard
abstract fun attach(): Scope

Attaches this context to the current thread synchronously. Return the scope token needed to detach it.

Link copied to clipboard
abstract fun detach(scopeToken: Scope)

Detaches this context from the current thread using the token returned by attach.