codope commented on code in PR #7933:
URL: https://github.com/apache/hudi/pull/7933#discussion_r1108740795
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -329,9 +330,18 @@ private HoodieWriteConfig createMetadataWriteConfig(
.toJmxHost(writeConfig.getJmxHost())
.build());
break;
+ case PROMETHEUS_PUSHGATEWAY:
+ HoodieMetricsPrometheusConfig prometheusConfig =
HoodieMetricsPrometheusConfig.newBuilder()
+ .withPushgatewayJobname(writeConfig.getPushGatewayJobName())
+
.withPushgatewayRandomJobnameSuffix(writeConfig.getPushGatewayRandomJobNameSuffix())
+ .withPushgatewayLabels(writeConfig.getPushGatewayLabels())
+
.withPushgatewayReportPeriodInSeconds(String.valueOf(writeConfig.getPushGatewayReportPeriodSeconds()))
+ .withPushgatewayHostName(writeConfig.getPushGatewayHost())
+
.withPushgatewayPortNum(writeConfig.getPushGatewayPort()).build();
+ builder.withProps(prometheusConfig.getProps());
Review Comment:
can use `builder.withProperties`
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metrics/prometheus/PushGatewayMetricsReporter.java:
##########
@@ -77,4 +83,11 @@ private String getJobName() {
}
return configuredJobName;
}
+
+ private static Map<String, String> parseLabels(String labels) {
+ return Pattern.compile("\\s*,\\s*")
+ .splitAsStream(labels.trim())
+ .map(s -> s.split(":", 2))
Review Comment:
What if labels are not in the format key:value? Should we add a validation
or handle this scenario?
--
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]