Class ReservoirCell
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)
and getAndResetLong(Attributes)
collection methods.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Attributes
private final Clock
private double
private long
private long
private SpanContext
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate 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 Details
-
clock
-
attributes
-
spanContext
-
recordTime
private long recordTime -
longValue
private long longValue -
doubleValue
private double doubleValue
-
-
Constructor Details
-
ReservoirCell
ReservoirCell(Clock clock)
-
-
Method Details
-
recordLongMeasurement
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
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
-
getAndResetLong
Retrieve the cell'sExemplarData
.Must be used in tandem with
recordLongMeasurement(long, Attributes, Context)
. -
getAndResetDouble
Retrieve the cell'sExemplarData
.Must be used in tandem with
recordDoubleMeasurement(double, Attributes, Context)
. -
reset
void reset() -
filtered
Returns filtered attributes for exemplars.
-