Package io.prometheus.client.exemplars
Class ExemplarConfig
java.lang.Object
io.prometheus.client.exemplars.ExemplarConfig
Static configuration for Exemplar behavior.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static CounterExemplarSampler
private static boolean
private static HistogramExemplarSampler
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Prevent metrics from loading exemplars from anExemplarSampler
by default.static void
Allow metrics to load exemplars from anExemplarSampler
by default.static CounterExemplarSampler
static HistogramExemplarSampler
static boolean
static void
setCounterExemplarSampler
(CounterExemplarSampler counterExemplarSampler) Set the default exemplar sampler for Counters.static void
setHistogramExemplarSampler
(HistogramExemplarSampler histogramExemplarSampler) Set the default exemplar sampler for Histograms.
-
Field Details
-
enabled
private static volatile boolean enabled -
histogramExemplarSampler
-
counterExemplarSampler
-
-
Constructor Details
-
ExemplarConfig
public ExemplarConfig()
-
-
Method Details
-
setCounterExemplarSampler
Set the default exemplar sampler for Counters. -
setHistogramExemplarSampler
Set the default exemplar sampler for Histograms. -
disableExemplars
public static void disableExemplars()Prevent metrics from loading exemplars from anExemplarSampler
by default.You can still enable individual metrics to load exemplars from an
ExemplarSampler
by calling the metric builder'swithExemplars()
method, and you can still provide single exemplars explicitly for individual observations with the...withExemplar()
methods. -
enableExemplars
public static void enableExemplars()Allow metrics to load exemplars from anExemplarSampler
by default.You can still disallow individual metrics to load exemplars from an
ExemplarSampler
by calling the metric builder'swithoutExemplars()
method.Exemplars are enabled by default. This method is here so that you can temporarily
disableExemplars()
and thenenableExemplars()
again. -
getCounterExemplarSampler
- Returns:
- the
CounterExemplarSampler
that is used by default inCounter
metrics.
-
getHistogramExemplarSampler
- Returns:
- the
HistogramExemplarSampler
that is used by default inHistogram
metrics.
-
isExemplarsEnabled
public static boolean isExemplarsEnabled()- Returns:
- true by default, false if
disableExemplars()
was called.
-