-
Notifications
You must be signed in to change notification settings - Fork 825
Added Base64 implementation to simpleclient_common to remove jax-api … #698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@fstab please review. |
fstab
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is looking good, however, I would like to move it out of the simpleclient_common module. That module is used by a lot of other projects and I would like to keep it's scope as small as possible.
As far as I can see the only usage in production code is in simpleclient_pushgateway. Could you move it there?
The other usage is in a test in simpleclient_httpserver, but I guess it does not harm to keep javax.xml.bind as a test dependency in that module.
|
@fstab Thanks for the review! My thoughts around putting it into
By putting into I'm concerned that if/when we add HTTP authentication to Thoughts? |
|
Instead of maintaining an implementation of Base64 encoding, I wonder if it would be better to use |
|
@wilkinsona I thought of that approach, but not sure it would solve the issue. The goal is not to have a dependency on JAX APIs whatsoever. For Java 8+, it would be easy, we could use the Java version and use For Java 6/7, there is nothing to fall back to unless we include a Am I missing something? |
|
|
|
Good points. I'll see what I can do when I get some time. |
|
@wilkinsona I have implemented the code as you described. Works as expected. @fstab I still feel this should be in |
fstab
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the discussion! I thought about this, and I am hesitant to add a dependency or a Base64 implementation to simpleclient_common.
simpleclient_common is used way beyond the client_java ecosystem: It's in Micrometer, which ships with Spring Boot, Quarkus, and others. And it's also part of the Java implementation of the upcoming OpenTelemetry metrics standard.
That means lots of applications out there have simpleclient_common as an indirect dependency, even if they aren't aware and don't use the client_java library. We should be very conservative with what we add to that module. What if somebody implements an incompatible jaxb-api version 3 in the future?
By putting into
simpleclient_pushgatewaywe essential push the issue to downstream projects to solve theBase64issue to maintain Java 6/7 compatibility when usingsimpleclient_httpserver.
This is correct, but as 3rd party projects using client_java are unlikely to support Java 6 they can just use java.util.Base64 and won't have an issue.
The main project where this is relevant is the jmx_exporter, but given how widely simpleclient_common is used I'd rather push the issue downstream to jmx_exporter and risk a bit of copy-and-paste between simpleclient_pushgateway and the jmx_exporter than putting a Base64 implementation in simpleclient_common.
|
@fstab @wilkinsona changes made. please review. |
fstab
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! I added two more nitpicks, apart from that it's ready to be rebased, squashed and merged 🎉.
simpleclient_pushgateway/src/main/java/io/prometheus/client/exporter/Base64.java
Outdated
Show resolved
Hide resolved
b62d79f to
c60b7c1
Compare
…4 or javax.xml.bind.DatatypeConverter depending on the running JVM version. Signed-off-by: Doug Hoard <doug.hoard@gmail.com>
fstab
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! I can confirm that it works with Zulu's Java 6 as well as OpenJDK 11 and 17.
Added Base64 implementation to simpleclient_common to remove jax-api dependency. Abstracted Base64 implementation to be more Java 8 like/make it easier to replace if required.