org.apache.hadoop.metrics2.lib
Class MetricMutableStat

java.lang.Object
  extended by org.apache.hadoop.metrics2.lib.MetricMutable
      extended by org.apache.hadoop.metrics2.lib.MetricMutableStat

public class MetricMutableStat
extends MetricMutable

A mutable metric with stats Useful for keep throughput/latency stats. e.g., new MetricMutableStat("rpcName", "rpcName stats", "ops", "time");


Field Summary
 
Fields inherited from class org.apache.hadoop.metrics2.lib.MetricMutable
description, name
 
Constructor Summary
MetricMutableStat(String name, String description, String sampleName, String valueName)
          Construct a snapshot stat metric with extended stat off by default
MetricMutableStat(String name, String description, String sampleName, String valueName, boolean extended)
          Construct a sample statistics metric
 
Method Summary
 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
 void resetMinMax()
          Reset the all time min max of the metric
 void snapshot(MetricsRecordBuilder builder, boolean all)
          Get a snapshot/snapshot of the metric
 
Methods inherited from class org.apache.hadoop.metrics2.lib.MetricMutable
changed, clearChanged, setChanged, snapshot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetricMutableStat

public MetricMutableStat(String name,
                         String description,
                         String sampleName,
                         String valueName,
                         boolean extended)
Construct a sample statistics metric

Parameters:
name - of the metric
description - of the metric
sampleName - of the metric (e.g. "ops")
valueName - of the metric (e.g. "time", "latency")
extended - create extended stats (stdev, min/max etc.) by default.

MetricMutableStat

public MetricMutableStat(String name,
                         String description,
                         String sampleName,
                         String valueName)
Construct a snapshot stat metric with extended stat off by default

Parameters:
name - of the metric
description - of the metric
sampleName - of the metric (e.g. "ops")
valueName - of the metric (e.g. "time", "latency")
Method Detail

add

public void add(long numSamples,
                long sum)
Add a number of samples and their sum to the running stat

Parameters:
numSamples - number of samples
sum - of the samples

add

public void add(long value)
Add a snapshot to the metric

Parameters:
value - of the metric

snapshot

public void snapshot(MetricsRecordBuilder builder,
                     boolean all)
Description copied from class: MetricMutable
Get a snapshot/snapshot of the metric

Specified by:
snapshot in class MetricMutable
Parameters:
builder - the metrics record builder
all - if true, snapshot unchanged metrics as well

resetMinMax

public void resetMinMax()
Reset the all time min max of the metric



Copyright © 2009 The Apache Software Foundation