signals

Derives heuristic PoolSignals from these metrics using thresholds.

These are heuristics, not proof. The queue-delay p95 is a histogram bucket upper bound (up to 2x the real value), and queue delay is only recorded when a block STARTS. If every worker is blocked and nothing starts, the p95 stays at its old value and PoolSignal.StarvationSuspected may not fire; the trend signals (PoolSignal.BacklogGrowing, PoolSignal.PoolSaturated) from List<TraceEvent.PoolSample>.signals do catch that case. This function only looks at one snapshot; to detect trends over time use List<TraceEvent.PoolSample>.signals, fed by PoolSampler.

Example:

stats.metrics().flatMap { it.signals() }.forEach(::println)

Requires opting in to ExperimentalStructuredCoroutines.

Receiver

the metrics snapshot to evaluate.

Return

the signals that fired, possibly empty.

Parameters

thresholds

limits that decide when a signal fires.


Derives heuristic PoolSignals from a chronological series of TraceEvent.PoolSamples, such as those a PoolSampler emits. Each label is evaluated on its own over its last minSamples samples; a label with fewer samples yields no signal.

These are heuristics, not proof: pending can overcount (see TraceEvent.PoolSample) and parallelism may be inferred. The result is ordered by the first appearance of each label.

Example:

val samples = ring.snapshot().filterIsInstance<TraceEvent.PoolSample>()
samples.signals().forEach(::println)

Receiver

chronological samples, possibly from several dispatcher labels.

Return

the signals that fired, possibly empty.

Parameters

minSamples

size of the window per label. Must be at least 2.

Throws