Summary

A Summary is a metric that provides statistical information about observed values, including quantiles.

This implementation supports quantiles, sum, count, and allows for time-based observation tracking.

Parameters

fullName

The full name of the summary metric.

help

A description of what the summary measures.

labelNames

Optional list of label names for the summary.

unit

Optional unit of measurement for the summary.

includeCreatedSeries

If true, also emits a _created series per label set.

quantiles

A list of Quantiles.Quantile to include in the summary.

maxAgeSeconds

The maximum age of observations in seconds. Defaults to 60.

ageBuckets

The number of buckets to divide the observation window into. Defaults to 5.

Types

Link copied to clipboard
inner class Child

Represents a labeled child of the summary metric.

Link copied to clipboard
class Timer(child: Summary.Child, start: Long)

A utility class for measuring the duration of operations and recording the observed duration in the associated histogram.

Properties

Link copied to clipboard

Full metric name (including any suffix or unit).

Link copied to clipboard

Description of the metric, explaining what it measures.

Link copied to clipboard

List of label names associated with this metric (e.g., "method", "status").

Link copied to clipboard
open override val name: String

The base name of the metric (without unit suffix).

Link copied to clipboard
open override val type: Collector.Type

The metric type (e.g., counter, gauge).

Link copied to clipboard

Unit of the metric (e.g., "seconds", "bytes").

Functions

Link copied to clipboard
fun clear()

Removes all labeled child instances and resets the no-label child (if applicable).

Link copied to clipboard

Collects the current set of metric samples.

Link copied to clipboard
Link copied to clipboard

Returns the simple class name of the Collector instance.

Link copied to clipboard
fun labels(vararg labelValues: String): Summary.Child

Retrieves or creates a Child associated with the given label values.

Link copied to clipboard
open override fun newChild(): Summary.Child

Creates a new child instance. Called internally when a new label set is first seen.

Link copied to clipboard
suspend fun observe(value: Double)
Link copied to clipboard
suspend fun register(registry: CollectorRegistry = CollectorRegistry.defaultRegistry): Collector

Registers this collector in the given CollectorRegistry.

Link copied to clipboard
fun remove(vararg labelValues: String)

Removes the child instance associated with the given label values.

Link copied to clipboard
suspend fun time(runnable: Runnable): Double