Class ReservoirCell
- java.lang.Object
-
- io.opentelemetry.sdk.metrics.internal.exemplar.ReservoirCell
-
class ReservoirCell extends java.lang.Object
A Reservoir cell pre-allocated memories for Exemplar data.We only allocate new objects during collection. This class should NOT cause allocations during sampling or within the synchronous metric hot-path.
Allocations are acceptable in the
getAndResetDouble(Attributes)
andgetAndResetLong(Attributes)
collection methods.
-
-
Field Summary
Fields Modifier and Type Field Description private Attributes
attributes
private Clock
clock
private double
doubleValue
private long
longValue
private long
recordTime
private SpanContext
spanContext
-
Constructor Summary
Constructors Constructor Description ReservoirCell(Clock clock)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static Attributes
filtered(Attributes original, Attributes metricPoint)
Returns filtered attributes for exemplars.(package private) DoubleExemplarData
getAndResetDouble(Attributes pointAttributes)
Retrieve the cell'sExemplarData
.(package private) LongExemplarData
getAndResetLong(Attributes pointAttributes)
Retrieve the cell'sExemplarData
.private void
offerMeasurement(Attributes attributes, Context context)
(package private) void
recordDoubleMeasurement(double value, Attributes attributes, Context context)
Record the long measurement to the cell.(package private) void
recordLongMeasurement(long value, Attributes attributes, Context context)
Record the long measurement to the cell.(package private) void
reset()
-
-
-
Field Detail
-
clock
private final Clock clock
-
attributes
@Nullable private Attributes attributes
-
spanContext
private SpanContext spanContext
-
recordTime
private long recordTime
-
longValue
private long longValue
-
doubleValue
private double doubleValue
-
-
Constructor Detail
-
ReservoirCell
ReservoirCell(Clock clock)
-
-
Method Detail
-
recordLongMeasurement
void recordLongMeasurement(long value, Attributes attributes, Context context)
Record the long measurement to the cell.Must be used in tandem with
getAndResetLong(Attributes)
.recordDoubleMeasurement(double, Attributes, Context)
andgetAndResetDouble(Attributes)
must not be used when a cell is recording longs.
-
recordDoubleMeasurement
void recordDoubleMeasurement(double value, Attributes attributes, Context context)
Record the long measurement to the cell.Must be used in tandem with
getAndResetDouble(Attributes)
.recordLongMeasurement(long, Attributes, Context)
andgetAndResetLong(Attributes)
must not be used when a cell is recording longs.
-
offerMeasurement
private void offerMeasurement(Attributes attributes, Context context)
-
getAndResetLong
@Nullable LongExemplarData getAndResetLong(Attributes pointAttributes)
Retrieve the cell'sExemplarData
.Must be used in tandem with
recordLongMeasurement(long, Attributes, Context)
.
-
getAndResetDouble
@Nullable DoubleExemplarData getAndResetDouble(Attributes pointAttributes)
Retrieve the cell'sExemplarData
.Must be used in tandem with
recordDoubleMeasurement(double, Attributes, Context)
.
-
reset
void reset()
-
filtered
private static Attributes filtered(Attributes original, Attributes metricPoint)
Returns filtered attributes for exemplars.
-
-