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 exportingMetricData
out 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 void
close()
Closes thisMetricExporter
, releasing any resources.CompletableResultCode
export(java.util.Collection<MetricData> metrics)
Exports themetrics
.CompletableResultCode
flush()
A hint that any metrics previouslyexport(Collection)
ed should be completed.default Aggregation
getDefaultAggregation(InstrumentType instrumentType)
Return the default aggregation for theInstrumentType
.default MemoryMode
getMemoryMode()
Returns the memory mode used by this exporter's associated reader.CompletableResultCode
shutdown()
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:
getDefaultAggregation
in 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
MemoryMode
used by this exporter's associated reader - Since:
- 1.31.0
-
export
CompletableResultCode export(java.util.Collection<MetricData> metrics)
Exports themetrics
. 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
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
CompletableResultCode
which is completed when shutdown completes.
-
close
default void close()
Closes thisMetricExporter
, releasing any resources.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
-