Interface MetricExporter

All Superinterfaces:
AggregationTemporalitySelector, AutoCloseable, Closeable, DefaultAggregationSelector

public interface MetricExporter extends AggregationTemporalitySelector, DefaultAggregationSelector, Closeable
A Metric Exporter is a push based interface for exporting MetricData out of SdkMeterProvider.

To use, associate an exporter with a PeriodicMetricReader, and register with the metrics SDK via SdkMeterProviderBuilder.registerMetricReader(MetricReader).

Since:
1.14.0
  • Method Details

    • getDefaultAggregation

      default Aggregation getDefaultAggregation(InstrumentType instrumentType)
      Return the default aggregation for the InstrumentType.
      Specified by:
      getDefaultAggregation in interface DefaultAggregationSelector
      Since:
      1.16.0
      See Also:
    • getMemoryMode

      default io.opentelemetry.sdk.common.export.MemoryMode getMemoryMode()
      Returns the memory mode used by this exporter's associated reader.
      Returns:
      The MemoryMode used by this exporter's associated reader
      Since:
      1.31.0
    • export

      io.opentelemetry.sdk.common.CompletableResultCode export(Collection<MetricData> metrics)
      Exports the metrics. The caller (i.e. PeriodicMetricReader will not call export until the previous call completes.
      Parameters:
      metrics - the metrics to export.
      Returns:
      the result of the export, which is often an asynchronous operation.
    • flush

      io.opentelemetry.sdk.common.CompletableResultCode flush()
      A hint that any metrics previously export(Collection)ed should be completed.
      Returns:
      the result of the flush, which is often an asynchronous operation.
    • shutdown

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

      Called when PeriodicMetricReader.shutdown() of the associated reader is called.

      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