Class MetricsUtils

java.lang.Object
org.apache.jackrabbit.oak.plugins.index.MetricsUtils

public class MetricsUtils extends Object
  • Constructor Details

    • MetricsUtils

      public MetricsUtils()
  • Method Details

    • setCounterOnce

      public static void setCounterOnce(StatisticsProvider statisticsProvider, String name, long value)

      Set a counter metric to the given value. The previous value of the metric is discarded and replaced by the given value.

      Note that this method is to support a non-standard use case of the counter metrics. Normally counters are incremented periodically to keep track of how many times an event occurred. This method instead is intended to be called only once for a given metric, to provide the final value of the metrics. If called more than once for the same metric, it will log a warning and discard the old value.

      Parameters:
      statisticsProvider - The statistics provider to use.
      name - The name of the counter to set.
      value - The value to set
    • addMetric

      public static void addMetric(StatisticsProvider statisticsProvider, IndexingReporter reporter, String name, long value)
    • addMetricByteSize

      public static void addMetricByteSize(StatisticsProvider statisticsProvider, IndexingReporter reporter, String name, long value)