zentol commented on a change in pull request #9517: [FLINK-13779][metrics] PrometheusPushGatewayReporter support push metrics with groupingKey URL: https://github.com/apache/flink/pull/9517#discussion_r317291152
########## File path: flink-metrics/flink-metrics-prometheus/src/main/java/org/apache/flink/metrics/prometheus/PrometheusPushGatewayReporter.java ########## @@ -67,25 +73,44 @@ public void open(MetricConfig config) { } pushGateway = new PushGateway(host + ':' + port); - log.info("Configured PrometheusPushGatewayReporter with {host:{}, port:{}, jobName: {}, randomJobNameSuffix:{}, deleteOnShutdown:{}}", host, port, jobName, randomSuffix, deleteOnShutdown); + log.info("Configured PrometheusPushGatewayReporter with {host:{}, port:{}, jobName:{}, randomJobNameSuffix:{}, deleteOnShutdown:{}, groupingKey:{}}", + host, port, jobName, randomSuffix, deleteOnShutdown, groupingKey); + } + + @VisibleForTesting + static Map<String, String> parserGroupingKey(final String groupingKeyConfig) { + if (!groupingKeyConfig.isEmpty()) { + Map<String, String> groupingKey = new HashMap<>(); + String[] kvs = groupingKeyConfig.split(","); + for (String kv : kvs) { + int idx = kv.indexOf("="); + if (idx < 0) { + continue; Review comment: this case implies an invalid configuration and should be logged as a warning ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services