org.apache.hadoop.metrics2.lib
Class MutableQuantiles

java.lang.Object
  extended by org.apache.hadoop.metrics2.lib.MutableMetric
      extended by org.apache.hadoop.metrics2.lib.MutableQuantiles

@InterfaceAudience.Public
@InterfaceStability.Evolving
public class MutableQuantiles
extends MutableMetric

Watches a stream of long values, maintaining online estimates of specific quantiles with provably low error bounds. This is particularly useful for accurate high-percentile (e.g. 95th, 99th) latency metrics.


Field Summary
protected  Map<org.apache.hadoop.metrics2.util.Quantile,Long> previousSnapshot
           
static org.apache.hadoop.metrics2.util.Quantile[] quantiles
           
 
Constructor Summary
MutableQuantiles(String name, String description, String sampleName, String valueName, int interval)
          Instantiates a new MutableQuantiles for a metric that rolls itself over on the specified time interval.
 
Method Summary
 void add(long value)
           
 int getInterval()
           
 void snapshot(MetricsRecordBuilder builder, boolean all)
          Get a snapshot of the metric
 
Methods inherited from class org.apache.hadoop.metrics2.lib.MutableMetric
changed, clearChanged, setChanged, snapshot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

quantiles

public static final org.apache.hadoop.metrics2.util.Quantile[] quantiles

previousSnapshot

protected Map<org.apache.hadoop.metrics2.util.Quantile,Long> previousSnapshot
Constructor Detail

MutableQuantiles

public MutableQuantiles(String name,
                        String description,
                        String sampleName,
                        String valueName,
                        int interval)
Instantiates a new MutableQuantiles for a metric that rolls itself over on the specified time interval.

Parameters:
name - of the metric
description - long-form textual description of the metric
sampleName - type of items in the stream (e.g., "Ops")
valueName - type of the values
interval - rollover interval (in seconds) of the estimator
Method Detail

snapshot

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

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

add

public void add(long value)

getInterval

public int getInterval()


Copyright © 2014 Apache Software Foundation. All Rights Reserved.