Class AsynchronousMetricStorage<T extends PointData,U extends ExemplarData>
java.lang.Object
io.opentelemetry.sdk.metrics.internal.state.AsynchronousMetricStorage<T,U>
- All Implemented Interfaces:
MetricStorage
public final class AsynchronousMetricStorage<T extends PointData,U extends ExemplarData>
extends Object
implements MetricStorage
Stores aggregated
MetricData for asynchronous instruments.
This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AggregationTemporalityprivate final Aggregator<T, U> private final AttributesProcessorprivate Map<Attributes, T> private static final Loggerprivate final intThis field is set to 1 less than the actual intended cardinality limit, allowing the last slot to be filled by theMetricStorage.CARDINALITY_OVERFLOWseries.private final MemoryModeprivate final MetricDescriptorprivate Map<Attributes, T> private final RegisteredReaderprivate final ObjectPool<T> private final ThrottlingLoggerFields inherited from interface io.opentelemetry.sdk.metrics.internal.state.MetricStorage
CARDINALITY_OVERFLOW, DEFAULT_MAX_CARDINALITY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateAsynchronousMetricStorage(RegisteredReader registeredReader, MetricDescriptor metricDescriptor, Aggregator<T, U> aggregator, AttributesProcessor attributesProcessor, int maxCardinality) -
Method Summary
Modifier and TypeMethodDescriptioncollect(Resource resource, InstrumentationScopeInfo instrumentationScopeInfo, long startEpochNanos, long epochNanos) Collects the metrics from this storage.static <T extends PointData,U extends ExemplarData>
AsynchronousMetricStorage<T, U> create(RegisteredReader registeredReader, RegisteredView registeredView, InstrumentDescriptor instrumentDescriptor) Create an asynchronous storage instance for theViewandInstrumentDescriptor.Returns a description of the metric produced in this storage.Returns the registered reader this storage is associated with.booleanisEmpty()Determines whether this storage is an empty metric storage.(package private) voidrecord(Measurement measurement) Record callback measurement fromObservableLongMeasurementorObservableDoubleMeasurement.private voidrecordPoint(Attributes attributes, Measurement measurement)
-
Field Details
-
logger
-
throttlingLogger
-
registeredReader
-
metricDescriptor
-
aggregationTemporality
-
aggregator
-
attributesProcessor
-
maxCardinality
private final int maxCardinalityThis field is set to 1 less than the actual intended cardinality limit, allowing the last slot to be filled by theMetricStorage.CARDINALITY_OVERFLOWseries. -
points
-
lastPoints
-
reusablePointsPool
-
reusableResultList
-
memoryMode
-
-
Constructor Details
-
AsynchronousMetricStorage
private AsynchronousMetricStorage(RegisteredReader registeredReader, MetricDescriptor metricDescriptor, Aggregator<T, U> aggregator, AttributesProcessor attributesProcessor, int maxCardinality)
-
-
Method Details
-
create
public static <T extends PointData,U extends ExemplarData> AsynchronousMetricStorage<T,U> create(RegisteredReader registeredReader, RegisteredView registeredView, InstrumentDescriptor instrumentDescriptor) Create an asynchronous storage instance for theViewandInstrumentDescriptor. -
record
Record callback measurement fromObservableLongMeasurementorObservableDoubleMeasurement. -
recordPoint
-
getMetricDescriptor
Description copied from interface:MetricStorageReturns a description of the metric produced in this storage.- Specified by:
getMetricDescriptorin interfaceMetricStorage
-
getRegisteredReader
Returns the registered reader this storage is associated with. -
collect
public MetricData collect(Resource resource, InstrumentationScopeInfo instrumentationScopeInfo, long startEpochNanos, long epochNanos) Description copied from interface:MetricStorageCollects the metrics from this storage. If storingAggregationTemporality.DELTAmetrics, reset for the next collection period.Note: This is a stateful operation and will reset any interval-related state for the
collector.- Specified by:
collectin interfaceMetricStorage- Parameters:
resource- The resource associated with the metrics.instrumentationScopeInfo- The instrumentation scope generating the metrics.startEpochNanos- The start timestamp for this SDK.epochNanos- The timestamp for this collection.- Returns:
- The
MetricDatafrom this collection period.
-
isEmpty
public boolean isEmpty()Description copied from interface:MetricStorageDetermines whether this storage is an empty metric storage.Uses the reference comparison since
EmptyMetricStorageis singleton.- Specified by:
isEmptyin interfaceMetricStorage- Returns:
- true if is empty.
-