Class MetricUtils

java.lang.Object
org.infinispan.metrics.impl.MetricUtils

public final class MetricUtils extends Object
Utility methods for metrics.
Since:
13.0
Author:
Pedro Ruivo
  • Method Details

    • createGauge

      public static <C> org.infinispan.commons.stat.GaugeMetricInfo<C> createGauge(String name, String description, Function<C,Number> function, Map<String,String> tags)
      Creates a Gauge metric.
      Type Parameters:
      C - The instance type to track.
      Parameters:
      name - The metric name.
      description - The metric description.
      function - The Function invoked to return the metric value.
      tags - Additional metric tags.
      Returns:
      The MetricInfo to be registered.
    • createTimer

      public static <C> org.infinispan.commons.stat.TimerMetricInfo<C> createTimer(String name, String description, BiConsumer<C,org.infinispan.commons.stat.TimerTracker> consumer, Map<String,String> tags)
      Creates a Timer metric.
      Type Parameters:
      C - The instance type to track.
      Parameters:
      name - The metric name.
      description - The metrics description.
      consumer - The BiConsumer invoked with the TimerTracker instance to update.
      tags - Additional metric tags.
      Returns:
      The MetricInfo to be registered.
    • createCounter

      public static <C> org.infinispan.commons.stat.CounterMetricInfo<C> createCounter(String name, String description, BiConsumer<C,org.infinispan.commons.stat.CounterTracker> consumer, Map<String,String> tags)
      Creates a Counter metric.
      Type Parameters:
      C - The instance type to track.
      Parameters:
      name - The metric name.
      description - The metrics description.
      consumer - The BiConsumer invoked with the CounterTracker instance to update.
      tags - Additional metric tags.
      Returns:
      The CounterMetricInfo to be registered.
    • createFunctionTimer

      public static <C> org.infinispan.commons.stat.FunctionTimerMetricInfo<C> createFunctionTimer(String name, String description, BiConsumer<C,org.infinispan.commons.stat.TimerTracker> consumer, Map<String,String> tags)
      Creates a Timer metric without histogram support.

      The records duration will be stored in TimeUnit.NANOSECONDS

      Type Parameters:
      C - The instance type to track.
      Parameters:
      name - The metric name.
      description - The metrics description.
      consumer - The BiConsumer invoked with the TimerTracker instance to update.
      tags - Additional metric tags.
      Returns:
      The FunctionTimerMetricInfo to be registered.
      See Also:
    • createDistributionSummary

      public static <C> org.infinispan.commons.stat.DistributionSummaryMetricInfo<C> createDistributionSummary(String name, String description, BiConsumer<C,org.infinispan.commons.stat.DistributionSummaryTracker> consumer, Map<String,String> tags)
      Creates a Distribution Summary metric.
      Type Parameters:
      C - The instance type to track.
      Parameters:
      name - The metric name.
      description - The metrics description.
      consumer - The BiConsumer invoked with the DistributionSummaryTracker instance to update.
      tags - Additional metric tags.
      Returns:
      The DistributionSummaryMetricInfo to be registered.