1u0 commented on a change in pull request #9870: [FLINK-14350][metrics] 
Introduce dedicated MetricScope
URL: https://github.com/apache/flink/pull/9870#discussion_r335758530
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/FrontMetricGroup.java
 ##########
 @@ -30,28 +34,54 @@
  */
 public class FrontMetricGroup<P extends AbstractMetricGroup<?>> extends 
ProxyMetricGroup<P> {
 
-       protected int reporterIndex;
+       private final ReporterIndexInjectingMetricScope scope;
 
        public FrontMetricGroup(int reporterIndex, P reference) {
                super(reference);
-               this.reporterIndex = reporterIndex;
+               this.scope = new 
ReporterIndexInjectingMetricScope(reporterIndex, 
this.parentMetricGroup.getScope());
        }
 
        @Override
        public String getMetricIdentifier(String metricName) {
-               return parentMetricGroup.getMetricIdentifier(metricName, null, 
this.reporterIndex);
+               return scope.getMetricIdentifier(metricName);
        }
 
        @Override
        public String getMetricIdentifier(String metricName, CharacterFilter 
filter) {
-               return parentMetricGroup.getMetricIdentifier(metricName, 
filter, this.reporterIndex);
+               return scope.getMetricIdentifier(metricName, filter);
        }
 
 Review comment:
   Should this class have override for `getScope()` method?
   Otherwise, a call `frontMetricGroup.getScope().getMetricIdentifier("some 
metric")` may not end up using `reporterIndex`.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to