ZOOKEEPER-4741: Modernize PrometheusMetricsProvider with Jetty and ne… #2291
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…w client
In production environments under heavy load, the existing PrometheusMetricsProvider can introduce high latency. This is largely due to its use of the outdated
io.prometheus.client
(simpleclient 0.x) library and its basic, built-in HTTPServer, which has limitations in server configuration and threading.This commit modernizes the entire component to address these performance and maintainability issues by:
Upgrading to the
io.prometheus.metrics
(client_java 1.x) library. This aligns the provider with the current standard for Prometheus instrumentation in Java and ensures future compatibility.Replacing the legacy server and threading model with an embedded Jetty server. The previous implementation used a custom thread pool for a metrics processing task queue, which is now obsolete in the new client library. This has been replaced with a robust Jetty server, which uses its own configurable thread pool to handle exporter servlet requests directly. This change improves stability and simplifies the threading model, resolving the latency issues under load.
These changes make the PrometheusMetricsProvider more stable, performant, maintainable, and easier to configure for production use.