Interface MetricProducer
-
- All Known Implementing Classes:
SdkMeterProvider.LeasedMetricProducer
@ThreadSafe public interface MetricProducer
MetricProducer
is the interface that is used to make metric data available to theMetricReader
s. The primary implementation is provided bySdkMeterProvider
.Alternative
MetricProducer
implementations can be used to bridge aggregated metrics from other frameworks, and are registered withSdkMeterProviderBuilder.registerMetricProducer(MetricProducer)
. NOTE: When possible, metrics from other frameworks SHOULD be bridged using the metric API, normally with asynchronous instruments which observe the aggregated state of the other framework. However,MetricProducer
exists to accommodate scenarios where the metric API is insufficient. It should be used with caution as it requires the bridge to take a dependency onopentelemetry-sdk-metrics
, which is generally not advised.Implementations must be thread-safe.
- Since:
- 1.31.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Collection<MetricData>
produce(Resource resource)
Returns a collection of producedMetricData
s to be exported.
-
-
-
Method Detail
-
produce
java.util.Collection<MetricData> produce(Resource resource)
Returns a collection of producedMetricData
s to be exported. This will only be those metrics that have been produced since the last time this method was called.- Returns:
- a collection of produced
MetricData
s to be exported.
-
-