Interface MetricExporter
- All Superinterfaces:
AutoCloseable,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 TypeMethodDescriptionstatic AggregationTemporalityalwaysCumulative(InstrumentType unused) A common implementation ofgetAggregationTemporality(InstrumentType)which returnsAggregationTemporality.CUMULATIVEfor all instruments.default voidclose()Closes thisMetricExporter, releasing any resources.static AggregationTemporalitydeltaPreferred(InstrumentType instrumentType) A common implementation ofgetAggregationTemporality(InstrumentType)which indicates delta preference.io.opentelemetry.sdk.common.CompletableResultCodeexport(Collection<MetricData> metrics) Exports the collection of givenMetricData.io.opentelemetry.sdk.common.CompletableResultCodeflush()Exports the collection ofMetricDatathat have not yet been exported.getAggregationTemporality(InstrumentType instrumentType) Return the default aggregation temporality for theInstrumentType.io.opentelemetry.sdk.common.CompletableResultCodeshutdown()Called when the associated IntervalMetricReader is shutdown.
-
Method Details
-
alwaysCumulative
A common implementation ofgetAggregationTemporality(InstrumentType)which returnsAggregationTemporality.CUMULATIVEfor all instruments. -
deltaPreferred
A common implementation ofgetAggregationTemporality(InstrumentType)which indicates delta preference.AggregationTemporality.DELTAis returned forInstrumentType.COUNTER,InstrumentType.OBSERVABLE_COUNTER, andInstrumentType.HISTOGRAM.AggregationTemporality.CUMULATIVEis returned forInstrumentType.UP_DOWN_COUNTERandInstrumentType.OBSERVABLE_UP_DOWN_COUNTER. -
getAggregationTemporality
Return the default aggregation temporality for theInstrumentType. -
export
Exports the collection of givenMetricData. 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 ofMetricDatato be exported.- Returns:
- the result of the export, which is often an asynchronous operation.
-
flush
io.opentelemetry.sdk.common.CompletableResultCode flush()Exports the collection ofMetricDatathat 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
CompletableResultCodewhich is completed when shutdown completes.
-
close
default void close()Closes thisMetricExporter, releasing any resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-