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 AggregationTemporality
private final Aggregator
<T, U> private final AttributesProcessor
private Map
<Attributes, T> private static final Logger
private final int
This field is set to 1 less than the actual intended cardinality limit, allowing the last slot to be filled by theMetricStorage.CARDINALITY_OVERFLOW
series.private final MemoryMode
private final MetricDescriptor
private Map
<Attributes, T> private final RegisteredReader
private final ObjectPool
<T> private final ThrottlingLogger
Fields inherited from interface io.opentelemetry.sdk.metrics.internal.state.MetricStorage
CARDINALITY_OVERFLOW, DEFAULT_MAX_CARDINALITY
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
AsynchronousMetricStorage
(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 theView
andInstrumentDescriptor
.Returns a description of the metric produced in this storage.Returns the registered reader this storage is associated with.boolean
isEmpty()
Determines whether this storage is an empty metric storage.(package private) void
record
(Measurement measurement) Record callback measurement fromObservableLongMeasurement
orObservableDoubleMeasurement
.private void
recordPoint
(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_OVERFLOW
series. -
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 theView
andInstrumentDescriptor
. -
record
Record callback measurement fromObservableLongMeasurement
orObservableDoubleMeasurement
. -
recordPoint
-
getMetricDescriptor
Description copied from interface:MetricStorage
Returns a description of the metric produced in this storage.- Specified by:
getMetricDescriptor
in 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:MetricStorage
Collects the metrics from this storage. If storingAggregationTemporality.DELTA
metrics, reset for the next collection period.Note: This is a stateful operation and will reset any interval-related state for the
collector
.- Specified by:
collect
in 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
MetricData
from this collection period.
-
isEmpty
public boolean isEmpty()Description copied from interface:MetricStorage
Determines whether this storage is an empty metric storage.Uses the reference comparison since
EmptyMetricStorage
is singleton.- Specified by:
isEmpty
in interfaceMetricStorage
- Returns:
- true if is empty.
-