遥测(Telemetry)上下文(Context)

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.

函数

Link copied to clipboard

将此上下文转换为 `CoroutineContext.Element` 类型,以便在协程中传递使用。

Link copied to clipboard
abstract fun attach(): Scope

将此上下文同步地附加到当前线程中,并返回用于将其分离所需的作用域令牌(scope token)。

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

使用返回的令牌(token),将此上下文从当前线程中分离出来。 attach.