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 Details

    • noSamples

      static ExemplarReservoir noSamples()
      An exemplar reservoir that stores no exemplars.
    • filtered

      static ExemplarReservoir filtered(ExemplarFilter filter, ExemplarReservoir original)
      Wraps a ExemplarReservoir with 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 a long measurement to be sampled.
    • offerMeasurement

      void offerMeasurement(double value, io.opentelemetry.api.common.Attributes attributes, io.opentelemetry.context.Context context)
      Offers a double measurement to be sampled.
    • collectAndReset

      List<ExemplarData> collectAndReset(io.opentelemetry.api.common.Attributes pointAttributes)
      Builds (an immutable) list of Exemplars for exporting from the current reservoir.

      Additionally, clears the reservoir for the next sampling period.

      Parameters:
      pointAttributes - the Attributes associated 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 pointAttributes from the original recorded attributes.