Package org.apache.hadoop.metrics2.lib
Class MutableQuantiles
java.lang.Object
org.apache.hadoop.metrics2.lib.MutableMetric
org.apache.hadoop.metrics2.lib.MutableQuantiles
- Direct Known Subclasses:
MutableInverseQuantiles
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
FieldsModifier and TypeFieldDescriptionstatic final org.apache.hadoop.metrics2.util.Quantile[] -
Constructor Summary
ConstructorsConstructorDescriptionMutableQuantiles(String name, String description, String sampleName, String valueName, int interval) Instantiates a newMutableQuantilesfor a metric that rolls itself over on the specified time interval. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(long value) voidaddQuantileInfo(int i, MetricsInfo info) Add entry to quantileInfos array.org.apache.hadoop.metrics2.util.QuantileEstimatorGet the quantile estimator.intGet the rollover interval (in seconds) of the estimator.org.apache.hadoop.metrics2.util.Quantile[]Returns the array of Quantiles declared in MutableQuantiles.voidsetEstimator(org.apache.hadoop.metrics2.util.QuantileEstimator quantileEstimator) voidsetInterval(int pIntervalSecs) Set the rollover interval (in seconds) of the estimator.voidsetNumInfo(MetricsInfo pNumInfo) Set info about the metrics.voidsetQuantileInfos(int length) Initialize quantileInfos array.voidsnapshot(MetricsRecordBuilder builder, boolean all) Get a snapshot of the metricvoidstop()Methods inherited from class org.apache.hadoop.metrics2.lib.MutableMetric
changed, clearChanged, setChanged, snapshot
-
Field Details
-
QUANTILES
@VisibleForTesting public static final org.apache.hadoop.metrics2.util.Quantile[] QUANTILES -
previousSnapshot
-
-
Constructor Details
-
MutableQuantiles
public MutableQuantiles(String name, String description, String sampleName, String valueName, int interval) Instantiates a newMutableQuantilesfor a metric that rolls itself over on the specified time interval.- Parameters:
name- of the metricdescription- long-form textual description of the metricsampleName- type of items in the stream (e.g., "Ops")valueName- type of the valuesinterval- rollover interval (in seconds) of the estimator
-
MutableQuantiles
public MutableQuantiles()
-
-
Method Details
-
snapshot
Description copied from class:MutableMetricGet a snapshot of the metric- Specified by:
snapshotin classMutableMetric- Parameters:
builder- the metrics record builderall- if true, snapshot unchanged metrics as well
-
add
public void add(long value) -
getQuantiles
public org.apache.hadoop.metrics2.util.Quantile[] getQuantiles()Returns the array of Quantiles declared in MutableQuantiles.- Returns:
- array of Quantiles
-
setNumInfo
Set info about the metrics.- Parameters:
pNumInfo- info about the metrics.
-
setQuantileInfos
public void setQuantileInfos(int length) Initialize quantileInfos array.- Parameters:
length- of the quantileInfos array.
-
addQuantileInfo
Add entry to quantileInfos array.- Parameters:
i- array index.info- info to be added to quantileInfos array.
-
setInterval
public void setInterval(int pIntervalSecs) Set the rollover interval (in seconds) of the estimator.- Parameters:
pIntervalSecs- of the estimator.
-
getInterval
public int getInterval()Get the rollover interval (in seconds) of the estimator.- Returns:
- intervalSecs of the estimator.
-
stop
public void stop() -
getEstimator
@VisibleForTesting public org.apache.hadoop.metrics2.util.QuantileEstimator getEstimator()Get the quantile estimator.- Returns:
- the quantile estimator
-
setEstimator
public void setEstimator(org.apache.hadoop.metrics2.util.QuantileEstimator quantileEstimator)
-