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

 ##########
 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:
   Doesn't this constitutes a programming error and should cause the program to 
fail. E.g. via `checkArgument`.

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


With regards,
Apache Git Services

Reply via email to