PoolSample

class PoolSample(val dispatcher: String, val timestampNanos: Long, val queued: Long, val started: Long, val finished: Long, val pending: Long, val running: Int, val peakRunning: Int, val parallelism: Int?) : TraceEvent(source)

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.

queued, started and finished are cumulative counters from DispatcherMetrics. pending is max(0, queued - started) and can overcount when dangling Queued events exist (a dispatcher that swallows blocks, see TracingDispatcher). running is started - finished and peakRunning the highest concurrency observed so far. parallelism is the configured or inferred maximum concurrency of the pool when known, else null (see TracedDispatcherProvider.parallelism).

timestampNanos is measured from the creation of the PoolSampler that produced the sample, not from the creation of any TracingDispatcher: only differences between samples of the same sampler are meaningful.

Example:

val sink = TraceSink { event ->
if (event is TraceEvent.PoolSample) println("${event.dispatcher}: pending=${event.pending}")
}

Constructors

Link copied to clipboard
constructor(dispatcher: String, timestampNanos: Long, queued: Long, started: Long, finished: Long, pending: Long, running: Int, peakRunning: Int, parallelism: Int?)

Properties

Link copied to clipboard
open override val dispatcher: String

Label of the dispatcher that produced the event, such as "io" or "default".

Link copied to clipboard

cumulative number of finished events.

Link copied to clipboard
open override val level: TraceLevel

Lowest TraceLevel at which this event is produced.

Link copied to clipboard

configured or inferred concurrency limit, or null when unknown.

Link copied to clipboard

highest concurrency observed so far.

Link copied to clipboard

queued and not yet started segments.

Link copied to clipboard

cumulative number of queued events.

Link copied to clipboard

segments currently running.

Link copied to clipboard

cumulative number of started events.

Link copied to clipboard
open override val timestampNanos: Long

Monotonic timestamp in nanoseconds. Only differences between events are meaningful.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String