Package io.prometheus.client.exemplars
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.
-
-
Constructor Summary
Constructors Constructor Description DefaultExemplarSampler(io.prometheus.client.exemplars.tracer.common.SpanContextSupplier spanContextSupplier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Exemplarsample(double value, double bucketFrom, double bucketTo, Exemplar previous)Exemplarsample(double increment, Exemplar previous)
-
-
-
Constructor Detail
-
DefaultExemplarSampler
public DefaultExemplarSampler(io.prometheus.client.exemplars.tracer.common.SpanContextSupplier spanContextSupplier)
-
-
Method Detail
-
sample
public Exemplar sample(double increment, Exemplar previous)
- Specified by:
samplein interfaceCounterExemplarSampler- Parameters:
increment- the value added to the counter on this eventprevious- the previously sampled exemplar, ornullif there is none.- Returns:
- an Exemplar to be sampled, or
nullif the previous exemplar does not need to be updated. Returningnulland returningpreviousis equivalent.
-
sample
public Exemplar sample(double value, double bucketFrom, double bucketTo, Exemplar previous)
- Specified by:
samplein interfaceHistogramExemplarSampler- Parameters:
value- the value to be observed.bucketFrom- upper boundary of the previous bucket in the histogram. Will beDouble.NEGATIVE_INFINITYif there is no previous bucket.bucketTo- upper boundary of this histogram bucket. Will beDouble.POSITIVE_INFINITYif this is the last bucket.previous- the previously sampled exemplar, ornullif there is none.- Returns:
- an Exemplar to be sampled, or
nullif the previous exemplar does not need to be updated. Returningnulland returningpreviousis equivalent.
-
-