Interface MetricReader

All Known Implementing Classes:
PeriodicMetricReader

public interface MetricReader
A registered reader of metrics.

This interface provides the SdkMeterProvider a mechanism of global control over metrics during shutdown or memory pressure scenarios.

  • Method Summary

    Modifier and Type
    Method
    Description
    io.opentelemetry.sdk.common.CompletableResultCode
    Flushes metrics read by this reader.
    Return The preferred temporality for metrics.
    io.opentelemetry.sdk.common.CompletableResultCode
    Shuts down the metric reader.
  • Method Details

    • getPreferredTemporality

      @Nullable AggregationTemporality getPreferredTemporality()
      Return The preferred temporality for metrics.
    • flush

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

      In all scenarios, the associated MetricProducer should have its MetricProducer.collectAllMetrics() method called.

      For push endpoints, this should collect and report metrics as normal.

      Returns:
      the result of the shutdown.
    • 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.