Github user zentol commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2300#discussion_r75119021
  
    --- Diff: 
flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/AbstractMetricGroup.java
 ---
    @@ -83,9 +88,25 @@
     
        // 
------------------------------------------------------------------------
     
    -   public AbstractMetricGroup(MetricRegistry registry, String[] scope) {
    +   public AbstractMetricGroup(MetricRegistry registry, String[] scope, A 
parent) {
                this.registry = checkNotNull(registry);
                this.scopeComponents = checkNotNull(scope);
    +           this.parent = parent;
    +   }
    +
    +   public Map<String, String> getAllVariables() {
    +           if (variables == null) { // avoid synchronization for common 
case
    --- End diff --
    
    well this is interesting. Making the access more expensive could pose 
problems for the JMX exposure I linked, as it calls `getAllVariables()` for 
every metric. Would the locking issue still apply if we initialize the maps 
eagerly, but insert the values lazily? Instead of a null-check we would use 
`Map#isEmpty()`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to