1u0 commented on a change in pull request #9870: [FLINK-14350][metrics]
Introduce dedicated MetricScope
URL: https://github.com/apache/flink/pull/9870#discussion_r335760896
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/AbstractMetricGroup.java
##########
@@ -100,14 +92,24 @@
/** Flag indicating whether this group has been closed. */
private volatile boolean closed;
+ private final InternalMetricScope scope;
+
//
------------------------------------------------------------------------
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.scope = new InternalMetricScope(
+ registry,
+ scope,
+ this::getAllVariables
+ );
+ }
+
+ @Override
+ public InternalMetricScope getScope() {
+ return scope;
}
public Map<String, String> getAllVariables() {
Review comment:
This method is in fact `@Override`. My suggestion would be to rename it (and
make `private`), so that there is only one "code path" to get those variables
(via `scope.getAllVariables()`).
A new name could be `computeAllVariables()`.
Also, please see my top level comment.
----------------------------------------------------------------
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