weicheng-07 commented on code in PR #29151:
URL: https://github.com/apache/flink/pull/29151#discussion_r3987861117
##########
flink-metrics/flink-metrics-prometheus/src/main/java/org/apache/flink/metrics/prometheus/PrometheusPushGatewayReporter.java:
##########
@@ -96,4 +100,26 @@ public void close() {
}
super.close();
}
+
Review Comment:
Updated in f99b0448.
1. `HttpServer` is a documented API exported by the JDK's [`jdk.httpserver`
module](https://docs.oracle.com/en/java/javase/17/docs/api/jdk.httpserver/module-summary.html),
despite the `com.sun` package name. It is JDK-specific and is also used by
other Flink tests, so I retained it here.
2. Incomplete credentials already trigger a [warning in the reporter
factory](https://github.com/apache/flink/blob/6f0650cc1862305d7fcd564dd65ac63d4b7f0423/flink-metrics/flink-metrics-prometheus/src/main/java/org/apache/flink/metrics/prometheus/PrometheusPushGatewayReporterFactory.java#L78-L83).
Existing [username-only and password-only
tests](https://github.com/apache/flink/blob/6f0650cc1862305d7fcd564dd65ac63d4b7f0423/flink-metrics/flink-metrics-prometheus/src/test/java/org/apache/flink/metrics/prometheus/PrometheusPushGatewayReporterTest.java#L93-L127)
assert those warnings. The new test uses that factory and preserves
unauthenticated mode when neither credential is set.
3. Renamed the private helper to `JdkBasicAuthHttpConnectionFactory` to
distinguish it from the upstream class.
4. Replaced the classloader identity assertion with a check that the
reporter's actual defining classloader cannot load
`javax.xml.bind.DatatypeConverter`, expecting `ClassNotFoundException`. This
protects the regression test against JAXB on the test classpath masking its
absence from the reporter's runtime. The HTTP Authorization assertions for PUT
and DELETE remain.
The Prometheus module `clean verify` passed locally: 34 tests, including all
six authentication cases. The updated regression test still reproduces the
three JAXB initialization errors with the unfixed reporter; the three control
cases pass.
--
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]