From 5a23838981019a539651fde7d6630376ad8d7590 Mon Sep 17 00:00:00 2001 From: xeniape Date: Thu, 12 Jun 2025 13:52:20 +0200 Subject: [PATCH 1/9] chore: replace jmx exporter with built in Prometheus support --- rust/operator-binary/src/config/jvm.rs | 7 +-- rust/operator-binary/src/crd/mod.rs | 14 +++++- tests/templates/kuttl/smoke/test_zookeeper.py | 46 +++++++++++++++---- 3 files changed, 50 insertions(+), 17 deletions(-) diff --git a/rust/operator-binary/src/config/jvm.rs b/rust/operator-binary/src/config/jvm.rs index 2db69e86..acb5b28c 100644 --- a/rust/operator-binary/src/config/jvm.rs +++ b/rust/operator-binary/src/config/jvm.rs @@ -6,7 +6,7 @@ use stackable_operator::{ use crate::crd::{ JVM_SECURITY_PROPERTIES_FILE, LOG4J_CONFIG_FILE, LOGBACK_CONFIG_FILE, LoggingFramework, - METRICS_PORT, STACKABLE_CONFIG_DIR, STACKABLE_LOG_CONFIG_DIR, + STACKABLE_CONFIG_DIR, STACKABLE_LOG_CONFIG_DIR, v1alpha1::{ZookeeperCluster, ZookeeperConfig, ZookeeperConfigFragment}, }; @@ -36,9 +36,6 @@ fn construct_jvm_args( let jvm_args = vec![ format!("-Djava.security.properties={STACKABLE_CONFIG_DIR}/{JVM_SECURITY_PROPERTIES_FILE}"), - format!( - "-javaagent:/stackable/jmx/jmx_prometheus_javaagent.jar={METRICS_PORT}:/stackable/jmx/server.yaml" - ), match logging_framework { LoggingFramework::LOG4J => { format!("-Dlog4j.configuration=file:{STACKABLE_LOG_CONFIG_DIR}/{LOG4J_CONFIG_FILE}") @@ -123,7 +120,6 @@ mod tests { assert_eq!( non_heap_jvm_args, "-Djava.security.properties=/stackable/config/security.properties \ - -javaagent:/stackable/jmx/jmx_prometheus_javaagent.jar=9505:/stackable/jmx/server.yaml \ -Dlogback.configurationFile=/stackable/log_config/logback.xml" ); assert_eq!(zk_server_heap_env, "409"); @@ -168,7 +164,6 @@ mod tests { assert_eq!( non_heap_jvm_args, "-Djava.security.properties=/stackable/config/security.properties \ - -javaagent:/stackable/jmx/jmx_prometheus_javaagent.jar=9505:/stackable/jmx/server.yaml \ -Dlogback.configurationFile=/stackable/log_config/logback.xml \ -Dhttps.proxyHost=proxy.my.corp \ -Djava.net.preferIPv4Stack=true \ diff --git a/rust/operator-binary/src/crd/mod.rs b/rust/operator-binary/src/crd/mod.rs index 532a95d2..788f19b0 100644 --- a/rust/operator-binary/src/crd/mod.rs +++ b/rust/operator-binary/src/crd/mod.rs @@ -47,7 +47,9 @@ pub const OPERATOR_NAME: &str = "zookeeper.stackable.tech"; pub const ZOOKEEPER_PROPERTIES_FILE: &str = "zoo.cfg"; pub const JVM_SECURITY_PROPERTIES_FILE: &str = "security.properties"; -pub const METRICS_PORT: u16 = 9505; +pub const METRICS_PROVIDER_CLASS_NAME: &str = + "org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider"; +pub const METRICS_PROVIDER_HTTP_PORT: u16 = 9505; pub const STACKABLE_DATA_DIR: &str = "/stackable/data"; pub const STACKABLE_CONFIG_DIR: &str = "/stackable/config"; @@ -371,6 +373,8 @@ impl v1alpha1::ZookeeperConfig { pub const DATA_DIR: &'static str = "dataDir"; const DEFAULT_SECRET_LIFETIME: Duration = Duration::from_days_unchecked(1); pub const INIT_LIMIT: &'static str = "initLimit"; + const METRICS_PROVIDER_CLASS_NAME: &'static str = "metricsProvider.className"; + const METRICS_PROVIDER_HTTP_PORT: &'static str = "metricsProvider.httpPort"; pub const MYID_OFFSET: &'static str = "MYID_OFFSET"; pub const SYNC_LIMIT: &'static str = "syncLimit"; pub const TICK_TIME: &'static str = "tickTime"; @@ -468,6 +472,14 @@ impl Configuration for v1alpha1::ZookeeperConfigFragment { v1alpha1::ZookeeperConfig::DATA_DIR.to_string(), Some(STACKABLE_DATA_DIR.to_string()), ); + result.insert( + v1alpha1::ZookeeperConfig::METRICS_PROVIDER_CLASS_NAME.to_string(), + Some(METRICS_PROVIDER_CLASS_NAME.to_string()), + ); + result.insert( + v1alpha1::ZookeeperConfig::METRICS_PROVIDER_HTTP_PORT.to_string(), + Some(METRICS_PROVIDER_HTTP_PORT.to_string()), + ); } Ok(result) diff --git a/tests/templates/kuttl/smoke/test_zookeeper.py b/tests/templates/kuttl/smoke/test_zookeeper.py index dfef9589..26389409 100755 --- a/tests/templates/kuttl/smoke/test_zookeeper.py +++ b/tests/templates/kuttl/smoke/test_zookeeper.py @@ -3,6 +3,7 @@ import requests import time import sys + sys.tracebacklimit = 0 @@ -37,18 +38,29 @@ def check_ruok(hosts): url = host + ":8080/commands/" + cmd_ruok response = try_get(url).json() - if "command" in response and response["command"] == cmd_ruok \ - and "error" in response and response["error"] is None: + if ( + "command" in response + and response["command"] == cmd_ruok + and "error" in response + and response["error"] is None + ): continue else: - print("Error[" + cmd_ruok + "] for [" + url + "]: received " + str( - response) + " - expected {'command': 'ruok', 'error': None} ") + print( + "Error[" + + cmd_ruok + + "] for [" + + url + + "]: received " + + str(response) + + " - expected {'command': 'ruok', 'error': None} " + ) exit(-1) def check_monitoring(hosts): for host in hosts: - url = host + ":9505" + url = host + ":9505/metrics" response = try_get(url) if response.ok: @@ -58,15 +70,29 @@ def check_monitoring(hosts): exit(-1) -if __name__ == '__main__': +if __name__ == "__main__": all_args = argparse.ArgumentParser(description="Test ZooKeeper.") - all_args.add_argument("-n", "--namespace", help="The namespace to run in", required=True) + all_args.add_argument( + "-n", "--namespace", help="The namespace to run in", required=True + ) args = vars(all_args.parse_args()) namespace = args["namespace"] - host_primary_0 = "http://test-zk-server-primary-0.test-zk-server-primary." + namespace + ".svc.cluster.local" - host_primary_1 = "http://test-zk-server-primary-1.test-zk-server-primary." + namespace + ".svc.cluster.local" - host_secondary = "http://test-zk-server-secondary-0.test-zk-server-secondary." + namespace + ".svc.cluster.local" + host_primary_0 = ( + "http://test-zk-server-primary-0.test-zk-server-primary." + + namespace + + ".svc.cluster.local" + ) + host_primary_1 = ( + "http://test-zk-server-primary-1.test-zk-server-primary." + + namespace + + ".svc.cluster.local" + ) + host_secondary = ( + "http://test-zk-server-secondary-0.test-zk-server-secondary." + + namespace + + ".svc.cluster.local" + ) hosts = [host_primary_0, host_primary_1, host_secondary] From 98c5732eab0116c0e6178d55574be787f20ae2f4 Mon Sep 17 00:00:00 2001 From: xeniape Date: Thu, 12 Jun 2025 14:07:13 +0200 Subject: [PATCH 2/9] add changelog entry --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82053613..12b52646 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,8 @@ All notable changes to this project will be documented in this file. - The `runAsUser` and `runAsGroup` fields will not be set anymore by the operator - The defaults from the docker images itself will now apply, which will be different from 1000/0 going forward - This is marked as breaking because tools and policies might exist, which require these fields to be set +- BREAKING: Replace JMX Exporter with built in Prometheus support. Hence, the metrics provided by the `/metrics` endpoint are named + differently now ([#955]). ### Fixed @@ -45,6 +47,7 @@ All notable changes to this project will be documented in this file. [#942]: https://github.com/stackabletech/zookeeper-operator/pull/942 [#946]: https://github.com/stackabletech/zookeeper-operator/pull/946 [#950]: https://github.com/stackabletech/zookeeper-operator/pull/950 +[#955]: https://github.com/stackabletech/zookeeper-operator/pull/955 ## [25.3.0] - 2025-03-21 From b5a685d1583d51e7a44a131b86e4c7629e8f1490 Mon Sep 17 00:00:00 2001 From: xeniape Date: Fri, 13 Jun 2025 10:13:28 +0200 Subject: [PATCH 3/9] test for metrics being present --- tests/templates/kuttl/smoke/test_zookeeper.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/templates/kuttl/smoke/test_zookeeper.py b/tests/templates/kuttl/smoke/test_zookeeper.py index 26389409..16a44900 100755 --- a/tests/templates/kuttl/smoke/test_zookeeper.py +++ b/tests/templates/kuttl/smoke/test_zookeeper.py @@ -64,6 +64,12 @@ def check_monitoring(hosts): response = try_get(url) if response.ok: + # arbitrary metric was chosen to test if metrics are present in the response + if "quorum_size" in response.text: + continue + else: + print("Error for [" + url + "]: missing metrics") + exit(-1) continue else: print("Error for [" + url + "]: could not access monitoring") From fa8597eb4b954c97132420b347f0502beef1c5a0 Mon Sep 17 00:00:00 2001 From: xeniape Date: Fri, 13 Jun 2025 11:19:10 +0200 Subject: [PATCH 4/9] add monitoring documentation --- .../pages/usage_guide/monitoring.adoc | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/docs/modules/zookeeper/pages/usage_guide/monitoring.adoc b/docs/modules/zookeeper/pages/usage_guide/monitoring.adoc index f50ad9f0..6cf60290 100644 --- a/docs/modules/zookeeper/pages/usage_guide/monitoring.adoc +++ b/docs/modules/zookeeper/pages/usage_guide/monitoring.adoc @@ -2,4 +2,23 @@ :description: The managed ZooKeeper instances are automatically configured to export Prometheus metrics. The managed ZooKeeper instances are automatically configured to export Prometheus metrics. -See xref:operators:monitoring.adoc[] for more details. +See xref:operators:monitoring.adoc[window=_blank] for more details. + +Depending on the SDP version, different ZooKeeper monitoring systems are used to produce metrics. +Previously, JMX in combination with JMX Exporter was used. Starting with SDP 25.7 the New Metrics System is utilized. +The naming of the metrics differs between the two systems. + +== ZooKeeper New Metrics System + +Since SDP 25.7 ZooKeeper is configured to provide metrics by utilizing the New Metrics System. More on the New Metrics System in +the https://zookeeper.apache.org/doc/current/zookeeperMonitor.html[ZooKeeper Monitor Guide,window=_blank]. + +The configuration is located in the `zoo.cfg`: + +[source,properties] +---- +metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider +metricsProvider.httpPort=9505 +---- + +The metrics can be accessed by calling the `/metrics` endpoint on the specified port. From 10d51412df89c80d8ccdc1f2b7cd050ada082199 Mon Sep 17 00:00:00 2001 From: xeniape Date: Sun, 15 Jun 2025 12:50:31 +0200 Subject: [PATCH 5/9] metrics port on pods/service configurable --- rust/operator-binary/src/crd/mod.rs | 13 ++++----- rust/operator-binary/src/zk_controller.rs | 35 ++++++++++++++++++++--- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/rust/operator-binary/src/crd/mod.rs b/rust/operator-binary/src/crd/mod.rs index 788f19b0..36f0d6a4 100644 --- a/rust/operator-binary/src/crd/mod.rs +++ b/rust/operator-binary/src/crd/mod.rs @@ -47,8 +47,7 @@ pub const OPERATOR_NAME: &str = "zookeeper.stackable.tech"; pub const ZOOKEEPER_PROPERTIES_FILE: &str = "zoo.cfg"; pub const JVM_SECURITY_PROPERTIES_FILE: &str = "security.properties"; -pub const METRICS_PROVIDER_CLASS_NAME: &str = - "org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider"; +pub const METRICS_PROVIDER_HTTP_PORT_KEY: &str = "metricsProvider.httpPort"; pub const METRICS_PROVIDER_HTTP_PORT: u16 = 9505; pub const STACKABLE_DATA_DIR: &str = "/stackable/data"; @@ -373,8 +372,6 @@ impl v1alpha1::ZookeeperConfig { pub const DATA_DIR: &'static str = "dataDir"; const DEFAULT_SECRET_LIFETIME: Duration = Duration::from_days_unchecked(1); pub const INIT_LIMIT: &'static str = "initLimit"; - const METRICS_PROVIDER_CLASS_NAME: &'static str = "metricsProvider.className"; - const METRICS_PROVIDER_HTTP_PORT: &'static str = "metricsProvider.httpPort"; pub const MYID_OFFSET: &'static str = "MYID_OFFSET"; pub const SYNC_LIMIT: &'static str = "syncLimit"; pub const TICK_TIME: &'static str = "tickTime"; @@ -473,11 +470,13 @@ impl Configuration for v1alpha1::ZookeeperConfigFragment { Some(STACKABLE_DATA_DIR.to_string()), ); result.insert( - v1alpha1::ZookeeperConfig::METRICS_PROVIDER_CLASS_NAME.to_string(), - Some(METRICS_PROVIDER_CLASS_NAME.to_string()), + "metricsProvider.className".to_string(), + Some( + "org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider".to_string(), + ), ); result.insert( - v1alpha1::ZookeeperConfig::METRICS_PROVIDER_HTTP_PORT.to_string(), + METRICS_PROVIDER_HTTP_PORT_KEY.to_string(), Some(METRICS_PROVIDER_HTTP_PORT.to_string()), ); } diff --git a/rust/operator-binary/src/zk_controller.rs b/rust/operator-binary/src/zk_controller.rs index 1553be86..913cf17e 100644 --- a/rust/operator-binary/src/zk_controller.rs +++ b/rust/operator-binary/src/zk_controller.rs @@ -72,8 +72,9 @@ use crate::{ config::jvm::{construct_non_heap_jvm_args, construct_zk_server_heap_env}, crd::{ DOCKER_IMAGE_BASE_NAME, JVM_SECURITY_PROPERTIES_FILE, MAX_PREPARE_LOG_FILE_SIZE, - MAX_ZK_LOG_FILES_SIZE, STACKABLE_CONFIG_DIR, STACKABLE_DATA_DIR, STACKABLE_LOG_CONFIG_DIR, - STACKABLE_LOG_DIR, STACKABLE_RW_CONFIG_DIR, ZOOKEEPER_PROPERTIES_FILE, ZookeeperRole, + MAX_ZK_LOG_FILES_SIZE, METRICS_PROVIDER_HTTP_PORT, METRICS_PROVIDER_HTTP_PORT_KEY, + STACKABLE_CONFIG_DIR, STACKABLE_DATA_DIR, STACKABLE_LOG_CONFIG_DIR, STACKABLE_LOG_DIR, + STACKABLE_RW_CONFIG_DIR, ZOOKEEPER_PROPERTIES_FILE, ZookeeperRole, security::{self, ZookeeperSecurity}, v1alpha1, }, @@ -415,6 +416,7 @@ pub async fn reconcile_zk( &rolegroup, &resolved_product_image, &zookeeper_security, + rolegroup_config, )?; let rg_configmap = build_server_rolegroup_config_map( zk, @@ -675,6 +677,7 @@ fn build_server_rolegroup_service( rolegroup: &RoleGroupRef, resolved_product_image: &ResolvedProductImage, zookeeper_security: &ZookeeperSecurity, + rolegroup_config: &HashMap>, ) -> Result { let prometheus_label = Label::try_from(("prometheus.io/scrape", "true")).context(BuildLabelSnafu)?; @@ -712,7 +715,7 @@ fn build_server_rolegroup_service( }, ServicePort { name: Some("metrics".to_string()), - port: 9505, + port: metrics_port_from_rolegroup_config(rolegroup_config).into(), protocol: Some("TCP".to_string()), ..ServicePort::default() }, @@ -897,7 +900,10 @@ fn build_server_rolegroup_statefulset( .add_container_port("zk", zookeeper_security.client_port().into()) .add_container_port("zk-leader", 2888) .add_container_port("zk-election", 3888) - .add_container_port("metrics", 9505) + .add_container_port( + "metrics", + metrics_port_from_rolegroup_config(server_config).into(), + ) .add_volume_mount("data", STACKABLE_DATA_DIR) .context(AddVolumeMountSnafu)? .add_volume_mount("config", STACKABLE_CONFIG_DIR) @@ -1063,6 +1069,27 @@ fn build_server_rolegroup_statefulset( }) } +fn metrics_port_from_rolegroup_config( + rolegroup_config: &HashMap>, +) -> u16 { + let metrics_port = rolegroup_config + .get(&PropertyNameKind::File( + ZOOKEEPER_PROPERTIES_FILE.to_string(), + )) + .expect("{ZOOKEEPER_PROPERTIES_FILE} is present") + .get(METRICS_PROVIDER_HTTP_PORT_KEY) + .expect("{METRICS_PROVIDER_HTTP_PORT_KEY} is set"); + + match u16::from_str(metrics_port) { + Ok(port) => port, + Err(err) => { + tracing::error!("{err}"); + tracing::info!("Defaulting to using {METRICS_PROVIDER_HTTP_PORT} as metrics port."); + METRICS_PROVIDER_HTTP_PORT + } + } +} + pub fn error_policy( _obj: Arc>, error: &Error, From 831df0ed901377a727f68dc67b0abf1474de9089 Mon Sep 17 00:00:00 2001 From: xeniape Date: Mon, 16 Jun 2025 16:07:04 +0200 Subject: [PATCH 6/9] add jmx exporter back in --- rust/operator-binary/src/config/jvm.rs | 7 ++++++- rust/operator-binary/src/crd/mod.rs | 3 ++- rust/operator-binary/src/zk_controller.rs | 9 ++++++++- tests/templates/kuttl/smoke/test_zookeeper.py | 13 ++++++++++++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/rust/operator-binary/src/config/jvm.rs b/rust/operator-binary/src/config/jvm.rs index acb5b28c..2db69e86 100644 --- a/rust/operator-binary/src/config/jvm.rs +++ b/rust/operator-binary/src/config/jvm.rs @@ -6,7 +6,7 @@ use stackable_operator::{ use crate::crd::{ JVM_SECURITY_PROPERTIES_FILE, LOG4J_CONFIG_FILE, LOGBACK_CONFIG_FILE, LoggingFramework, - STACKABLE_CONFIG_DIR, STACKABLE_LOG_CONFIG_DIR, + METRICS_PORT, STACKABLE_CONFIG_DIR, STACKABLE_LOG_CONFIG_DIR, v1alpha1::{ZookeeperCluster, ZookeeperConfig, ZookeeperConfigFragment}, }; @@ -36,6 +36,9 @@ fn construct_jvm_args( let jvm_args = vec![ format!("-Djava.security.properties={STACKABLE_CONFIG_DIR}/{JVM_SECURITY_PROPERTIES_FILE}"), + format!( + "-javaagent:/stackable/jmx/jmx_prometheus_javaagent.jar={METRICS_PORT}:/stackable/jmx/server.yaml" + ), match logging_framework { LoggingFramework::LOG4J => { format!("-Dlog4j.configuration=file:{STACKABLE_LOG_CONFIG_DIR}/{LOG4J_CONFIG_FILE}") @@ -120,6 +123,7 @@ mod tests { assert_eq!( non_heap_jvm_args, "-Djava.security.properties=/stackable/config/security.properties \ + -javaagent:/stackable/jmx/jmx_prometheus_javaagent.jar=9505:/stackable/jmx/server.yaml \ -Dlogback.configurationFile=/stackable/log_config/logback.xml" ); assert_eq!(zk_server_heap_env, "409"); @@ -164,6 +168,7 @@ mod tests { assert_eq!( non_heap_jvm_args, "-Djava.security.properties=/stackable/config/security.properties \ + -javaagent:/stackable/jmx/jmx_prometheus_javaagent.jar=9505:/stackable/jmx/server.yaml \ -Dlogback.configurationFile=/stackable/log_config/logback.xml \ -Dhttps.proxyHost=proxy.my.corp \ -Djava.net.preferIPv4Stack=true \ diff --git a/rust/operator-binary/src/crd/mod.rs b/rust/operator-binary/src/crd/mod.rs index 36f0d6a4..8fd6291a 100644 --- a/rust/operator-binary/src/crd/mod.rs +++ b/rust/operator-binary/src/crd/mod.rs @@ -47,8 +47,9 @@ pub const OPERATOR_NAME: &str = "zookeeper.stackable.tech"; pub const ZOOKEEPER_PROPERTIES_FILE: &str = "zoo.cfg"; pub const JVM_SECURITY_PROPERTIES_FILE: &str = "security.properties"; +pub const METRICS_PORT: u16 = 9505; pub const METRICS_PROVIDER_HTTP_PORT_KEY: &str = "metricsProvider.httpPort"; -pub const METRICS_PROVIDER_HTTP_PORT: u16 = 9505; +pub const METRICS_PROVIDER_HTTP_PORT: u16 = 7000; pub const STACKABLE_DATA_DIR: &str = "/stackable/data"; pub const STACKABLE_CONFIG_DIR: &str = "/stackable/config"; diff --git a/rust/operator-binary/src/zk_controller.rs b/rust/operator-binary/src/zk_controller.rs index 913cf17e..706677d3 100644 --- a/rust/operator-binary/src/zk_controller.rs +++ b/rust/operator-binary/src/zk_controller.rs @@ -715,6 +715,12 @@ fn build_server_rolegroup_service( }, ServicePort { name: Some("metrics".to_string()), + port: 9505, + protocol: Some("TCP".to_string()), + ..ServicePort::default() + }, + ServicePort { + name: Some("native-metrics".to_string()), port: metrics_port_from_rolegroup_config(rolegroup_config).into(), protocol: Some("TCP".to_string()), ..ServicePort::default() @@ -900,8 +906,9 @@ fn build_server_rolegroup_statefulset( .add_container_port("zk", zookeeper_security.client_port().into()) .add_container_port("zk-leader", 2888) .add_container_port("zk-election", 3888) + .add_container_port("metrics", 9505) .add_container_port( - "metrics", + "native-metrics", metrics_port_from_rolegroup_config(server_config).into(), ) .add_volume_mount("data", STACKABLE_DATA_DIR) diff --git a/tests/templates/kuttl/smoke/test_zookeeper.py b/tests/templates/kuttl/smoke/test_zookeeper.py index 16a44900..f3582f9c 100755 --- a/tests/templates/kuttl/smoke/test_zookeeper.py +++ b/tests/templates/kuttl/smoke/test_zookeeper.py @@ -60,7 +60,18 @@ def check_ruok(hosts): def check_monitoring(hosts): for host in hosts: - url = host + ":9505/metrics" + # test for the jmx exporter metrics + url = host + ":9505" + response = try_get(url) + + if response.ok: + continue + else: + print("Error for [" + url + "]: could not access monitoring") + exit(-1) + + # test for the native metrics + url = host + ":7000/metrics" response = try_get(url) if response.ok: From 50b163eda6687680c03d7a1b53dc0525b0e09d1f Mon Sep 17 00:00:00 2001 From: xeniape Date: Mon, 16 Jun 2025 17:03:26 +0200 Subject: [PATCH 7/9] adjust changelog entry --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12b52646..631b3ae2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file. - Use `--file-log-max-files` (or `FILE_LOG_MAX_FILES`) to limit the number of log files kept. - Use `--file-log-rotation-period` (or `FILE_LOG_ROTATION_PERIOD`) to configure the frequency of rotation. - Use `--console-log-format` (or `CONSOLE_LOG_FORMAT`) to set the format to `plain` (default) or `json`. +- Add built-in Prometheus support and expose metrics on `/metrics` path of `native-metrics` port ([#955]). ### Changed @@ -27,8 +28,6 @@ All notable changes to this project will be documented in this file. - The `runAsUser` and `runAsGroup` fields will not be set anymore by the operator - The defaults from the docker images itself will now apply, which will be different from 1000/0 going forward - This is marked as breaking because tools and policies might exist, which require these fields to be set -- BREAKING: Replace JMX Exporter with built in Prometheus support. Hence, the metrics provided by the `/metrics` endpoint are named - differently now ([#955]). ### Fixed From ece0e483984bd3c68e6ce1d45330bf0bef5f0703 Mon Sep 17 00:00:00 2001 From: Xenia Date: Mon, 16 Jun 2025 17:05:58 +0200 Subject: [PATCH 8/9] Update docs/modules/zookeeper/pages/usage_guide/monitoring.adoc Co-authored-by: Razvan-Daniel Mihai <84674+razvan@users.noreply.github.com> --- docs/modules/zookeeper/pages/usage_guide/monitoring.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/modules/zookeeper/pages/usage_guide/monitoring.adoc b/docs/modules/zookeeper/pages/usage_guide/monitoring.adoc index 6cf60290..cdf3204a 100644 --- a/docs/modules/zookeeper/pages/usage_guide/monitoring.adoc +++ b/docs/modules/zookeeper/pages/usage_guide/monitoring.adoc @@ -8,9 +8,9 @@ Depending on the SDP version, different ZooKeeper monitoring systems are used to Previously, JMX in combination with JMX Exporter was used. Starting with SDP 25.7 the New Metrics System is utilized. The naming of the metrics differs between the two systems. -== ZooKeeper New Metrics System +== Metrics -Since SDP 25.7 ZooKeeper is configured to provide metrics by utilizing the New Metrics System. More on the New Metrics System in +Starting with SDP 25.7 ZooKeeper is configured to export metrics using the built in Prometheus provider. More on the Prometheus provider in the https://zookeeper.apache.org/doc/current/zookeeperMonitor.html[ZooKeeper Monitor Guide,window=_blank]. The configuration is located in the `zoo.cfg`: From 31be09c2c164c632227173aa07309d618b204df0 Mon Sep 17 00:00:00 2001 From: xeniape Date: Mon, 16 Jun 2025 17:12:42 +0200 Subject: [PATCH 9/9] adjust documentation --- docs/modules/zookeeper/pages/usage_guide/monitoring.adoc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/modules/zookeeper/pages/usage_guide/monitoring.adoc b/docs/modules/zookeeper/pages/usage_guide/monitoring.adoc index cdf3204a..b53f18c6 100644 --- a/docs/modules/zookeeper/pages/usage_guide/monitoring.adoc +++ b/docs/modules/zookeeper/pages/usage_guide/monitoring.adoc @@ -4,13 +4,13 @@ The managed ZooKeeper instances are automatically configured to export Prometheus metrics. See xref:operators:monitoring.adoc[window=_blank] for more details. -Depending on the SDP version, different ZooKeeper monitoring systems are used to produce metrics. -Previously, JMX in combination with JMX Exporter was used. Starting with SDP 25.7 the New Metrics System is utilized. +Depending on the SDP version, different ZooKeeper monitoring systems are used to produce metrics. Currently, JMX in combination with JMX Exporter +is used, but will be removed in a later release. Starting with SDP 25.7 the built-in Prometheus support of ZooKeeper is also added. The naming of the metrics differs between the two systems. == Metrics -Starting with SDP 25.7 ZooKeeper is configured to export metrics using the built in Prometheus provider. More on the Prometheus provider in +Starting with SDP 25.7 ZooKeeper is configured to export metrics using the built-in Prometheus provider. More on the Prometheus provider in the https://zookeeper.apache.org/doc/current/zookeeperMonitor.html[ZooKeeper Monitor Guide,window=_blank]. The configuration is located in the `zoo.cfg`: @@ -18,7 +18,7 @@ The configuration is located in the `zoo.cfg`: [source,properties] ---- metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider -metricsProvider.httpPort=9505 +metricsProvider.httpPort=7000 ---- The metrics can be accessed by calling the `/metrics` endpoint on the specified port.