Class ReservoirCell
- java.lang.Object
-
- io.opentelemetry.sdk.metrics.internal.exemplar.ReservoirCell
-
class ReservoirCell extends java.lang.ObjectA 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 Attributesattributesprivate Clockclockprivate doubledoubleValueprivate longlongValueprivate longrecordTimeprivate SpanContextspanContext
-
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 Attributesfiltered(Attributes original, Attributes metricPoint)Returns filtered attributes for exemplars.(package private) DoubleExemplarDatagetAndResetDouble(Attributes pointAttributes)Retrieve the cell'sExemplarData.(package private) LongExemplarDatagetAndResetLong(Attributes pointAttributes)Retrieve the cell'sExemplarData.private voidofferMeasurement(Attributes attributes, Context context)(package private) voidrecordDoubleMeasurement(double value, Attributes attributes, Context context)Record the long measurement to the cell.(package private) voidrecordLongMeasurement(long value, Attributes attributes, Context context)Record the long measurement to the cell.(package private) voidreset()
-
-
-
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.
-
-