Trace Event
An observation emitted to a TraceSink. Sealed so subtypes can be added later; sinks must ignore subtypes they do not know.
Subclasses are final classes with explicit equals/hashCode/toString rather than data classes, so new fields can be added in later releases without breaking binary compatibility. coroutineName and thread are null unless TraceLevel.Coroutine is enabled and the platform supports it.
Example:
val sink = TraceSink { event ->
if (event is TraceEvent.Finished) println("${event.dispatcher} ran ${event.runTimeNanos}ns")
}Requires opting in to ExperimentalStructuredCoroutines.
See also
Inheritors
Types
A block finished after running for runTimeNanos, with the given outcome.
A periodic snapshot of one dispatcher pool, produced by PoolSampler (never by TracingDispatcher) at TraceLevel.Pool. A series of samples shows how the pool behaves over time, which cumulative DispatcherMetrics cannot.
A block began running after waiting queueDelayNanos in the queue.
Properties
Label of the dispatcher that produced the event, such as "io" or "default".
Lowest TraceLevel at which this event is produced.
Monotonic timestamp in nanoseconds. Only differences between events are meaningful.