You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/09/30 09:30:10 UTC

[GitHub] [ozone] adoroszlai commented on a diff in pull request #3772: HDDS-7250. Add HttpServer metrics

adoroszlai commented on code in PR #3772:
URL: https://github.com/apache/ozone/pull/3772#discussion_r984401332


##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/http/HttpServer2Metrics.java:
##########
@@ -91,4 +90,10 @@ public void getMetrics(MetricsCollector collector, boolean all) {
         .addGauge(HttpServer2MetricsInfo.HttpServerThreadQueueWaitingTaskCount,
             threadPool.getQueueSize());
   }
+
+  public void unRegister() {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
+    ms.unregisterSource(NAME);

Review Comment:
   If we want to allow multiple `HttpServer2` objects to share the same `HttpServer2Metrics` instance, then it should be reference-counted, and unregistration should happen only when the last reference is removed.



##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/http/HttpServer2Metrics.java:
##########
@@ -91,4 +90,10 @@ public void getMetrics(MetricsCollector collector, boolean all) {
         .addGauge(HttpServer2MetricsInfo.HttpServerThreadQueueWaitingTaskCount,
             threadPool.getQueueSize());
   }
+
+  public void unRegister() {

Review Comment:
   Should be `synchronized` to ensure consistent synchronization when accessing `instance`.  (I guess findbugs also complains about this.)



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org