ZOOKEEPER-4741: Modernize PrometheusMetricsProvider with Jetty and ne…
…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.
@kezhuw @anmolnar @eolivelli please have a look. I'm not sure why CI is failing.
UPD: just rebasing it fixed the test
@dukelion Thanks! Please fix the compile error.
@eolivelli @li4wang You might want to take a look at this patch before submission.
Merged to master branch. Thanks @dukelion ! Please let me know your jira id, I'll assign the jira ticket to you.