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_r320254654
##########
File path:
flink-metrics/flink-metrics-prometheus/src/main/java/org/apache/flink/metrics/prometheus/PrometheusPushGatewayReporter.java
##########
@@ -83,15 +85,22 @@ public void open(MetricConfig config) {
for (String kv : kvs) {
int idx = kv.indexOf("=");
if (idx < 0) {
- log.warn("Invalid prometheusPushGateway
groupingKey {}, will be ignored", kv);
+ log.warn("Invalid prometheusPushGateway
groupingKey:{}, will be ignored", kv);
continue;
}
- groupingKey.put(kv.substring(0, idx),
kv.substring(idx + 1));
+
+ String labelKey = kv.substring(0, idx);
+ String labelValue = kv.substring(idx + 1);
+ if
(StringUtils.isNullOrWhitespaceOnly(labelKey) ||
StringUtils.isNullOrWhitespaceOnly(labelValue)) {
+ log.warn("Invalid groupingKey
{labelKey:{}, labelValue:{}} will be ignored", labelKey, labelValue);
Review comment:
Explicitly say that name/value must not be empty
----------------------------------------------------------------
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