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