Package org.apache.hadoop.metrics2.lib
Class MutableRatesWithAggregation
java.lang.Object
org.apache.hadoop.metrics2.lib.MutableMetric
org.apache.hadoop.metrics2.lib.MutableRatesWithAggregation
Helper class to manage a group of mutable rate metrics.
Each thread will maintain a local rate count, and upon snapshot,
these values will be aggregated into a global rate. This class
should only be used for long running threads, as any metrics
produced between the last snapshot and the death of a thread
will be lost. This allows for significantly higher concurrency
than
MutableRates. See HADOOP-24420.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a rate sample for a rate metric.voidInitialize the registry with all the methods in a protocol so they all show up in the first snapshot.voidvoidInitialize the registry with all rate names passed in.voidsnapshot(MetricsRecordBuilder rb, boolean all) Get a snapshot of the metricMethods inherited from class org.apache.hadoop.metrics2.lib.MutableMetric
changed, clearChanged, setChanged, snapshot
-
Constructor Details
-
MutableRatesWithAggregation
public MutableRatesWithAggregation()
-
-
Method Details
-
init
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
-
init
Initialize the registry with all rate names passed in. This is an alternative to the above init function since this metric can be used more than just for rpc name.- Parameters:
names- the array of all rate names
-
add
Add a rate sample for a rate metric.- Parameters:
name- of the rate metricelapsed- time
-
snapshot
Description copied from class:MutableMetricGet a snapshot of the metric- Specified by:
snapshotin classMutableMetric- Parameters:
rb- the metrics record builderall- if true, snapshot unchanged metrics as well
-
init
-