From 2fcf402913c7fae6681fc0d4ee21303c6cf582c3 Mon Sep 17 00:00:00 2001 From: Roberto Cortez Date: Thu, 4 Sep 2025 15:51:45 +0100 Subject: [PATCH] Deprecate SmallRye Metrics --- extensions/agroal/deployment/pom.xml | 3 +++ extensions/hibernate-orm/deployment/pom.xml | 5 +++++ extensions/quartz/deployment/pom.xml | 8 ++++++++ extensions/smallrye-graphql/deployment/pom.xml | 3 +++ extensions/smallrye-metrics/deployment/pom.xml | 8 ++++++++ .../metrics/deployment/SmallRyeMetricsConfig.java | 7 +++++++ .../deployment/SmallRyeMetricsProcessor.java | 15 ++++++++++++++- .../src/main/resources/application.properties | 2 ++ .../src/main/resources/ddlgeneration.properties | 2 ++ .../src/main/resources/nopaging.properties | 2 ++ .../src/main/resources/application.properties | 1 + tcks/microprofile-fault-tolerance/pom.xml | 1 + tcks/microprofile-metrics/api/pom.xml | 1 + tcks/microprofile-metrics/optional/pom.xml | 1 + tcks/microprofile-metrics/rest/pom.xml | 1 + 15 files changed, 59 insertions(+), 1 deletion(-) diff --git a/extensions/agroal/deployment/pom.xml b/extensions/agroal/deployment/pom.xml index ac448c706702e..c4241ee53a092 100644 --- a/extensions/agroal/deployment/pom.xml +++ b/extensions/agroal/deployment/pom.xml @@ -112,6 +112,9 @@ maven-surefire-plugin alphabetical + + true + diff --git a/extensions/hibernate-orm/deployment/pom.xml b/extensions/hibernate-orm/deployment/pom.xml index da7cd31bf9fe1..16ca6bc12fa5f 100644 --- a/extensions/hibernate-orm/deployment/pom.xml +++ b/extensions/hibernate-orm/deployment/pom.xml @@ -134,6 +134,11 @@ maven-surefire-plugin + + + true + + default-test diff --git a/extensions/quartz/deployment/pom.xml b/extensions/quartz/deployment/pom.xml index 3c3294bb7144a..6e74288fde6af 100644 --- a/extensions/quartz/deployment/pom.xml +++ b/extensions/quartz/deployment/pom.xml @@ -71,6 +71,14 @@ + + maven-surefire-plugin + + + true + + + diff --git a/extensions/smallrye-graphql/deployment/pom.xml b/extensions/smallrye-graphql/deployment/pom.xml index 73bb3794b3b21..43dba260f6148 100644 --- a/extensions/smallrye-graphql/deployment/pom.xml +++ b/extensions/smallrye-graphql/deployment/pom.xml @@ -121,6 +121,9 @@ true, some as false, so we need to create a separate JVM per test to run the initializer each time separately. This is reported as https://github.com/smallrye/smallrye-graphql/issues/2039 --> false + + true + diff --git a/extensions/smallrye-metrics/deployment/pom.xml b/extensions/smallrye-metrics/deployment/pom.xml index 0d2b2e8cae815..033060091eee2 100644 --- a/extensions/smallrye-metrics/deployment/pom.xml +++ b/extensions/smallrye-metrics/deployment/pom.xml @@ -97,6 +97,14 @@ + + maven-surefire-plugin + + + true + + + diff --git a/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/SmallRyeMetricsConfig.java b/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/SmallRyeMetricsConfig.java index 2044df70bda44..13b4d18ff08f2 100644 --- a/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/SmallRyeMetricsConfig.java +++ b/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/SmallRyeMetricsConfig.java @@ -18,6 +18,13 @@ public interface SmallRyeMetricsConfig { @WithDefault("metrics") String path(); + /** + * If the extension should be enabled even if deprecated and scheduled for removal. + */ + @WithName("deprecated.enabled") + @WithDefault("false") + boolean deprecatedEnabled(); + /** * Whether metrics published by Quarkus extensions should be enabled. */ diff --git a/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/SmallRyeMetricsProcessor.java b/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/SmallRyeMetricsProcessor.java index 2c245fe642335..35083d12ca1f7 100644 --- a/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/SmallRyeMetricsProcessor.java +++ b/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/SmallRyeMetricsProcessor.java @@ -53,6 +53,7 @@ import io.quarkus.arc.processor.BuiltinScope; import io.quarkus.arc.processor.DotNames; import io.quarkus.arc.processor.InterceptorInfo; +import io.quarkus.builder.BuildException; import io.quarkus.deployment.Feature; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; @@ -97,7 +98,19 @@ MetricsConfigurationBuildItem metricsConfigurationBuildItem() { } @BuildStep - MetricsCapabilityBuildItem metricsCapabilityBuildItem(NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem) { + MetricsCapabilityBuildItem metricsCapabilityBuildItem(NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem) + throws BuildException { + if (!metrics.deprecatedEnabled()) { + throw new BuildException(""" + The Quarkus SmallRye Metrics is deprecated and will be removed in the near future. Please \ + check our announcement at https://quarkus.io/blog/quarkus-observability-roadmap-2023/. Our \ + recommendation is to migrate to Quarkus Micrometer Metrics \ + https://quarkus.io/guides/telemetry-micrometer. If you wish to keep using Quarkus SmallRye \ + Metrics, please reenable it with the configuration \ + "quarkus.smallrye-metrics.deprecated.enabled=true". + """); + } + if (metrics.extensionsEnabled()) { return new MetricsCapabilityBuildItem(MetricsFactory.MP_METRICS::equals, nonApplicationRootPathBuildItem.resolvePath(metrics.path())); diff --git a/integration-tests/hibernate-orm-panache/src/main/resources/application.properties b/integration-tests/hibernate-orm-panache/src/main/resources/application.properties index 3394a93cdb8dd..951259f89b140 100644 --- a/integration-tests/hibernate-orm-panache/src/main/resources/application.properties +++ b/integration-tests/hibernate-orm-panache/src/main/resources/application.properties @@ -1,3 +1,5 @@ +quarkus.smallrye-metrics.deprecated.enabled=true + quarkus.datasource.db-kind=h2 quarkus.datasource.jdbc.url=jdbc:h2:tcp://localhost/mem:test quarkus.datasource.jdbc.max-size=8 diff --git a/integration-tests/hibernate-orm-panache/src/main/resources/ddlgeneration.properties b/integration-tests/hibernate-orm-panache/src/main/resources/ddlgeneration.properties index c02dcfe11a147..87d02bfb183a9 100644 --- a/integration-tests/hibernate-orm-panache/src/main/resources/ddlgeneration.properties +++ b/integration-tests/hibernate-orm-panache/src/main/resources/ddlgeneration.properties @@ -1,3 +1,5 @@ +quarkus.smallrye-metrics.deprecated.enabled=true + quarkus.datasource.db-kind=h2 quarkus.datasource.jdbc.url=jdbc:h2:tcp://localhost/mem:test quarkus.datasource.jdbc.max-size=8 diff --git a/integration-tests/hibernate-orm-panache/src/main/resources/nopaging.properties b/integration-tests/hibernate-orm-panache/src/main/resources/nopaging.properties index 083896041d5f0..dd8eb252b2cb0 100644 --- a/integration-tests/hibernate-orm-panache/src/main/resources/nopaging.properties +++ b/integration-tests/hibernate-orm-panache/src/main/resources/nopaging.properties @@ -1,3 +1,5 @@ +quarkus.smallrye-metrics.deprecated.enabled=true + quarkus.datasource.db-kind=h2 quarkus.datasource.jdbc.url=jdbc:h2:tcp://localhost/mem:test quarkus.datasource.jdbc.max-size=8 diff --git a/integration-tests/smallrye-metrics/src/main/resources/application.properties b/integration-tests/smallrye-metrics/src/main/resources/application.properties index da1ed9e5f6792..f988badc66d92 100644 --- a/integration-tests/smallrye-metrics/src/main/resources/application.properties +++ b/integration-tests/smallrye-metrics/src/main/resources/application.properties @@ -1 +1,2 @@ +quarkus.smallrye-metrics.deprecated.enabled=true quarkus.log.metrics.enabled=true \ No newline at end of file diff --git a/tcks/microprofile-fault-tolerance/pom.xml b/tcks/microprofile-fault-tolerance/pom.xml index 8909a99d3a0af..d2737f3831b8e 100644 --- a/tcks/microprofile-fault-tolerance/pom.xml +++ b/tcks/microprofile-fault-tolerance/pom.xml @@ -27,6 +27,7 @@ false true true + true diff --git a/tcks/microprofile-metrics/api/pom.xml b/tcks/microprofile-metrics/api/pom.xml index 102b33e284368..daea9600f7723 100644 --- a/tcks/microprofile-metrics/api/pom.xml +++ b/tcks/microprofile-metrics/api/pom.xml @@ -21,6 +21,7 @@ false + true diff --git a/tcks/microprofile-metrics/optional/pom.xml b/tcks/microprofile-metrics/optional/pom.xml index 96ba425f4029b..f33a072401d4f 100644 --- a/tcks/microprofile-metrics/optional/pom.xml +++ b/tcks/microprofile-metrics/optional/pom.xml @@ -25,6 +25,7 @@ / + true diff --git a/tcks/microprofile-metrics/rest/pom.xml b/tcks/microprofile-metrics/rest/pom.xml index 4e8c657d7c74c..5f678d29f1eaf 100644 --- a/tcks/microprofile-metrics/rest/pom.xml +++ b/tcks/microprofile-metrics/rest/pom.xml @@ -23,6 +23,7 @@ false / + true