Package io.prometheus.client.exemplars
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.Clock
private final long
private static final String
private final SpanContextSupplier
private 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:
sample
in interfaceCounterExemplarSampler
- Parameters:
increment
- the value added to the counter on this eventprevious
- the previously sampled exemplar, ornull
if there is none.- Returns:
- an Exemplar to be sampled, or
null
if the previous exemplar does not need to be updated. Returningnull
and returningprevious
is equivalent.
-
sample
- Specified by:
sample
in interfaceHistogramExemplarSampler
- Parameters:
value
- the value to be observed.bucketFrom
- upper boundary of the previous bucket in the histogram. Will beDouble.NEGATIVE_INFINITY
if there is no previous bucket.bucketTo
- upper boundary of this histogram bucket. Will beDouble.POSITIVE_INFINITY
if this is the last bucket.previous
- the previously sampled exemplar, ornull
if there is none.- Returns:
- an Exemplar to be sampled, or
null
if the previous exemplar does not need to be updated. Returningnull
and returningprevious
is equivalent.
-
doSample
-