Class MutableMetric

java.lang.Object
org.apache.hadoop.metrics2.lib.MutableMetric
Direct Known Subclasses:
MutableCounter, MutableGauge, MutableQuantiles, MutableRates, MutableRatesWithAggregation, MutableRollingAverages, MutableStat

@Public @Evolving public abstract class MutableMetric extends Object
The mutable metric interface
  • Constructor Details

    • MutableMetric

      public MutableMetric()
  • Method Details

    • snapshot

      public abstract void snapshot(MetricsRecordBuilder builder, boolean all)
      Get a snapshot of the metric
      Parameters:
      builder - the metrics record builder
      all - if true, snapshot unchanged metrics as well
    • snapshot

      public void snapshot(MetricsRecordBuilder builder)
      Get a snapshot of metric if changed
      Parameters:
      builder - the metrics record builder
    • setChanged

      protected void setChanged()
      Set the changed flag in mutable operations
    • clearChanged

      protected void clearChanged()
      Clear the changed flag in the snapshot operations
    • changed

      public boolean changed()
      Returns:
      true if metric is changed since last snapshot