Class FixedSizeExemplarReservoir<T extends ExemplarData>
java.lang.Object
io.opentelemetry.sdk.metrics.internal.exemplar.FixedSizeExemplarReservoir<T>
- All Implemented Interfaces:
ExemplarReservoir<T>
- Direct Known Subclasses:
HistogramExemplarReservoir
,RandomFixedSizeExemplarReservoir
abstract class FixedSizeExemplarReservoir<T extends ExemplarData>
extends Object
implements ExemplarReservoir<T>
Base for fixed-size reservoir sampling of Exemplars.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private final BiFunction
<ReservoirCell, Attributes, T> private final ReservoirCellSelector
private final ReservoirCell[]
-
Constructor Summary
ConstructorsConstructorDescriptionFixedSizeExemplarReservoir
(Clock clock, int size, ReservoirCellSelector reservoirCellSelector, BiFunction<ReservoirCell, Attributes, T> mapAndResetCell) Instantiates an exemplar reservoir of fixed size. -
Method Summary
Modifier and TypeMethodDescriptioncollectAndReset
(Attributes pointAttributes) Returns an immutable list of Exemplars for exporting from the current reservoir.void
offerDoubleMeasurement
(double value, Attributes attributes, Context context) Offers adouble
measurement to be sampled.void
offerLongMeasurement
(long value, Attributes attributes, Context context) Offers along
measurement to be sampled.
-
Field Details
-
storage
-
reservoirCellSelector
-
mapAndResetCell
-
hasMeasurements
private volatile boolean hasMeasurements
-
-
Constructor Details
-
FixedSizeExemplarReservoir
FixedSizeExemplarReservoir(Clock clock, int size, ReservoirCellSelector reservoirCellSelector, BiFunction<ReservoirCell, Attributes, T> mapAndResetCell) Instantiates an exemplar reservoir of fixed size.
-
-
Method Details
-
offerLongMeasurement
Description copied from interface:ExemplarReservoir
Offers along
measurement to be sampled.- Specified by:
offerLongMeasurement
in interfaceExemplarReservoir<T extends ExemplarData>
-
offerDoubleMeasurement
Description copied from interface:ExemplarReservoir
Offers adouble
measurement to be sampled.- Specified by:
offerDoubleMeasurement
in interfaceExemplarReservoir<T extends ExemplarData>
-
collectAndReset
Description copied from interface:ExemplarReservoir
Returns an immutable list of Exemplars for exporting from the current reservoir.Additionally, clears the reservoir for the next sampling period.
- Specified by:
collectAndReset
in interfaceExemplarReservoir<T extends ExemplarData>
- Parameters:
pointAttributes
- theAttributes
associated with the metric point.ExemplarData
s should filter these out of their final data state.- Returns:
- An (immutable) list of sampled exemplars for this point. Implementers are expected to
filter out
pointAttributes
from the original recorded attributes.
-