Interface MetricExporter

All Superinterfaces:
AutoCloseable, Closeable

public interface MetricExporter extends Closeable
MetricExporter is the interface that all "push based" metric libraries should use to export metrics to the OpenTelemetry exporters.

All OpenTelemetry exporters should allow access to a MetricExporter instance.

  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Closes this MetricExporter, releasing any resources.
    io.opentelemetry.sdk.common.CompletableResultCode
    Exports the collection of given MetricData.
    io.opentelemetry.sdk.common.CompletableResultCode
    Exports the collection of MetricData that have not yet been exported.
    Returns the preferred temporality for metrics.
    io.opentelemetry.sdk.common.CompletableResultCode
    Called when the associated IntervalMetricReader is shutdown.
  • Method Details

    • getPreferredTemporality

      @Nullable default AggregationTemporality getPreferredTemporality()
      Returns the preferred temporality for metrics.
    • export

      io.opentelemetry.sdk.common.CompletableResultCode export(Collection<MetricData> metrics)
      Exports the collection of given MetricData. Note that export operations can be performed simultaneously depending on the type of metric reader being used. However, the caller MUST ensure that only one export can occur at a time.
      Parameters:
      metrics - the collection of MetricData to be exported.
      Returns:
      the result of the export, which is often an asynchronous operation.
    • flush

      io.opentelemetry.sdk.common.CompletableResultCode flush()
      Exports the collection of MetricData that have not yet been exported. Note that flush operations can be performed simultaneously depending on the type of metric reader being used. However, the caller MUST ensure that only one export can occur at a time.
      Returns:
      the result of the flush, which is often an asynchronous operation.
    • shutdown

      io.opentelemetry.sdk.common.CompletableResultCode shutdown()
      Called when the associated IntervalMetricReader is shutdown.
      Returns:
      a CompletableResultCode which is completed when shutdown completes.
    • close

      default void close()
      Closes this MetricExporter, releasing any resources.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable