public final class LongLastValueAggregator extends Object
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 and Description |
|---|
LongLastValueAggregator() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doRecordDouble(double value)
Concrete Aggregator instances should implement this method in order support recordings of
double values.
|
void |
doRecordLong(long value)
Concrete Aggregator instances should implement this method in order support recordings of long
values.
|
static AggregatorFactory |
getFactory()
Returns an
AggregatorFactory that produces LongLastValueAggregator instances. |
boolean |
hasRecordings()
Whether there have been any recordings since this aggregator has been reset.
|
void |
mergeToAndReset(Aggregator other)
Merges the current value into the given
aggregator and resets the current value in this
Aggregator. |
void |
recordDouble(double value)
Updates the current aggregator with a newly recorded
double value. |
void |
recordLong(long value)
Updates the current aggregator with a newly recorded
long value. |
MetricData.Point |
toPoint(long startEpochNanos,
long epochNanos,
io.opentelemetry.common.Labels labels)
Returns the
Point with the given properties and the value from this Aggregation. |
public static AggregatorFactory getFactory()
AggregatorFactory that produces LongLastValueAggregator instances.AggregatorFactory that produces LongLastValueAggregator instances.@Nullable public MetricData.Point toPoint(long startEpochNanos, long epochNanos, io.opentelemetry.common.Labels labels)
AggregatorPoint with the given properties and the value from this Aggregation.startEpochNanos - the startEpochNanos for the Point.epochNanos - the epochNanos for the Point.labels - the labels for the Point.Point with the value from this Aggregation.public void doRecordLong(long value)
public void mergeToAndReset(Aggregator other)
Aggregatoraggregator and resets the current value in this
Aggregator.mergeToAndReset in interface Aggregatorother - value to merge into.public final void recordLong(long value)
Aggregatorlong value.recordLong in interface Aggregatorvalue - the new long value to be added.public final void recordDouble(double value)
Aggregatordouble value.recordDouble in interface Aggregatorvalue - the new double value to be added.protected void doRecordDouble(double value)
public boolean hasRecordings()
AggregatorhasRecordings in interface Aggregator