[ 
https://issues.apache.org/jira/browse/FLINK-7692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16276905#comment-16276905
 ] 

ASF GitHub Bot commented on FLINK-7692:
---------------------------------------

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

    https://github.com/apache/flink/pull/5115#discussion_r154672680
  
    --- Diff: 
flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/AbstractMetricGroup.java
 ---
    @@ -409,6 +404,22 @@ public MetricGroup addGroup(String name) {
                return addGroup(name, false);
        }
     
    +   @Override
    +   public MetricGroup addGroup(String key, String value) {
    --- End diff --
    
    I remove the first if-else statement by overriding the 
`GenericKeyMetricGroup#addGroup(String key, String value)`, but remain the 
second one.
    Because when the first group is already created as `GenericMetricGroup` 
then the second group will be created as `GenericKeyMetricGroup`.
    It seems that there is no way to be cleaner, unless we change the `keyed` 
be a enum type and move the decision to the private `addGroup` method.


> Support user-defined variables in Metrics
> -----------------------------------------
>
>                 Key: FLINK-7692
>                 URL: https://issues.apache.org/jira/browse/FLINK-7692
>             Project: Flink
>          Issue Type: Improvement
>          Components: Metrics
>    Affects Versions: 1.4.0
>            Reporter: Chesnay Schepler
>            Assignee: Wei-Che Wei
>            Priority: Minor
>             Fix For: 1.5.0
>
>
> Reporters that identify metrics with a set of key-value pairs are currently 
> limited to the variables defined by Flink, like the taskmanager ID, with 
> users not being able to supply their own.
> This is inconsistent with reporters that use metric identifiers that freely 
> include user-defined groups constructted via {{MetricGroup#addGroup(String 
> name)}}.
> I propose adding a new method {{MetricGroup#addGroup(String key, String 
> name)}} that adds a new key-value pair to the {{variables}} map in it's 
> constructor. When constructing the metric identifier the key should be 
> included as well, resulting in the same result as when constructing the 
> metric groups tree via {{group.addGroup(key).addGroup(value)}}.
> For this a new {{KeyedGenericMetricGroup}} should be created that resembles 
> the unkeyed version, with slight modifications to the constructor and 
> {{getScopeComponents}} method.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to