Class ExemplarConfig

java.lang.Object
io.prometheus.client.exemplars.ExemplarConfig

public class ExemplarConfig extends Object
Static configuration for Exemplar behavior.
  • Field Details

    • enabled

      private static volatile boolean enabled
    • histogramExemplarSampler

      private static volatile HistogramExemplarSampler histogramExemplarSampler
    • counterExemplarSampler

      private static volatile CounterExemplarSampler counterExemplarSampler
  • Constructor Details

    • ExemplarConfig

      public ExemplarConfig()
  • Method Details

    • setCounterExemplarSampler

      public static void setCounterExemplarSampler(CounterExemplarSampler counterExemplarSampler)
      Set the default exemplar sampler for Counters.
    • setHistogramExemplarSampler

      public static void setHistogramExemplarSampler(HistogramExemplarSampler histogramExemplarSampler)
      Set the default exemplar sampler for Histograms.
    • disableExemplars

      public static void disableExemplars()
      Prevent metrics from loading exemplars from an ExemplarSampler by default.

      You can still enable individual metrics to load exemplars from an ExemplarSampler by calling the metric builder's withExemplars() 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 an ExemplarSampler by default.

      You can still disallow individual metrics to load exemplars from an ExemplarSampler by calling the metric builder's withoutExemplars() method.

      Exemplars are enabled by default. This method is here so that you can temporarily disableExemplars() and then enableExemplars() again.

    • getCounterExemplarSampler

      public static CounterExemplarSampler getCounterExemplarSampler()
      Returns:
      the CounterExemplarSampler that is used by default in Counter metrics.
    • getHistogramExemplarSampler

      public static HistogramExemplarSampler getHistogramExemplarSampler()
      Returns:
      the HistogramExemplarSampler that is used by default in Histogram metrics.
    • isExemplarsEnabled

      public static boolean isExemplarsEnabled()
      Returns:
      true by default, false if disableExemplars() was called.