From 869243e738e2037ab1943a5e466f1222f41e8c00 Mon Sep 17 00:00:00 2001 From: Rushabh Shah Date: Tue, 8 Feb 2022 21:08:34 -0500 Subject: [PATCH] HBASE-26702 Make ageOfLastShip, ageOfLastApplied extend TimeHistogram instead of plain histogram. (#4098) Signed-off-by: Duo Zhang --- .../regionserver/MetricsReplicationGlobalSourceSourceImpl.java | 3 ++- .../regionserver/MetricsReplicationSinkSourceImpl.java | 2 +- .../regionserver/MetricsReplicationSourceSourceImpl.java | 2 +- .../regionserver/MetricsReplicationTableSourceImpl.java | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationGlobalSourceSourceImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationGlobalSourceSourceImpl.java index 8a6553f882f..5eb5deb03f6 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationGlobalSourceSourceImpl.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationGlobalSourceSourceImpl.java @@ -61,7 +61,8 @@ public class MetricsReplicationGlobalSourceSourceImpl public MetricsReplicationGlobalSourceSourceImpl(MetricsReplicationSourceImpl rms) { this.rms = rms; - ageOfLastShippedOpHist = rms.getMetricsRegistry().getHistogram(SOURCE_AGE_OF_LAST_SHIPPED_OP); + ageOfLastShippedOpHist = + rms.getMetricsRegistry().newTimeHistogram(SOURCE_AGE_OF_LAST_SHIPPED_OP); sizeOfLogQueueGauge = rms.getMetricsRegistry().getGauge(SOURCE_SIZE_OF_LOG_QUEUE, 0L); diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationSinkSourceImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationSinkSourceImpl.java index 18addb01e32..ce45af5ccec 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationSinkSourceImpl.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationSinkSourceImpl.java @@ -31,7 +31,7 @@ public class MetricsReplicationSinkSourceImpl implements MetricsReplicationSinkS private final MutableFastCounter hfilesCounter; public MetricsReplicationSinkSourceImpl(MetricsReplicationSourceImpl rms) { - ageHist = rms.getMetricsRegistry().getHistogram(SINK_AGE_OF_LAST_APPLIED_OP); + ageHist = rms.getMetricsRegistry().newTimeHistogram(SINK_AGE_OF_LAST_APPLIED_OP); batchesCounter = rms.getMetricsRegistry().getCounter(SINK_APPLIED_BATCHES, 0L); opsCounter = rms.getMetricsRegistry().getCounter(SINK_APPLIED_OPS, 0L); hfilesCounter = rms.getMetricsRegistry().getCounter(SINK_APPLIED_HFILES, 0L); diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationSourceSourceImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationSourceSourceImpl.java index 016135422a0..28499120119 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationSourceSourceImpl.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationSourceSourceImpl.java @@ -83,7 +83,7 @@ public class MetricsReplicationSourceSourceImpl implements MetricsReplicationSou this.keyPrefix = "source." + this.id + "."; ageOfLastShippedOpKey = this.keyPrefix + "ageOfLastShippedOp"; - ageOfLastShippedOpHist = rms.getMetricsRegistry().getHistogram(ageOfLastShippedOpKey); + ageOfLastShippedOpHist = rms.getMetricsRegistry().newTimeHistogram(ageOfLastShippedOpKey); sizeOfLogQueueKey = this.keyPrefix + "sizeOfLogQueue"; sizeOfLogQueueGauge = rms.getMetricsRegistry().getGauge(sizeOfLogQueueKey, 0L); diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationTableSourceImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationTableSourceImpl.java index 7120a73d49a..9ca0cd1a94e 100644 --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationTableSourceImpl.java +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationTableSourceImpl.java @@ -45,7 +45,7 @@ public class MetricsReplicationTableSourceImpl implements MetricsReplicationTabl this.keyPrefix = "source." + this.tableName + "."; ageOfLastShippedOpKey = this.keyPrefix + "ageOfLastShippedOp"; - ageOfLastShippedOpHist = rms.getMetricsRegistry().getHistogram(ageOfLastShippedOpKey); + ageOfLastShippedOpHist = rms.getMetricsRegistry().newTimeHistogram(ageOfLastShippedOpKey); shippedBytesKey = this.keyPrefix + "shippedBytes"; shippedBytesCounter = rms.getMetricsRegistry().getCounter(shippedBytesKey, 0L);