Skip to content

Commit 4f1edf8

Browse files
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 4f1edf8

File tree

6 files changed

+650
-623
lines changed

6 files changed

+650
-623
lines changed

zookeeper-metrics-providers/zookeeper-prometheus-metrics/pom.xml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<description>ZooKeeper Prometheus.io Metrics Provider implementation</description>
3333

3434
<properties>
35-
<prometheus.version>0.9.0</prometheus.version>
35+
<prometheus.version>1.3.10</prometheus.version>
3636
</properties>
3737
<dependencies>
3838
<dependency>
@@ -46,17 +46,32 @@
4646
</dependency>
4747
<dependency>
4848
<groupId>io.prometheus</groupId>
49-
<artifactId>simpleclient</artifactId>
49+
<artifactId>prometheus-metrics-core</artifactId>
5050
<version>${prometheus.version}</version>
5151
</dependency>
5252
<dependency>
5353
<groupId>io.prometheus</groupId>
54-
<artifactId>simpleclient_hotspot</artifactId>
54+
<artifactId>prometheus-metrics-instrumentation-jvm</artifactId>
5555
<version>${prometheus.version}</version>
5656
</dependency>
5757
<dependency>
5858
<groupId>io.prometheus</groupId>
59-
<artifactId>simpleclient_servlet</artifactId>
59+
<artifactId>prometheus-metrics-exporter-servlet-javax</artifactId>
60+
<version>${prometheus.version}</version>
61+
</dependency>
62+
<dependency>
63+
<groupId>io.prometheus</groupId>
64+
<artifactId>prometheus-metrics-exporter-httpserver</artifactId>
65+
<version>${prometheus.version}</version>
66+
</dependency>
67+
<dependency>
68+
<groupId>io.prometheus</groupId>
69+
<artifactId>prometheus-metrics-exposition-formats</artifactId>
70+
<version>${prometheus.version}</version>
71+
</dependency>
72+
<dependency>
73+
<groupId>io.prometheus</groupId>
74+
<artifactId>prometheus-metrics-config</artifactId>
6075
<version>${prometheus.version}</version>
6176
</dependency>
6277
<dependency>

0 commit comments

Comments
 (0)