From 2ce27951b025d3380a987fbf3c28dcd340c42e59 Mon Sep 17 00:00:00 2001 From: Sanjeev Lakshmanan Date: Thu, 19 Nov 2015 16:02:08 -0800 Subject: [PATCH] HBASE-14862 Add support for reporting p90 for histogram metrics Signed-off-by: Andrew Purtell --- .../main/java/org/apache/hadoop/metrics2/MetricHistogram.java | 1 + .../org/apache/hadoop/metrics2/lib/DynamicMetricsRegistry.java | 1 + .../java/org/apache/hadoop/metrics2/lib/MutableHistogram.java | 2 ++ 3 files changed, 4 insertions(+) diff --git a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/metrics2/MetricHistogram.java b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/metrics2/MetricHistogram.java index 93ff5ba5af7..b759efb2e69 100644 --- a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/metrics2/MetricHistogram.java +++ b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/metrics2/MetricHistogram.java @@ -31,6 +31,7 @@ public interface MetricHistogram { String MEAN_METRIC_NAME = "_mean"; String MEDIAN_METRIC_NAME = "_median"; String SEVENTY_FIFTH_PERCENTILE_METRIC_NAME = "_75th_percentile"; + String NINETIETH_PERCENTILE_METRIC_NAME = "_90th_percentile"; String NINETY_FIFTH_PERCENTILE_METRIC_NAME = "_95th_percentile"; String NINETY_NINETH_PERCENTILE_METRIC_NAME = "_99th_percentile"; diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/DynamicMetricsRegistry.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/DynamicMetricsRegistry.java index ee2745d3775..d4912362c24 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/DynamicMetricsRegistry.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/DynamicMetricsRegistry.java @@ -60,6 +60,7 @@ public class DynamicMetricsRegistry { "_max", "_median", "_75th_percentile", + "_90th_percentile", "_95th_percentile", "_99th_percentile"}; diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableHistogram.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableHistogram.java index 381dbbb3364..6d8554293a8 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableHistogram.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MutableHistogram.java @@ -126,6 +126,8 @@ public class MutableHistogram extends MutableMetric implements MetricHistogram { metricsRecordBuilder.addGauge(Interns.info(name + MEDIAN_METRIC_NAME, desc), s.getMedian()); metricsRecordBuilder.addGauge(Interns.info(name + SEVENTY_FIFTH_PERCENTILE_METRIC_NAME, desc), s.get75thPercentile()); + metricsRecordBuilder.addGauge(Interns.info(name + NINETIETH_PERCENTILE_METRIC_NAME, desc), + s.getValue(0.90)); metricsRecordBuilder.addGauge(Interns.info(name + NINETY_FIFTH_PERCENTILE_METRIC_NAME, desc), s.get95thPercentile()); metricsRecordBuilder.addGauge(Interns.info(name + NINETY_NINETH_PERCENTILE_METRIC_NAME, desc),