@InterfaceAudience.Public @InterfaceStability.Evolving public class MutableStat extends MutableMetric
Constructor and Description |
---|
MutableStat(String name,
String description,
String sampleName,
String valueName)
Construct a snapshot stat metric with extended stat off by default
|
MutableStat(String name,
String description,
String sampleName,
String valueName,
boolean extended)
Construct a sample statistics metric
|
Modifier and Type | Method and Description |
---|---|
void |
add(long value)
Add a snapshot to the metric
|
void |
add(long numSamples,
long sum)
Add a number of samples and their sum to the running stat
Note that although use of this method will preserve accurate mean values,
large values for numSamples may result in inaccurate variance values due
to the use of a single step of the Welford method for variance calculation.
|
org.apache.hadoop.metrics2.util.SampleStat |
lastStat()
Return a SampleStat object that supports
calls like StdDev and Mean.
|
void |
resetMinMax()
Reset the all time min max of the metric
|
void |
setExtended(boolean extended)
Set whether to display the extended stats (stdev, min/max etc.) or not
|
void |
snapshot(MetricsRecordBuilder builder,
boolean all)
Get a snapshot of the metric
|
String |
toString() |
changed, clearChanged, setChanged, snapshot
public MutableStat(String name, String description, String sampleName, String valueName, boolean extended)
name
- of the metricdescription
- of the metricsampleName
- of the metric (e.g. "Ops")valueName
- of the metric (e.g. "Time", "Latency")extended
- create extended stats (stdev, min/max etc.) by default.public MutableStat(String name, String description, String sampleName, String valueName)
name
- of the metricdescription
- of the metricsampleName
- of the metric (e.g. "Ops")valueName
- of the metric (e.g. "Time", "Latency")public void setExtended(boolean extended)
extended
- enable/disable displaying extended statspublic void add(long numSamples, long sum)
numSamples
- number of samplessum
- of the samplespublic void add(long value)
value
- of the metricpublic void snapshot(MetricsRecordBuilder builder, boolean all)
MutableMetric
snapshot
in class MutableMetric
builder
- the metrics record builderall
- if true, snapshot unchanged metrics as wellpublic org.apache.hadoop.metrics2.util.SampleStat lastStat()
public void resetMinMax()
Copyright © 2017 Apache Software Foundation. All Rights Reserved.