tillrohrmann commented on a change in pull request #10466: 
[FLINK-15110][metrics] Support variable exclusion
URL: https://github.com/apache/flink/pull/10466#discussion_r355956679
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/AbstractMetricGroup.java
 ##########
 @@ -102,27 +104,53 @@
 
        // 
------------------------------------------------------------------------
 
+       @SuppressWarnings("unchecked")
        public AbstractMetricGroup(MetricRegistry registry, String[] scope, A 
parent) {
                this.registry = checkNotNull(registry);
                this.scopeComponents = checkNotNull(scope);
                this.parent = parent;
                this.scopeStrings = new String[registry.getNumberReporters()];
                this.logicalScopeStrings = new 
String[registry.getNumberReporters()];
+               this.variables = new Map[registry.getNumberReporters() + 1];
        }
 
        @Override
        public Map<String, String> getAllVariables() {
-               if (variables == null) {
+               return internalGetAllVariables(0, Collections.emptySet());
+       }
+
+       public Map<String, String> getAllVariables(int reporterIndex, 
Set<String> excludedVariables) {
+               // offset cache location to account for general cache at 
position 0
+               reporterIndex += 1;
+               if (reporterIndex < 0 || reporterIndex >= 
logicalScopeStrings.length) {
+                       reporterIndex = 0;
+               }
 
 Review comment:
   hmm, I'm not convinced by this argument tbh. I think that way it is super 
hard to debug programming errors.

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