Class MutableRates

java.lang.Object
org.apache.hadoop.metrics2.lib.MutableMetric
org.apache.hadoop.metrics2.lib.MutableRates

@Public @Evolving public class MutableRates extends MutableMetric
Helper class to manage a group of mutable rate metrics This class synchronizes all accesses to the metrics it contains, so it should not be used in situations where there is high contention on the metrics. MutableRatesWithAggregation is preferable in that situation.
  • Method Details

    • init

      public void init(Class<?> protocol)
      Initialize the registry with all the methods in a protocol so they all show up in the first snapshot. Convenient for JMX implementations.
      Parameters:
      protocol - the protocol class
    • add

      public void add(String name, long elapsed)
      Add a rate sample for a rate metric
      Parameters:
      name - of the rate metric
      elapsed - time
    • snapshot

      public void snapshot(MetricsRecordBuilder rb, boolean all)
      Description copied from class: MutableMetric
      Get a snapshot of the metric
      Specified by:
      snapshot in class MutableMetric
      Parameters:
      rb - the metrics record builder
      all - if true, snapshot unchanged metrics as well