Class RollingWindowManager

java.lang.Object
org.apache.hadoop.hdfs.server.namenode.top.window.RollingWindowManager

@Private public class RollingWindowManager extends Object
A class to manage the set of RollingWindows. This class is the interface of metrics system to the RollingWindows to retrieve the current top metrics.

Thread-safety is provided by each RollingWindow being thread-safe as well as ConcurrentHashMap for the collection of them.

  • Field Details

    • LOG

      public static final org.slf4j.Logger LOG
    • metricMap

      public ConcurrentHashMap<String,org.apache.hadoop.hdfs.server.namenode.top.window.RollingWindowManager.RollingWindowMap> metricMap
      A mapping from each reported metric to its RollingWindowManager.RollingWindowMap that maintains the set of RollingWindows for the users that have operated on that metric.
  • Constructor Details

    • RollingWindowManager

      public RollingWindowManager(org.apache.hadoop.conf.Configuration conf, int reportingPeriodMs)
  • Method Details

    • recordMetric

      public void recordMetric(long time, String command, String user, long delta)
      Called when the metric command is changed by "delta" units at time "time" via user "user"
      Parameters:
      time - the time of the event
      command - the metric that is updated, e.g., the operation name
      user - the user that updated the metric
      delta - the amount of change in the metric, e.g., +1
    • snapshot

      public RollingWindowManager.TopWindow snapshot(long time)
      Take a snapshot of current top users in the past period.
      Parameters:
      time - the current time
      Returns:
      a TopWindow describing the top users for each metric in the window.