From aff78245e211d9296063afa4e67af3622b1badfe Mon Sep 17 00:00:00 2001 From: Mateusz <76775507+szczygiel-m@users.noreply.github.com> Date: Thu, 28 Nov 2024 11:02:15 +0100 Subject: [PATCH] Updated prometheus version (#1930) * Specifying PrometheusMeterRegistry bean type * Specifying PrometheusConfig bean type * Updated prometheus metrics --- build.gradle | 2 +- .../di/factories/PrometheusMeterRegistryFactory.java | 4 ++-- .../tech/hermes/consumers/config/CommonConfiguration.java | 4 ++-- .../hermes/consumers/config/PrometheusConfigAdapter.java | 2 +- .../tech/hermes/consumers/config/ServerConfiguration.java | 2 +- .../tech/hermes/consumers/server/ConsumerHttpServer.java | 2 +- .../tech/hermes/frontend/config/CommonConfiguration.java | 4 ++-- .../frontend/config/FrontendServerConfiguration.java | 2 +- .../hermes/frontend/config/PrometheusConfigAdapter.java | 2 +- .../allegro/tech/hermes/frontend/server/HermesServer.java | 2 +- .../hermes/frontend/server/PrometheusMetricsHandler.java | 2 +- .../hermes/management/config/PrometheusConfigAdapter.java | 2 +- .../hermes/management/config/PrometheusConfiguration.java | 8 ++++---- 13 files changed, 19 insertions(+), 19 deletions(-) diff --git a/build.gradle b/build.gradle index ca229379c3..4a1159a0ac 100644 --- a/build.gradle +++ b/build.gradle @@ -57,7 +57,7 @@ allprojects { jetty : '12.0.8', curator : '5.4.0', dropwizard_metrics: '4.2.25', - micrometer_metrics: '1.12.5', + micrometer_metrics: '1.13.0', wiremock : '3.9.0', spock : '2.4-M4-groovy-4.0', groovy : '4.0.21', diff --git a/hermes-common/src/main/java/pl/allegro/tech/hermes/common/di/factories/PrometheusMeterRegistryFactory.java b/hermes-common/src/main/java/pl/allegro/tech/hermes/common/di/factories/PrometheusMeterRegistryFactory.java index 7d46f2bba2..d5b5915845 100644 --- a/hermes-common/src/main/java/pl/allegro/tech/hermes/common/di/factories/PrometheusMeterRegistryFactory.java +++ b/hermes-common/src/main/java/pl/allegro/tech/hermes/common/di/factories/PrometheusMeterRegistryFactory.java @@ -7,8 +7,8 @@ import io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics; import io.micrometer.core.instrument.config.MeterFilter; import io.micrometer.core.instrument.distribution.DistributionStatisticConfig; -import io.micrometer.prometheus.PrometheusConfig; -import io.micrometer.prometheus.PrometheusMeterRegistry; +import io.micrometer.prometheusmetrics.PrometheusConfig; +import io.micrometer.prometheusmetrics.PrometheusMeterRegistry; import java.util.concurrent.TimeUnit; import pl.allegro.tech.hermes.common.metric.counter.CounterStorage; import pl.allegro.tech.hermes.common.metric.counter.zookeeper.ZookeeperCounterReporter; diff --git a/hermes-consumers/src/main/java/pl/allegro/tech/hermes/consumers/config/CommonConfiguration.java b/hermes-consumers/src/main/java/pl/allegro/tech/hermes/consumers/config/CommonConfiguration.java index 23a7c78965..cd762c659c 100644 --- a/hermes-consumers/src/main/java/pl/allegro/tech/hermes/consumers/config/CommonConfiguration.java +++ b/hermes-consumers/src/main/java/pl/allegro/tech/hermes/consumers/config/CommonConfiguration.java @@ -6,8 +6,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.composite.CompositeMeterRegistry; -import io.micrometer.prometheus.PrometheusConfig; -import io.micrometer.prometheus.PrometheusMeterRegistry; +import io.micrometer.prometheusmetrics.PrometheusConfig; +import io.micrometer.prometheusmetrics.PrometheusMeterRegistry; import jakarta.inject.Named; import java.time.Clock; import java.util.Arrays; diff --git a/hermes-consumers/src/main/java/pl/allegro/tech/hermes/consumers/config/PrometheusConfigAdapter.java b/hermes-consumers/src/main/java/pl/allegro/tech/hermes/consumers/config/PrometheusConfigAdapter.java index 43c1e2d9e8..3bac713413 100644 --- a/hermes-consumers/src/main/java/pl/allegro/tech/hermes/consumers/config/PrometheusConfigAdapter.java +++ b/hermes-consumers/src/main/java/pl/allegro/tech/hermes/consumers/config/PrometheusConfigAdapter.java @@ -1,6 +1,6 @@ package pl.allegro.tech.hermes.consumers.config; -import io.micrometer.prometheus.PrometheusConfig; +import io.micrometer.prometheusmetrics.PrometheusConfig; import java.time.Duration; public class PrometheusConfigAdapter implements PrometheusConfig { diff --git a/hermes-consumers/src/main/java/pl/allegro/tech/hermes/consumers/config/ServerConfiguration.java b/hermes-consumers/src/main/java/pl/allegro/tech/hermes/consumers/config/ServerConfiguration.java index 8e2bfbfc0c..af6b03bb35 100644 --- a/hermes-consumers/src/main/java/pl/allegro/tech/hermes/consumers/config/ServerConfiguration.java +++ b/hermes-consumers/src/main/java/pl/allegro/tech/hermes/consumers/config/ServerConfiguration.java @@ -1,7 +1,7 @@ package pl.allegro.tech.hermes.consumers.config; import com.fasterxml.jackson.databind.ObjectMapper; -import io.micrometer.prometheus.PrometheusMeterRegistry; +import io.micrometer.prometheusmetrics.PrometheusMeterRegistry; import java.io.IOException; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; diff --git a/hermes-consumers/src/main/java/pl/allegro/tech/hermes/consumers/server/ConsumerHttpServer.java b/hermes-consumers/src/main/java/pl/allegro/tech/hermes/consumers/server/ConsumerHttpServer.java index 722ecbc711..9fac0b659b 100644 --- a/hermes-consumers/src/main/java/pl/allegro/tech/hermes/consumers/server/ConsumerHttpServer.java +++ b/hermes-consumers/src/main/java/pl/allegro/tech/hermes/consumers/server/ConsumerHttpServer.java @@ -7,7 +7,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpServer; -import io.micrometer.prometheus.PrometheusMeterRegistry; +import io.micrometer.prometheusmetrics.PrometheusMeterRegistry; import java.io.IOException; import java.io.OutputStream; import java.net.InetSocketAddress; diff --git a/hermes-frontend/src/main/java/pl/allegro/tech/hermes/frontend/config/CommonConfiguration.java b/hermes-frontend/src/main/java/pl/allegro/tech/hermes/frontend/config/CommonConfiguration.java index dfc71aae5b..705fee2062 100644 --- a/hermes-frontend/src/main/java/pl/allegro/tech/hermes/frontend/config/CommonConfiguration.java +++ b/hermes-frontend/src/main/java/pl/allegro/tech/hermes/frontend/config/CommonConfiguration.java @@ -5,8 +5,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.composite.CompositeMeterRegistry; -import io.micrometer.prometheus.PrometheusConfig; -import io.micrometer.prometheus.PrometheusMeterRegistry; +import io.micrometer.prometheusmetrics.PrometheusConfig; +import io.micrometer.prometheusmetrics.PrometheusMeterRegistry; import java.time.Clock; import java.util.List; import org.apache.curator.framework.CuratorFramework; diff --git a/hermes-frontend/src/main/java/pl/allegro/tech/hermes/frontend/config/FrontendServerConfiguration.java b/hermes-frontend/src/main/java/pl/allegro/tech/hermes/frontend/config/FrontendServerConfiguration.java index 8f707fbab8..9f81e5dca1 100644 --- a/hermes-frontend/src/main/java/pl/allegro/tech/hermes/frontend/config/FrontendServerConfiguration.java +++ b/hermes-frontend/src/main/java/pl/allegro/tech/hermes/frontend/config/FrontendServerConfiguration.java @@ -1,6 +1,6 @@ package pl.allegro.tech.hermes.frontend.config; -import io.micrometer.prometheus.PrometheusMeterRegistry; +import io.micrometer.prometheusmetrics.PrometheusMeterRegistry; import io.undertow.server.HttpHandler; import java.util.Optional; import org.springframework.boot.context.properties.EnableConfigurationProperties; diff --git a/hermes-frontend/src/main/java/pl/allegro/tech/hermes/frontend/config/PrometheusConfigAdapter.java b/hermes-frontend/src/main/java/pl/allegro/tech/hermes/frontend/config/PrometheusConfigAdapter.java index cc57060c15..caec91b185 100644 --- a/hermes-frontend/src/main/java/pl/allegro/tech/hermes/frontend/config/PrometheusConfigAdapter.java +++ b/hermes-frontend/src/main/java/pl/allegro/tech/hermes/frontend/config/PrometheusConfigAdapter.java @@ -1,6 +1,6 @@ package pl.allegro.tech.hermes.frontend.config; -import io.micrometer.prometheus.PrometheusConfig; +import io.micrometer.prometheusmetrics.PrometheusConfig; import java.time.Duration; public class PrometheusConfigAdapter implements PrometheusConfig { diff --git a/hermes-frontend/src/main/java/pl/allegro/tech/hermes/frontend/server/HermesServer.java b/hermes-frontend/src/main/java/pl/allegro/tech/hermes/frontend/server/HermesServer.java index 796c613eb4..bd26580bd2 100644 --- a/hermes-frontend/src/main/java/pl/allegro/tech/hermes/frontend/server/HermesServer.java +++ b/hermes-frontend/src/main/java/pl/allegro/tech/hermes/frontend/server/HermesServer.java @@ -11,7 +11,7 @@ import static org.xnio.Options.READ_TIMEOUT; import static org.xnio.Options.SSL_CLIENT_AUTH_MODE; -import io.micrometer.prometheus.PrometheusMeterRegistry; +import io.micrometer.prometheusmetrics.PrometheusMeterRegistry; import io.undertow.Undertow; import io.undertow.server.HttpHandler; import io.undertow.server.RoutingHandler; diff --git a/hermes-frontend/src/main/java/pl/allegro/tech/hermes/frontend/server/PrometheusMetricsHandler.java b/hermes-frontend/src/main/java/pl/allegro/tech/hermes/frontend/server/PrometheusMetricsHandler.java index c941a6d587..5d0be6dbcb 100644 --- a/hermes-frontend/src/main/java/pl/allegro/tech/hermes/frontend/server/PrometheusMetricsHandler.java +++ b/hermes-frontend/src/main/java/pl/allegro/tech/hermes/frontend/server/PrometheusMetricsHandler.java @@ -2,7 +2,7 @@ import static io.undertow.util.StatusCodes.OK; -import io.micrometer.prometheus.PrometheusMeterRegistry; +import io.micrometer.prometheusmetrics.PrometheusMeterRegistry; import io.undertow.server.HttpHandler; import io.undertow.server.HttpServerExchange; diff --git a/hermes-management/src/main/java/pl/allegro/tech/hermes/management/config/PrometheusConfigAdapter.java b/hermes-management/src/main/java/pl/allegro/tech/hermes/management/config/PrometheusConfigAdapter.java index 4d4eba794d..aab50d52fa 100644 --- a/hermes-management/src/main/java/pl/allegro/tech/hermes/management/config/PrometheusConfigAdapter.java +++ b/hermes-management/src/main/java/pl/allegro/tech/hermes/management/config/PrometheusConfigAdapter.java @@ -1,6 +1,6 @@ package pl.allegro.tech.hermes.management.config; -import io.micrometer.prometheus.PrometheusConfig; +import io.micrometer.prometheusmetrics.PrometheusConfig; import java.time.Duration; public class PrometheusConfigAdapter implements PrometheusConfig { diff --git a/hermes-management/src/main/java/pl/allegro/tech/hermes/management/config/PrometheusConfiguration.java b/hermes-management/src/main/java/pl/allegro/tech/hermes/management/config/PrometheusConfiguration.java index 38eca0a4f6..48aa812b26 100644 --- a/hermes-management/src/main/java/pl/allegro/tech/hermes/management/config/PrometheusConfiguration.java +++ b/hermes-management/src/main/java/pl/allegro/tech/hermes/management/config/PrometheusConfiguration.java @@ -3,8 +3,8 @@ import io.micrometer.core.instrument.Meter; import io.micrometer.core.instrument.config.MeterFilter; import io.micrometer.core.instrument.distribution.DistributionStatisticConfig; -import io.micrometer.prometheus.PrometheusConfig; -import io.micrometer.prometheus.PrometheusMeterRegistry; +import io.micrometer.prometheusmetrics.PrometheusConfig; +import io.micrometer.prometheusmetrics.PrometheusMeterRegistry; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; @@ -15,7 +15,7 @@ public class PrometheusConfiguration { @Bean - @ConditionalOnMissingBean + @ConditionalOnMissingBean(PrometheusMeterRegistry.class) public PrometheusMeterRegistry micrometerRegistry( MicrometerRegistryProperties properties, PrometheusConfig prometheusConfig) { return new PrometheusMeterRegistryFactory(properties, prometheusConfig, "hermes-management") @@ -23,7 +23,7 @@ public PrometheusMeterRegistry micrometerRegistry( } @Bean - @ConditionalOnMissingBean + @ConditionalOnMissingBean(PrometheusConfig.class) public PrometheusConfig prometheusConfig(PrometheusProperties properties) { return new PrometheusConfigAdapter(properties); }