# TelemetryContext

interface 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

asContextElement
Link copied to clipboard
abstract fun asContextElement(): TelemetryContextElement

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

attach
Link copied to clipboard
abstract fun attach(): Scope

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

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

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