MetricReader

sealed interface MetricReader

Decides when aggregated metrics are collected, and owns the MetricExporter they are handed to. Pairing the two is what makes two destinations on two intervals expressible.

Sealed because the intended extension point is MetricExporter: an exporter says only where metrics go, while a reader is coupled to AggregatingMeterProvider.collect and the provider's lifecycle. Unsealing later is a compatible change; retracting an extension point is not.

Inheritors

Functions

Link copied to clipboard
abstract suspend fun close()

Final flush, then release the exporter and any scheduling resources. Idempotent.

Link copied to clipboard
abstract suspend fun flush()

Collect and export immediately. Safe to call concurrently and safe to call after close.