Commit c4c1c26
committed
ZOOKEEPER-4741: Modernize PrometheusMetricsProvider with Jetty and new 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:
1. **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.
2. **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.1 parent bec08df commit c4c1c26
File tree
6 files changed
+671
-630
lines changed- zookeeper-metrics-providers/zookeeper-prometheus-metrics
- src
- main/java/org/apache/zookeeper/metrics/prometheus
- test/java/org/apache/zookeeper/metrics/prometheus
6 files changed
+671
-630
lines changedLines changed: 40 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
49 | | - | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
54 | | - | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
59 | | - | |
| 60 | + | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
63 | | - | |
64 | | - | |
65 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
66 | 94 | | |
67 | 95 | | |
68 | | - | |
69 | | - | |
70 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
71 | 100 | | |
72 | 101 | | |
73 | 102 | | |
| |||
0 commit comments