Interface MetricReader

All Superinterfaces:
AggregationTemporalitySelector
All Known Implementing Classes:
PeriodicMetricReader

public interface MetricReader extends AggregationTemporalitySelector
A reader of metrics from SdkMeterProvider.

Custom implementations of MetricReader are not currently supported. Please use one of the built-in readers such as PeriodicMetricReader.

  • Method Details

    • register

      void register(CollectionRegistration registration)
      Called by SdkMeterProvider and supplies the MetricReader with a handle to collect metrics.

      CollectionRegistration is currently an empty interface because custom implementations of MetricReader are not currently supported.

    • forceFlush

      io.opentelemetry.sdk.common.CompletableResultCode forceFlush()
      Flushes metrics read by this reader.

      In all scenarios, the trigger a metrics collection.

      For readers associated with push MetricExporters, this should MetricExporter.export(Collection) the collected metrics.

      Returns:
      the result of the flush.
    • shutdown

      io.opentelemetry.sdk.common.CompletableResultCode shutdown()
      Shuts down the metric reader.

      For pull endpoints, like prometheus, this should shut down the metric hosting endpoint or server doing such a job.

      For push endpoints, this should shut down any scheduler threads.

      Returns:
      the result of the shutdown.