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 Attributesprivate final Clockprivate doubleprivate longprivate longprivate SpanContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate 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 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.
-