Class RollingWindowManager
java.lang.Object
org.apache.hadoop.hdfs.server.namenode.top.window.RollingWindowManager
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents an operation within a TopWindow.static classRepresents a snapshot of the rolling window.static classRepresents a user who called an Op within a TopWindow. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.slf4j.LoggerConcurrentHashMap<String,org.apache.hadoop.hdfs.server.namenode.top.window.RollingWindowManager.RollingWindowMap> A mapping from each reported metric to itsRollingWindowManager.RollingWindowMapthat maintains the set ofRollingWindows for the users that have operated on that metric. -
Constructor Summary
ConstructorsConstructorDescriptionRollingWindowManager(org.apache.hadoop.conf.Configuration conf, int reportingPeriodMs) -
Method Summary
Modifier and TypeMethodDescriptionvoidrecordMetric(long time, String command, String user, long delta) Called when the metric command is changed by "delta" units at time "time" via user "user"snapshot(long time) Take a snapshot of current top users in the past period.
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG -
metricMap
public ConcurrentHashMap<String,org.apache.hadoop.hdfs.server.namenode.top.window.RollingWindowManager.RollingWindowMap> metricMapA mapping from each reported metric to itsRollingWindowManager.RollingWindowMapthat maintains the set ofRollingWindows 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
Called when the metric command is changed by "delta" units at time "time" via user "user"- Parameters:
time- the time of the eventcommand- the metric that is updated, e.g., the operation nameuser- the user that updated the metricdelta- the amount of change in the metric, e.g., +1
-
snapshot
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.
-