From be264a7f1bd28fe3298af1a8c13db74f0fe25983 Mon Sep 17 00:00:00 2001 From: Federico Valeri Date: Thu, 19 Dec 2024 09:30:32 +0100 Subject: [PATCH] Add Cluster Operator integration bits Implementation of "Integrate Bridge with Metrics Reporter" proposal. Signed-off-by: Federico Valeri --- CHANGELOG.md | 3 +- bin/docker/kafka_bridge_config_generator.sh | 20 ++++++++++++ config/application.properties | 2 ++ ...-configuring-kafka-bridge-jmx-metrics.adoc | 3 ++ .../io/strimzi/kafka/bridge/Application.java | 32 ++++++++++++------- .../kafka/bridge/config/BridgeConfig.java | 15 +++++++++ .../kafka/bridge/config/ConfigTest.java | 5 +++ 7 files changed, 67 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4f21fec..57b6948f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,7 @@ * Dependency updates (JMX exporter 1.1.0) * Dropped support for Java 11 and replaced with Java 17. * Added support for the [Strimzi Metrics Reporter](https://github.com/strimzi/metrics-reporter) metrics. - This is a Kafka plugin that exports metrics in Prometheus format without passing through JMX, and can be enabled by setting `bridge.metrics=strimziMetricsReporter`. - The JMX Exporter metrics can still be enabled by setting `bridge.metrics=jmxPrometheusExporter`. + This is a Kafka plugin that directly exports metrics in Prometheus format, and can be enabled by setting `bridge.metrics=strimziMetricsReporter`. ### Changes, deprecations and removals diff --git a/bin/docker/kafka_bridge_config_generator.sh b/bin/docker/kafka_bridge_config_generator.sh index a136ca53..9dac70f7 100755 --- a/bin/docker/kafka_bridge_config_generator.sh +++ b/bin/docker/kafka_bridge_config_generator.sh @@ -11,10 +11,27 @@ fi BRIDGE_PROPERTIES=$(cat <<-EOF #Bridge configuration bridge.id=${KAFKA_BRIDGE_ID} +${BRIDGE_METRICS} ${BRIDGE_TRACING} EOF ) +if [ -n "$KAFKA_BRIDGE_METRICS_JMX_CONFIG" ]; then + METRICS_JMX_PROPERTIES=$(cat < map = Map.of( "bridge.id", "my-bridge", "kafka.bootstrap.servers", "localhost:9092", "bridge.metrics", "jmxPrometheusExporter", + "bridge.metrics.jmx.exporter.config.path", configFilePah, "http.host", "0.0.0.0", "http.port", "8080" ); BridgeConfig bridgeConfig = BridgeConfig.fromMap(map); assertThat(bridgeConfig.getMetrics(), is(MetricsType.JMX_EXPORTER.toString())); + assertThat(bridgeConfig.getJmxExporterConfigPath(), is(Path.of(configFilePah))); } @Test