ololo3000 commented on a change in pull request #8937:
URL: https://github.com/apache/ignite/pull/8937#discussion_r604714424



##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/MetricRegistry.java
##########
@@ -115,12 +116,17 @@ public void reset() {
     }
 
     /**
-     * Register existing metrics in this group with the specified name.
+     * Register existing metrics in this group with the specified name. Note 
that the name of the metric must
+     * start with the name of the current registry it is registered into.
      *
      * @param metric Metric.
      */
     public void register(Metric metric) {
-        addMetric(metric.name(), metric);
+        String mregPrefix = regName + SEPARATOR;
+
+        assert metric.name().startsWith(mregPrefix);
+
+        addMetric(metric.name().substring(mregPrefix.length()), metric);

Review comment:
       To make MetricRegistry#findMetric usage consistent.
   
   If we keep previous approach intact, metrics registered through 
MetricRegistry#register are found only by full metric name but this is not the 
case for metrics registered with other approaches - they are found by name 
without registry prefix .




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


Reply via email to