Interface MetricExporter
- All Superinterfaces:
AggregationTemporalitySelector, AutoCloseable, Closeable, DefaultAggregationSelector
- All Known Implementing Classes:
OtlpGrpcMetricExporter, OtlpHttpMetricExporter
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 Summary
Modifier and TypeMethodDescriptiondefault voidclose()Closes thisMetricExporter, releasing any resources.export(Collection<MetricData> metrics) Exports themetrics.flush()A hint that any metrics previouslyexport(Collection)ed should be completed.default AggregationgetDefaultAggregation(InstrumentType instrumentType) Return the default aggregation for theInstrumentType.default MemoryModeReturns the memory mode used by this exporter's associated reader.shutdown()Shuts down the exporter.Methods inherited from interface AggregationTemporalitySelector
getAggregationTemporalityMethods inherited from interface DefaultAggregationSelector
with
-
Method Details
-
getDefaultAggregation
Return the default aggregation for theInstrumentType.- Specified by:
getDefaultAggregationin interfaceDefaultAggregationSelector- Since:
- 1.16.0
- See Also:
-
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
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 interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-