Class LongLastValueAggregator
- java.lang.Object
-
- io.opentelemetry.sdk.metrics.aggregator.LongLastValueAggregator
-
- All Implemented Interfaces:
Aggregator
public final class LongLastValueAggregator extends java.lang.ObjectAggregator that aggregates recorded values by storing the last recorded value.Limitation: The current implementation does not store a time when the value was recorded, so merging multiple LastValueAggregators will not preserve the ordering of records. This is not a problem because LastValueAggregator is currently only available for Observers which record all values once.
-
-
Constructor Summary
Constructors Constructor Description LongLastValueAggregator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoRecordDouble(double value)Concrete Aggregator instances should implement this method in order support recordings of double values.voiddoRecordLong(long value)Concrete Aggregator instances should implement this method in order support recordings of long values.static AggregatorFactorygetFactory()Returns anAggregatorFactorythat producesLongLastValueAggregatorinstances.booleanhasRecordings()Whether there have been any recordings since this aggregator has been reset.voidmergeToAndReset(Aggregator other)Merges the current value into the givenaggregatorand resets the current value in thisAggregator.voidrecordDouble(double value)Updates the current aggregator with a newly recordeddoublevalue.voidrecordLong(long value)Updates the current aggregator with a newly recordedlongvalue.MetricData.PointtoPoint(long startEpochNanos, long epochNanos, io.opentelemetry.api.common.Labels labels)Returns thePointwith the given properties and the value from this Aggregation.
-
-
-
Method Detail
-
getFactory
public static AggregatorFactory getFactory()
Returns anAggregatorFactorythat producesLongLastValueAggregatorinstances.- Returns:
- an
AggregatorFactorythat producesLongLastValueAggregatorinstances.
-
toPoint
@Nullable public MetricData.Point toPoint(long startEpochNanos, long epochNanos, io.opentelemetry.api.common.Labels labels)
Description copied from interface:AggregatorReturns thePointwith the given properties and the value from this Aggregation.- Parameters:
startEpochNanos- the startEpochNanos for thePoint.epochNanos- the epochNanos for thePoint.labels- the labels for thePoint.- Returns:
- the
Pointwith the value from this Aggregation.
-
doRecordLong
public void doRecordLong(long value)
Concrete Aggregator instances should implement this method in order support recordings of long values.
-
mergeToAndReset
public void mergeToAndReset(Aggregator other)
Description copied from interface:AggregatorMerges the current value into the givenaggregatorand resets the current value in thisAggregator.- Specified by:
mergeToAndResetin interfaceAggregator- Parameters:
other- value to merge into.
-
recordLong
public final void recordLong(long value)
Description copied from interface:AggregatorUpdates the current aggregator with a newly recordedlongvalue.- Specified by:
recordLongin interfaceAggregator- Parameters:
value- the newlongvalue to be added.
-
recordDouble
public final void recordDouble(double value)
Description copied from interface:AggregatorUpdates the current aggregator with a newly recordeddoublevalue.- Specified by:
recordDoublein interfaceAggregator- Parameters:
value- the newdoublevalue to be added.
-
doRecordDouble
protected void doRecordDouble(double value)
Concrete Aggregator instances should implement this method in order support recordings of double values.
-
hasRecordings
public boolean hasRecordings()
Description copied from interface:AggregatorWhether there have been any recordings since this aggregator has been reset.- Specified by:
hasRecordingsin interfaceAggregator
-
-