PoolSignal

A heuristic hint derived from DispatcherMetrics. Sealed so more signals can be added later. Signals are hints, not proof: they say where to look, not what is wrong.

Example:

when (val signal = metrics.signals().firstOrNull()) {
is PoolSignal.StarvationSuspected -> alert(signal.label)
is PoolSignal.LongRunningSegment -> alert(signal.label)
is PoolSignal.BacklogGrowing, is PoolSignal.PoolSaturated -> alert(signal.label)
null -> Unit
}

Requires opting in to ExperimentalStructuredCoroutines.

See also

Inheritors

Types

Link copied to clipboard
class BacklogGrowing(val label: String, val samples: Int, val from: Long, val to: Long) : PoolSignal

pending never decreased across the last samples pool samples and rose from from to to. Produced by List<TraceEvent.PoolSample>.signals.

Link copied to clipboard
class LongRunningSegment(val label: String, val longestRun: Duration) : PoolSignal

A single segment ran for longestRun, at or above the threshold.

Link copied to clipboard
class PoolSaturated(val label: String, val parallelism: Int, val samples: Int) : PoolSignal

Across the last samples pool samples the dispatcher ran at its parallelism limit while work was waiting. Produced by List<TraceEvent.PoolSample>.signals.

Link copied to clipboard
class StarvationSuspected(val label: String, val queueDelayP95: Duration, val pending: Long) : PoolSignal

Work is waiting and waited long: pending is positive and the queue-delay p95 (queueDelayP95, a bucket upper bound) reached the threshold. pending can overcount, see DispatcherMetrics.pending.

Properties

Link copied to clipboard
abstract val label: String

Label of the dispatcher the signal is about.