Class DefaultExemplarSampler
java.lang.Object
io.prometheus.client.exemplars.DefaultExemplarSampler
- All Implemented Interfaces:
CounterExemplarSampler, ExemplarSampler, HistogramExemplarSampler
Default Exemplar sampler.
Keeps each Exemplar for a minimum of ~7 seconds, then samples a new one.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static interface(package private) static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DefaultExemplarSampler.Clockprivate final longprivate static final Stringprivate final SpanContextSupplierprivate static final String -
Constructor Summary
ConstructorsConstructorDescriptionDefaultExemplarSampler(SpanContextSupplier spanContextSupplier) DefaultExemplarSampler(SpanContextSupplier spanContextSupplier, DefaultExemplarSampler.Clock clock) -
Method Summary
-
Field Details
-
SPAN_ID
- See Also:
-
TRACE_ID
- See Also:
-
spanContextSupplier
-
minRetentionIntervalMs
private final long minRetentionIntervalMs- See Also:
-
clock
-
-
Constructor Details
-
DefaultExemplarSampler
-
DefaultExemplarSampler
DefaultExemplarSampler(SpanContextSupplier spanContextSupplier, DefaultExemplarSampler.Clock clock)
-
-
Method Details
-
sample
- 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
- 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.
-
doSample
-