Interface MetricExporter
-
- All Superinterfaces:
AggregationTemporalitySelector,java.lang.AutoCloseable,java.io.Closeable,DefaultAggregationSelector
- All Known Implementing Classes:
OtlpGrpcMetricExporter,OtlpHttpMetricExporter
public interface MetricExporter extends AggregationTemporalitySelector, DefaultAggregationSelector, java.io.Closeable
A Metric Exporter is a push based interface for exportingMetricDataout ofSdkMeterProvider.To use, associate an exporter with a
PeriodicMetricReader, and register with the metrics SDK viaSdkMeterProviderBuilder.registerMetricReader(MetricReader).- Since:
- 1.14.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidclose()Closes thisMetricExporter, releasing any resources.CompletableResultCodeexport(java.util.Collection<MetricData> metrics)Exports themetrics.CompletableResultCodeflush()A hint that any metrics previouslyexport(Collection)ed should be completed.default AggregationgetDefaultAggregation(InstrumentType instrumentType)Return the default aggregation for theInstrumentType.default MemoryModegetMemoryMode()Returns the memory mode used by this exporter's associated reader.CompletableResultCodeshutdown()Shuts down the exporter.-
Methods inherited from interface io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector
getAggregationTemporality
-
Methods inherited from interface io.opentelemetry.sdk.metrics.export.DefaultAggregationSelector
with
-
-
-
-
Method Detail
-
getDefaultAggregation
default Aggregation getDefaultAggregation(InstrumentType instrumentType)
Return the default aggregation for theInstrumentType.- Specified by:
getDefaultAggregationin interfaceDefaultAggregationSelector- Since:
- 1.16.0
- See Also:
DefaultAggregationSelector.getDefaultAggregation(InstrumentType)
-
getMemoryMode
default MemoryMode getMemoryMode()
Returns the memory mode used by this exporter's associated reader.- Returns:
- The
MemoryModeused by this exporter's associated reader - Since:
- 1.31.0
-
export
CompletableResultCode export(java.util.Collection<MetricData> metrics)
Exports themetrics. The caller (i.e.PeriodicMetricReaderwill 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
CompletableResultCode flush()
A hint that any metrics previouslyexport(Collection)ed should be completed.- Returns:
- the result of the flush, which is often an asynchronous operation.
-
shutdown
CompletableResultCode shutdown()
Shuts down the exporter.Called when
PeriodicMetricReader.shutdown()of the associated reader is called.- Returns:
- a
CompletableResultCodewhich is completed when shutdown completes.
-
close
default void close()
Closes thisMetricExporter, releasing any resources.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
-