Class ExemplarConfig
java.lang.Object
io.prometheus.client.exemplars.ExemplarConfig
Static configuration for Exemplar behavior.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static CounterExemplarSamplerprivate static booleanprivate static HistogramExemplarSampler -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidPrevent metrics from loading exemplars from anExemplarSamplerby default.static voidAllow metrics to load exemplars from anExemplarSamplerby default.static CounterExemplarSamplerstatic HistogramExemplarSamplerstatic booleanstatic voidsetCounterExemplarSampler(CounterExemplarSampler counterExemplarSampler) Set the default exemplar sampler for Counters.static voidsetHistogramExemplarSampler(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 anExemplarSamplerby default.You can still enable individual metrics to load exemplars from an
ExemplarSamplerby 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 anExemplarSamplerby default.You can still disallow individual metrics to load exemplars from an
ExemplarSamplerby 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
CounterExemplarSamplerthat is used by default inCountermetrics.
-
getHistogramExemplarSampler
- Returns:
- the
HistogramExemplarSamplerthat is used by default inHistogrammetrics.
-
isExemplarsEnabled
public static boolean isExemplarsEnabled()- Returns:
- true by default, false if
disableExemplars()was called.
-