bharathv commented on a change in pull request #3018:
URL: https://github.com/apache/hbase/pull/3018#discussion_r594512770
##########
File path:
hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/replication/regionserver/MetricsReplicationSourceSourceImpl.java
##########
@@ -126,6 +129,9 @@ public
MetricsReplicationSourceSourceImpl(MetricsReplicationSourceImpl rms, Stri
oldestWalAgeKey = this.keyPrefix + "oldestWalAge";
oldestWalAge = rms.getMetricsRegistry().getGauge(oldestWalAgeKey, 0L);
+
+ sourceInitializingKey = this.keyPrefix + "numInitializing";
Review comment:
nit: I think for a given source, numInitializing doesn't make much sense
since its either initializing or not? Is there a better way to do this? I think
it is helpful to know which is source is stuck but not sure how better to
represent this information.
##########
File path:
hbase-hadoop-compat/src/main/java/org/apache/hadoop/metrics2/lib/DynamicMetricsRegistry.java
##########
@@ -452,6 +450,41 @@ public MutableGaugeLong getGauge(String gaugeName, long
potentialStartingValue)
return (MutableGaugeLong) metric;
}
+ /**
+ * Get a MetricMutableGaugeInt from the storage. If it is not there
atomically put it.
+ *
+ * @param gaugeName name of the gauge to create or get.
+ * @param potentialStartingValue value of the new gauge if we have to create
it.
+ */
+ public MutableGaugeInt getGaugeInt(String gaugeName, int
potentialStartingValue) {
+ //Try and get the guage.
+ MutableMetric metric = metricsMap.get(gaugeName);
+
+ //If it's not there then try and put a new one in the storage.
+ if (metric == null) {
+
+ //Create the potential new gauge.
+ MutableGaugeInt newGauge = new MutableGaugeInt(new
MetricsInfoImpl(gaugeName, ""),
+ potentialStartingValue);
+
+ // Try and put the gauge in. This is atomic.
+ metric = metricsMap.putIfAbsent(gaugeName, newGauge);
+
+ //If the value we get back is null then the put was successful and we
will return that.
+ //otherwise gaugeLong should contain the thing that was in before the
put could be completed.
Review comment:
s/guageLong/guageInt -> copy-paste error.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]