1u0 commented on a change in pull request #9870: [FLINK-14350][metrics] Introduce dedicated MetricScope URL: https://github.com/apache/flink/pull/9870#discussion_r333877706
########## 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); } public String getLogicalScope(CharacterFilter filter) { return parentMetricGroup.getLogicalScope(filter); } public String getLogicalScope(CharacterFilter filter, char delimiter) { - return parentMetricGroup.getLogicalScope(filter, delimiter, this.reporterIndex); + return parentMetricGroup.getLogicalScope(filter, delimiter); Review comment: **NB:** If I understand correctly, without `reporterIndex`, you are making this call non cached. This would impact InfluxDB, Jmx and Prometheus reporters. ---------------------------------------------------------------- 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