Interface MetricReader
- All Superinterfaces:
AggregationTemporalitySelector
,DefaultAggregationSelector
- All Known Implementing Classes:
PeriodicMetricReader
A metric reader reads metrics from an
SdkMeterProvider
.
Custom implementations of MetricReader
are not currently supported. Please use one of
the built-in readers such as PeriodicMetricReader
.
- Since:
- 1.14.0
-
Method Summary
Modifier and TypeMethodDescriptionio.opentelemetry.sdk.common.CompletableResultCode
Read and export the metrics.default Aggregation
getDefaultAggregation
(InstrumentType instrumentType) Return the default aggregation for theInstrumentType
.void
register
(CollectionRegistration registration) Called bySdkMeterProvider
and supplies theMetricReader
with a handle to collect metrics.io.opentelemetry.sdk.common.CompletableResultCode
shutdown()
Shuts down the metric reader.Methods inherited from interface io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector
getAggregationTemporality
Methods inherited from interface io.opentelemetry.sdk.metrics.export.DefaultAggregationSelector
with
-
Method Details
-
register
Called bySdkMeterProvider
and supplies theMetricReader
with a handle to collect metrics.CollectionRegistration
is currently an empty interface because custom implementations ofMetricReader
are not currently supported. -
getDefaultAggregation
Return the default aggregation for theInstrumentType
.- Specified by:
getDefaultAggregation
in interfaceDefaultAggregationSelector
- Since:
- 1.16.0
- See Also:
-
forceFlush
io.opentelemetry.sdk.common.CompletableResultCode forceFlush()Read and export the metrics.Called when
SdkMeterProvider.forceFlush()
is called.- Returns:
- the result of the flush.
-
shutdown
io.opentelemetry.sdk.common.CompletableResultCode shutdown()Shuts down the metric reader.Called when
SdkMeterProvider.shutdown()
is called.For pull based readers like prometheus, this should shut down the metric hosting endpoint or server doing such a job.
For push based readers like
MetricExporter
, this should shut down any scheduler threads.- Returns:
- the result of the shutdown.
-