PlatformThreadContextElement


public abstract class PlatformThreadContextElement<S extends Object, T extends Tracer> extends AbstractCoroutineContextElement implements PropagationToken, AutoCloseable


We use the PlatformThreadContextElement construct to know when a coroutine has suspended, and about to resume on a Thread.

Summary

Public methods

CoroutineContext.Element
@NonNull String

The category that a trace section belongs to.

@NonNull List<@NonNull Long>

The underlying Perfetto flow ids that can be used to determine the causality for a given trace section.

@NonNull String

The name of the code section as it appears in a trace.

@NonNull T

The Tracer instance that can use this PropagationToken for context propagation when the coroutine suspends and resumes.

void

The category that a trace section belongs to.

void

The name of the code section as it appears in a trace.

Public methods

contextElementOrNull

@DelicateTracingApi
public CoroutineContext.Element contextElementOrNull()
Returns
CoroutineContext.Element

a CoroutineContext.Element that needs to be installed in the kotlinx.coroutines.currentCoroutineContext prior to dispatching the suspending block of code being traced; if the token is being used in a suspending context.

getCategory

Added in 2.0.0-alpha03
public @NonNull String getCategory()

The category that a trace section belongs to.

getFlowIds

Added in 2.0.0-alpha03
public @NonNull List<@NonNull LonggetFlowIds()

The underlying Perfetto flow ids that can be used to determine the causality for a given trace section.

getName

Added in 2.0.0-alpha03
public @NonNull String getName()

The name of the code section as it appears in a trace.

getTracer

Added in 2.0.0-alpha03
public @NonNullgetTracer()

The Tracer instance that can use this PropagationToken for context propagation when the coroutine suspends and resumes.

setCategory

Added in 2.0.0-alpha03
public void setCategory(@NonNull String value)

The category that a trace section belongs to.

setName

Added in 2.0.0-alpha03
public void setName(@NonNull String value)

The name of the code section as it appears in a trace.