Class DefaultExemplarSampler

java.lang.Object
io.prometheus.client.exemplars.DefaultExemplarSampler
All Implemented Interfaces:
CounterExemplarSampler, ExemplarSampler, HistogramExemplarSampler

public class DefaultExemplarSampler extends Object implements ExemplarSampler
Default Exemplar sampler.

Keeps each Exemplar for a minimum of ~7 seconds, then samples a new one.

  • Field Details

  • Constructor Details

  • Method Details

    • sample

      public Exemplar sample(double increment, Exemplar previous)
      Specified by:
      sample in interface CounterExemplarSampler
      Parameters:
      increment - the value added to the counter on this event
      previous - the previously sampled exemplar, or null if there is none.
      Returns:
      an Exemplar to be sampled, or null if the previous exemplar does not need to be updated. Returning null and returning previous is equivalent.
    • sample

      public Exemplar sample(double value, double bucketFrom, double bucketTo, Exemplar previous)
      Specified by:
      sample in interface HistogramExemplarSampler
      Parameters:
      value - the value to be observed.
      bucketFrom - upper boundary of the previous bucket in the histogram. Will be Double.NEGATIVE_INFINITY if there is no previous bucket.
      bucketTo - upper boundary of this histogram bucket. Will be Double.POSITIVE_INFINITY if this is the last bucket.
      previous - the previously sampled exemplar, or null if there is none.
      Returns:
      an Exemplar to be sampled, or null if the previous exemplar does not need to be updated. Returning null and returning previous is equivalent.
    • doSample

      private Exemplar doSample(double value, Exemplar previous)