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 java.lang.Object implements MetricStorage
Stores aggregatedMetricDatafor 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
Fields Modifier and Type Field Description private AggregationTemporalityaggregationTemporalityprivate Aggregator<T,U>aggregatorprivate AttributesProcessorattributesProcessorprivate java.util.Map<Attributes,T>lastPointsprivate static java.util.logging.Loggerloggerprivate intmaxCardinalityThis field is set to 1 less than the actual intended cardinality limit, allowing the last slot to be filled by theMetricStorage.CARDINALITY_OVERFLOWseries.private MemoryModememoryModeprivate MetricDescriptormetricDescriptorprivate java.util.Map<Attributes,T>pointsprivate RegisteredReaderregisteredReaderprivate ObjectPool<T>reusablePointsPoolprivate java.util.ArrayList<T>reusableResultListprivate ThrottlingLoggerthrottlingLogger-
Fields inherited from interface io.opentelemetry.sdk.metrics.internal.state.MetricStorage
CARDINALITY_OVERFLOW, DEFAULT_MAX_CARDINALITY
-
-
Constructor Summary
Constructors Modifier Constructor Description privateAsynchronousMetricStorage(RegisteredReader registeredReader, MetricDescriptor metricDescriptor, Aggregator<T,U> aggregator, AttributesProcessor attributesProcessor, int maxCardinality)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MetricDatacollect(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.MetricDescriptorgetMetricDescriptor()Returns a description of the metric produced in this storage.RegisteredReadergetRegisteredReader()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 Detail
-
logger
private static final java.util.logging.Logger logger
-
throttlingLogger
private final ThrottlingLogger throttlingLogger
-
registeredReader
private final RegisteredReader registeredReader
-
metricDescriptor
private final MetricDescriptor metricDescriptor
-
aggregationTemporality
private final AggregationTemporality aggregationTemporality
-
aggregator
private final Aggregator<T extends PointData,U extends ExemplarData> aggregator
-
attributesProcessor
private final AttributesProcessor attributesProcessor
-
maxCardinality
private final int maxCardinality
This field is set to 1 less than the actual intended cardinality limit, allowing the last slot to be filled by theMetricStorage.CARDINALITY_OVERFLOWseries.
-
points
private java.util.Map<Attributes,T extends PointData> points
-
lastPoints
private java.util.Map<Attributes,T extends PointData> lastPoints
-
reusablePointsPool
private final ObjectPool<T extends PointData> reusablePointsPool
-
memoryMode
private final MemoryMode memoryMode
-
-
Constructor Detail
-
AsynchronousMetricStorage
private AsynchronousMetricStorage(RegisteredReader registeredReader, MetricDescriptor metricDescriptor, Aggregator<T,U> aggregator, AttributesProcessor attributesProcessor, int maxCardinality)
-
-
Method Detail
-
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
void record(Measurement measurement)
Record callback measurement fromObservableLongMeasurementorObservableDoubleMeasurement.
-
recordPoint
private void recordPoint(Attributes attributes, Measurement measurement)
-
getMetricDescriptor
public MetricDescriptor getMetricDescriptor()
Description copied from interface:MetricStorageReturns a description of the metric produced in this storage.- Specified by:
getMetricDescriptorin interfaceMetricStorage
-
getRegisteredReader
public RegisteredReader 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.
-
-