zentol commented on a change in pull request #17007:
URL: https://github.com/apache/flink/pull/17007#discussion_r699155868
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/metrics/ReporterSetup.java
##########
@@ -284,12 +304,19 @@ private static ReporterSetup createReporterSetup(
try {
Optional<MetricReporter> metricReporterOptional =
loadReporter(reporterName, reporterConfig,
reporterFactories);
+
+ Map<String, String> additionalVariables =
reporterConfig.get(ADDITIONAL_VARIABLES);
Review comment:
There's one issue here:
Currently, the keys of all variables are (unfortunately) formatted like
`<job_id>`, but with the current documentation the brackets would be missing.
We can _either_:
a) allow users to configure "my_tag:my_value" and add the brackets ourselves
b) mandate that users must configure "<my_tag>:my_value"
Considering that the variable exclusion does not use brackets (and that we
want to get rid of these brackets eventually) we should go with a). So we'll
have to build another map and adjust the keys accordingly.
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/FrontMetricGroup.java
##########
@@ -72,8 +74,15 @@ public MetricGroup getWrappedMetricGroup() {
@Override
public Map<String, String> getAllVariables() {
- return parentMetricGroup.getAllVariables(
- this.settings.getReporterIndex(),
this.settings.getExcludedVariables());
+ Map<String, String> allVariables =
+ parentMetricGroup.getAllVariables(
+ this.settings.getReporterIndex(),
this.settings.getExcludedVariables());
+
+ if (this.settings.getAdditionalVariables().isEmpty()) {
+ return allVariables;
+ }
+
+ return new CompositeMap(allVariables,
this.settings.getAdditionalVariables());
Review comment:
I think that's fine, but we could also wrap it in
`Collections.unmodifiableMap()`, because we don't want any modifications _at
all_.
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/FrontMetricGroup.java
##########
@@ -72,8 +74,15 @@ public MetricGroup getWrappedMetricGroup() {
@Override
public Map<String, String> getAllVariables() {
- return parentMetricGroup.getAllVariables(
- this.settings.getReporterIndex(),
this.settings.getExcludedVariables());
+ Map<String, String> allVariables =
+ parentMetricGroup.getAllVariables(
+ this.settings.getReporterIndex(),
this.settings.getExcludedVariables());
+
+ if (this.settings.getAdditionalVariables().isEmpty()) {
+ return allVariables;
+ }
+
+ return new CompositeMap(allVariables,
this.settings.getAdditionalVariables());
Review comment:
Which admittedly is technically a separate change, but we are changing
the behavior anyway.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]