Guosmilesmile commented on code in PR #3552:
URL: https://github.com/apache/fluss/pull/3552#discussion_r3504990486
##########
fluss-metrics/fluss-metrics-prometheus/src/main/java/org/apache/fluss/metrics/prometheus/PrometheusPushGatewayReporter.java:
##########
@@ -46,12 +52,18 @@ public PrometheusPushGatewayReporter(
String jobName,
Map<String, String> groupingKey,
final boolean deleteOnShutdown,
- Duration pushInterval) {
+ Duration pushInterval,
+ @Nullable String username,
+ @Nullable String password) {
this.pushGateway = new PushGateway(hostUrl);
this.jobName = jobName;
this.groupingKey = groupingKey;
this.deleteOnShutdown = deleteOnShutdown;
this.pushInterval = pushInterval;
+ if (username != null && !username.isEmpty()) {
+ this.pushGateway.setConnectionFactory(
+ basicAuthConnectionFactory(username, password == null ? ""
: password));
Review Comment:
We do not reuse Prometheus' built-in BasicAuthHttpConnectionFactory because
it relies on javax.xml.bind.DatatypeConverter for Base64 encoding, which has
been removed from the JDK since Java 9 (JEP 320). Using java.util.Base64 keeps
this reporter compatible with JDK 8+.
This issue has been resolved at the underlying level in higher versions of
the Prometheus dependency, but the current 0.8 version does not include the
fix. Upgrading the version rashly may cause problems, so we resolve it here
with our own implementation.
--
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]