Interface ExemplarReservoir
public interface ExemplarReservoir
An interface for an exemplar reservoir of samples.
This represents a reservoir for a specific "point" of metric data.
-
Method Summary
Modifier and TypeMethodDescriptioncollectAndReset(io.opentelemetry.api.common.Attributes pointAttributes) Builds (an immutable) list of Exemplars for exporting from the current reservoir.static ExemplarReservoirfiltered(ExemplarFilter filter, ExemplarReservoir original) Wraps aExemplarReservoirwith a measurement pre-filter.static ExemplarReservoirfixedSizeReservoir(io.opentelemetry.sdk.common.Clock clock, int size, Supplier<Random> randomSupplier) A Reservoir sampler with fixed size that stores the given number of exemplars.static ExemplarReservoirhistogramBucketReservoir(io.opentelemetry.sdk.common.Clock clock, List<Double> boundaries) A Reservoir sampler that preserves the latest seen measurement per-histogram bucket.static ExemplarReservoirAn exemplar reservoir that stores no exemplars.voidofferMeasurement(double value, io.opentelemetry.api.common.Attributes attributes, io.opentelemetry.context.Context context) Offers adoublemeasurement to be sampled.voidofferMeasurement(long value, io.opentelemetry.api.common.Attributes attributes, io.opentelemetry.context.Context context) Offers alongmeasurement to be sampled.
-
Method Details
-
noSamples
An exemplar reservoir that stores no exemplars. -
filtered
Wraps aExemplarReservoirwith a measurement pre-filter. -
fixedSizeReservoir
static ExemplarReservoir fixedSizeReservoir(io.opentelemetry.sdk.common.Clock clock, int size, Supplier<Random> randomSupplier) A Reservoir sampler with fixed size that stores the given number of exemplars.- Parameters:
clock- The clock to use when annotating measurements with time.size- The maximum number of exemplars to preserve.randomSupplier- The random number generater to use for sampling.
-
histogramBucketReservoir
static ExemplarReservoir histogramBucketReservoir(io.opentelemetry.sdk.common.Clock clock, List<Double> boundaries) A Reservoir sampler that preserves the latest seen measurement per-histogram bucket.- Parameters:
clock- The clock to use when annotating measurements with time.boundaries- A list of (inclusive) upper bounds for the histogram. Should be in order from lowest to highest.
-
offerMeasurement
void offerMeasurement(long value, io.opentelemetry.api.common.Attributes attributes, io.opentelemetry.context.Context context) Offers alongmeasurement to be sampled. -
offerMeasurement
void offerMeasurement(double value, io.opentelemetry.api.common.Attributes attributes, io.opentelemetry.context.Context context) Offers adoublemeasurement to be sampled. -
collectAndReset
Builds (an immutable) list of Exemplars for exporting from the current reservoir.Additionally, clears the reservoir for the next sampling period.
- Parameters:
pointAttributes- theAttributesassociated with the metric point.ExemplarDatas 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
pointAttributesfrom the original recorded attributes.
-