HistogramSnapshot

Immutable view of a latency distribution captured from a histogram.

Buckets are logarithmic: an underflow bucket for durations below 1 microsecond, then one bucket per power of two with exclusive upper bounds 2^10 ns up to 2^34 ns (about 17 seconds), then an overflow bucket for everything at or above 2^34 ns. bucketUpperBounds lists the finite bounds in order, so it has exactly one element fewer than bucketCounts; the last count is the overflow bucket, which has no finite bound.

Instances are immutable and thread-safe; they are obtained from DispatcherMetrics.queueDelay and DispatcherMetrics.runTime.

Requires opting in to ExperimentalStructuredCoroutines.

Example:

val p95 = metrics.queueDelay.percentile(0.95)

Properties

Link copied to clipboard

number of values per bucket, in bucket order.

Link copied to clipboard

exclusive upper bound of every bucket except the overflow bucket.

Link copied to clipboard
val count: Long

number of recorded values.

Link copied to clipboard

largest recorded value, Duration.ZERO when empty.

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

Estimates the value at quantile p (0.0 to 1.0) as the UPPER BOUND of the bucket that holds it. Because buckets double in width, the estimate can be up to 2x the real value, but it never exceeds max, the largest value recorded. When the quantile falls in the overflow bucket the exact max is returned instead. An empty histogram returns Duration.ZERO.

Link copied to clipboard
open override fun toString(): String