From fffb6cb5f90afaf20b9f80d89244004a8b25eb4a Mon Sep 17 00:00:00 2001 From: brunobat Date: Mon, 21 Oct 2024 10:57:20 +0100 Subject: [PATCH] Micrometer exemplars on HTTP --- .../deployment/MicrometerProcessor.java | 10 ++++++ .../export/PrometheusRegistryProcessor.java | 8 +++-- .../binder/vertx/VertxHttpServerMetrics.java | 20 ++++++++--- .../binder/vertx/VertxMeterBinderAdapter.java | 11 ++++-- .../vertx/VertxMeterBinderRecorder.java | 7 ++-- .../EmptyExemplarSamplerProvider.java | 2 +- ...OpenTelemetryExemplarContextUnwrapper.java | 16 +++++++++ .../OpenTelemetryContextUnwrapper.java | 18 ++++++++++ ...OpenTelemetryExemplarContextUnwrapper.java | 31 ++++++++++++++++ .../OpentelemetryExemplarSamplerProvider.java | 2 +- .../prometheus/ExemplarOffTest.java | 34 ++++++++++++++++++ .../micrometer/prometheus/ExemplarTest.java | 35 +++++++++++++++++++ .../micrometer/prometheus/OtelOffProfile.java | 16 +++++++++ .../micrometer/prometheus/OtelOnProfile.java | 16 +++++++++ 14 files changed, 213 insertions(+), 13 deletions(-) rename extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/{ => exemplars}/EmptyExemplarSamplerProvider.java (83%) create mode 100644 extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/exemplars/NoopOpenTelemetryExemplarContextUnwrapper.java create mode 100644 extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/exemplars/OpenTelemetryContextUnwrapper.java create mode 100644 extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/exemplars/OpenTelemetryExemplarContextUnwrapper.java rename extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/{ => exemplars}/OpentelemetryExemplarSamplerProvider.java (96%) create mode 100644 integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/ExemplarOffTest.java create mode 100644 integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/ExemplarTest.java create mode 100644 integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/OtelOffProfile.java create mode 100644 integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/OtelOnProfile.java diff --git a/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/MicrometerProcessor.java b/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/MicrometerProcessor.java index 8ae781a2d7e43..0fa56ac6a302f 100644 --- a/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/MicrometerProcessor.java +++ b/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/MicrometerProcessor.java @@ -58,6 +58,7 @@ import io.quarkus.micrometer.runtime.MicrometerRecorder; import io.quarkus.micrometer.runtime.MicrometerTimedInterceptor; import io.quarkus.micrometer.runtime.config.MicrometerConfig; +import io.quarkus.micrometer.runtime.export.exemplars.NoopOpenTelemetryExemplarContextUnwrapper; import io.quarkus.runtime.RuntimeValue; import io.quarkus.runtime.metrics.MetricsFactory; import io.quarkus.vertx.http.deployment.NonApplicationRootPathBuildItem; @@ -93,6 +94,15 @@ MetricsCapabilityBuildItem metricsCapabilityBuildItem() { null); } + @BuildStep(onlyIfNot = PrometheusRegistryProcessor.PrometheusEnabled.class) + void registerEmptyExamplarProvider( + BuildProducer additionalBeans) { + additionalBeans.produce(AdditionalBeanBuildItem.builder() + .addBeanClass(NoopOpenTelemetryExemplarContextUnwrapper.class) + .setUnremovable() + .build()); + } + @BuildStep(onlyIf = { PrometheusRegistryProcessor.PrometheusEnabled.class }) MetricsCapabilityBuildItem metricsCapabilityPrometheusBuildItem( NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem) { diff --git a/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/export/PrometheusRegistryProcessor.java b/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/export/PrometheusRegistryProcessor.java index 10ed43b3dca42..405ebd2be7dca 100644 --- a/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/export/PrometheusRegistryProcessor.java +++ b/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/export/PrometheusRegistryProcessor.java @@ -16,9 +16,11 @@ import io.quarkus.micrometer.runtime.MicrometerRecorder; import io.quarkus.micrometer.runtime.config.MicrometerConfig; import io.quarkus.micrometer.runtime.config.PrometheusConfigGroup; -import io.quarkus.micrometer.runtime.export.EmptyExemplarSamplerProvider; -import io.quarkus.micrometer.runtime.export.OpentelemetryExemplarSamplerProvider; import io.quarkus.micrometer.runtime.export.PrometheusRecorder; +import io.quarkus.micrometer.runtime.export.exemplars.EmptyExemplarSamplerProvider; +import io.quarkus.micrometer.runtime.export.exemplars.NoopOpenTelemetryExemplarContextUnwrapper; +import io.quarkus.micrometer.runtime.export.exemplars.OpenTelemetryExemplarContextUnwrapper; +import io.quarkus.micrometer.runtime.export.exemplars.OpentelemetryExemplarSamplerProvider; import io.quarkus.vertx.http.deployment.NonApplicationRootPathBuildItem; import io.quarkus.vertx.http.deployment.RouteBuildItem; import io.quarkus.vertx.http.runtime.management.ManagementInterfaceBuildTimeConfig; @@ -73,6 +75,7 @@ void registerOpentelemetryExemplarSamplerProvider( BuildProducer additionalBeans) { additionalBeans.produce(AdditionalBeanBuildItem.builder() .addBeanClass(OpentelemetryExemplarSamplerProvider.class) + .addBeanClass(OpenTelemetryExemplarContextUnwrapper.class) .setUnremovable() .build()); } @@ -82,6 +85,7 @@ void registerEmptyExamplarProvider( BuildProducer additionalBeans) { additionalBeans.produce(AdditionalBeanBuildItem.builder() .addBeanClass(EmptyExemplarSamplerProvider.class) + .addBeanClass(NoopOpenTelemetryExemplarContextUnwrapper.class) .setUnremovable() .build()); } diff --git a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxHttpServerMetrics.java b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxHttpServerMetrics.java index a7993195d294a..9b9cebe55007b 100644 --- a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxHttpServerMetrics.java +++ b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxHttpServerMetrics.java @@ -20,6 +20,7 @@ import io.quarkus.micrometer.runtime.HttpServerMetricsTagsContributor; import io.quarkus.micrometer.runtime.binder.HttpBinderConfiguration; import io.quarkus.micrometer.runtime.binder.HttpCommonTags; +import io.quarkus.micrometer.runtime.export.exemplars.OpenTelemetryContextUnwrapper; import io.vertx.core.http.HttpMethod; import io.vertx.core.http.HttpServerRequest; import io.vertx.core.http.ServerWebSocket; @@ -40,6 +41,7 @@ public class VertxHttpServerMetrics extends VertxTcpServerMetrics static final Logger log = Logger.getLogger(VertxHttpServerMetrics.class); HttpBinderConfiguration config; + OpenTelemetryContextUnwrapper openTelemetryContextUnwrapper; final LongAdder activeRequests; @@ -49,9 +51,12 @@ public class VertxHttpServerMetrics extends VertxTcpServerMetrics private final List httpServerMetricsTagsContributors; - VertxHttpServerMetrics(MeterRegistry registry, HttpBinderConfiguration config) { + VertxHttpServerMetrics(MeterRegistry registry, + HttpBinderConfiguration config, + OpenTelemetryContextUnwrapper openTelemetryContextUnwrapper) { super(registry, "http.server", null); this.config = config; + this.openTelemetryContextUnwrapper = openTelemetryContextUnwrapper; activeRequests = new LongAdder(); Gauge.builder(config.getHttpServerActiveRequestsName(), activeRequests, LongAdder::doubleValue) @@ -164,12 +169,14 @@ public void requestReset(HttpRequestMetric requestMetric) { if (path != null) { Timer.Sample sample = requestMetric.getSample(); - sample.stop(requestsTimer - .withTags(Tags.of( + openTelemetryContextUnwrapper.executeInContext( + sample::stop, + requestsTimer.withTags(Tags.of( VertxMetricsTags.method(requestMetric.request().method()), HttpCommonTags.uri(path, requestMetric.initialPath, 0), Outcome.CLIENT_ERROR.asTag(), - HttpCommonTags.STATUS_RESET))); + HttpCommonTags.STATUS_RESET)), + requestMetric.request().context()); } requestMetric.requestEnded(); } @@ -207,7 +214,10 @@ public void responseEnd(HttpRequestMetric requestMetric, HttpResponse response, } } - sample.stop(requestsTimer.withTags(allTags)); + openTelemetryContextUnwrapper.executeInContext( + sample::stop, + requestsTimer.withTags(allTags), + requestMetric.request().context()); } requestMetric.requestEnded(); } diff --git a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxMeterBinderAdapter.java b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxMeterBinderAdapter.java index 473f4bf0a1be5..6b9b7625de565 100644 --- a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxMeterBinderAdapter.java +++ b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxMeterBinderAdapter.java @@ -11,6 +11,7 @@ import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.Tags; import io.quarkus.micrometer.runtime.binder.HttpBinderConfiguration; +import io.quarkus.micrometer.runtime.export.exemplars.OpenTelemetryContextUnwrapper; import io.quarkus.vertx.http.runtime.ExtendedQuarkusVertxHttpMetrics; import io.vertx.core.VertxOptions; import io.vertx.core.datagram.DatagramSocketOptions; @@ -37,11 +38,14 @@ public class VertxMeterBinderAdapter extends MetricsOptions public static final String METRIC_NAME_SEPARATOR = "|"; private HttpBinderConfiguration httpBinderConfiguration; + private OpenTelemetryContextUnwrapper openTelemetryContextUnwrapper; public VertxMeterBinderAdapter() { } - void setHttpConfig(HttpBinderConfiguration httpBinderConfiguration) { + void initBinder(HttpBinderConfiguration httpBinderConfiguration, + OpenTelemetryContextUnwrapper openTelemetryContextUnwrapper) { + this.openTelemetryContextUnwrapper = openTelemetryContextUnwrapper; this.httpBinderConfiguration = httpBinderConfiguration; } @@ -70,9 +74,12 @@ public MetricsOptions newOptions() { if (httpBinderConfiguration == null) { throw new NoStackTraceException("HttpBinderConfiguration was not found"); } + if (openTelemetryContextUnwrapper == null) { + throw new NoStackTraceException("OpenTelemetryContextUnwrapper was not found"); + } if (httpBinderConfiguration.isServerEnabled()) { log.debugf("Create HttpServerMetrics with options %s and address %s", options, localAddress); - return new VertxHttpServerMetrics(Metrics.globalRegistry, httpBinderConfiguration); + return new VertxHttpServerMetrics(Metrics.globalRegistry, httpBinderConfiguration, openTelemetryContextUnwrapper); } return null; } diff --git a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxMeterBinderRecorder.java b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxMeterBinderRecorder.java index 37b02d95ae654..151fae9c61d23 100644 --- a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxMeterBinderRecorder.java +++ b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/vertx/VertxMeterBinderRecorder.java @@ -6,6 +6,7 @@ import io.quarkus.arc.Arc; import io.quarkus.micrometer.runtime.binder.HttpBinderConfiguration; +import io.quarkus.micrometer.runtime.export.exemplars.OpenTelemetryContextUnwrapper; import io.quarkus.runtime.LaunchMode; import io.quarkus.runtime.annotations.Recorder; import io.vertx.core.VertxOptions; @@ -30,18 +31,20 @@ public void accept(VertxOptions vertxOptions) { /* RUNTIME_INIT */ public void configureBinderAdapter() { HttpBinderConfiguration httpConfig = Arc.container().instance(HttpBinderConfiguration.class).get(); + OpenTelemetryContextUnwrapper openTelemetryContextUnwrapper = Arc.container() + .instance(OpenTelemetryContextUnwrapper.class).get(); if (LaunchMode.current() == LaunchMode.DEVELOPMENT) { if (devModeConfig == null) { // Create an object whose attributes we can update devModeConfig = httpConfig.unwrap(); - binderAdapter.setHttpConfig(devModeConfig); + binderAdapter.initBinder(devModeConfig, openTelemetryContextUnwrapper); } else { // update config attributes devModeConfig.update(httpConfig); } } else { // unwrap the CDI bean (use POJO) - binderAdapter.setHttpConfig(httpConfig.unwrap()); + binderAdapter.initBinder(httpConfig.unwrap(), openTelemetryContextUnwrapper); } } } diff --git a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/EmptyExemplarSamplerProvider.java b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/exemplars/EmptyExemplarSamplerProvider.java similarity index 83% rename from extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/EmptyExemplarSamplerProvider.java rename to extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/exemplars/EmptyExemplarSamplerProvider.java index 46dc7a94978d4..876f2cb7ffce9 100644 --- a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/EmptyExemplarSamplerProvider.java +++ b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/exemplars/EmptyExemplarSamplerProvider.java @@ -1,4 +1,4 @@ -package io.quarkus.micrometer.runtime.export; +package io.quarkus.micrometer.runtime.export.exemplars; import java.util.Optional; diff --git a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/exemplars/NoopOpenTelemetryExemplarContextUnwrapper.java b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/exemplars/NoopOpenTelemetryExemplarContextUnwrapper.java new file mode 100644 index 0000000000000..dd9980efc666c --- /dev/null +++ b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/exemplars/NoopOpenTelemetryExemplarContextUnwrapper.java @@ -0,0 +1,16 @@ +package io.quarkus.micrometer.runtime.export.exemplars; + +import java.util.function.Function; + +import jakarta.enterprise.context.Dependent; + +import io.vertx.core.Context; + +@Dependent +public class NoopOpenTelemetryExemplarContextUnwrapper implements OpenTelemetryContextUnwrapper { + + @Override + public R executeInContext(Function methodReference, P parameter, Context requestContext) { + return methodReference.apply(parameter);// pass through + } +} diff --git a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/exemplars/OpenTelemetryContextUnwrapper.java b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/exemplars/OpenTelemetryContextUnwrapper.java new file mode 100644 index 0000000000000..f01fee0723052 --- /dev/null +++ b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/exemplars/OpenTelemetryContextUnwrapper.java @@ -0,0 +1,18 @@ +package io.quarkus.micrometer.runtime.export.exemplars; + +import java.util.function.Function; + +public interface OpenTelemetryContextUnwrapper { + /** + * Called when an HTTP server response has ended. + * Makes sure exemplars are produced because they have an OTel context. + * + * @param methodReference Ex: Sample stop method reference + * @param parameter The parameter to pass to the method + * @param requestContext The request context + * @param

The parameter type is a type of metric, ex: Timer + * @param The return type of the method pointed by the methodReference + * @return The result of the method + */ + R executeInContext(Function methodReference, P parameter, io.vertx.core.Context requestContext); +} diff --git a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/exemplars/OpenTelemetryExemplarContextUnwrapper.java b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/exemplars/OpenTelemetryExemplarContextUnwrapper.java new file mode 100644 index 0000000000000..68ac7d6765a5d --- /dev/null +++ b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/exemplars/OpenTelemetryExemplarContextUnwrapper.java @@ -0,0 +1,31 @@ +package io.quarkus.micrometer.runtime.export.exemplars; + +import java.util.function.Function; + +import jakarta.enterprise.context.Dependent; + +import io.opentelemetry.context.Context; +import io.opentelemetry.context.Scope; +import io.quarkus.opentelemetry.runtime.QuarkusContextStorage; + +@Dependent +public class OpenTelemetryExemplarContextUnwrapper implements OpenTelemetryContextUnwrapper { + + @Override + public R executeInContext(Function methodReference, P parameter, io.vertx.core.Context requestContext) { + if (requestContext == null) { + return methodReference.apply(parameter); + } + + Context newContext = QuarkusContextStorage.getContext(requestContext); + + if (newContext == null) { + return methodReference.apply(parameter); + } + + io.opentelemetry.context.Context oldContext = QuarkusContextStorage.INSTANCE.current(); + try (Scope scope = QuarkusContextStorage.INSTANCE.attach(newContext)) { + return methodReference.apply(parameter); + } + } +} diff --git a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/OpentelemetryExemplarSamplerProvider.java b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/exemplars/OpentelemetryExemplarSamplerProvider.java similarity index 96% rename from extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/OpentelemetryExemplarSamplerProvider.java rename to extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/exemplars/OpentelemetryExemplarSamplerProvider.java index d99131fb7831b..4a6e87a29d9f7 100644 --- a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/OpentelemetryExemplarSamplerProvider.java +++ b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/export/exemplars/OpentelemetryExemplarSamplerProvider.java @@ -1,4 +1,4 @@ -package io.quarkus.micrometer.runtime.export; +package io.quarkus.micrometer.runtime.export.exemplars; import java.util.Optional; import java.util.function.Function; diff --git a/integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/ExemplarOffTest.java b/integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/ExemplarOffTest.java new file mode 100644 index 0000000000000..d46a50539b618 --- /dev/null +++ b/integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/ExemplarOffTest.java @@ -0,0 +1,34 @@ +package io.quarkus.it.micrometer.prometheus; + +import static io.restassured.RestAssured.get; +import static io.restassured.RestAssured.when; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.awaitility.Awaitility.await; +import static org.junit.jupiter.api.Assertions.assertFalse; + +import org.junit.jupiter.api.Test; + +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.TestProfile; + +/** + * See Micrometer Guide + */ +@QuarkusTest +@TestProfile(OtelOffProfile.class) +public class ExemplarOffTest { + + @Test + void testExemplar() { + when().get("/example/prime/257").then().statusCode(200); + when().get("/example/prime/7919").then().statusCode(200); + + String metricMatch = "http_server_requests_seconds_count{dummy=\"value\",env=\"test\"," + + "env2=\"test\",foo=\"UNSET\",method=\"GET\",outcome=\"SUCCESS\"," + + "registry=\"prometheus\",status=\"200\",uri=\"/example/prime/{number}\"} 2.0 # {span_id=\""; + + await().atMost(5, SECONDS).untilAsserted(() -> { + assertFalse(get("/q/metrics").then().extract().asString().contains(metricMatch)); + }); + } +} diff --git a/integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/ExemplarTest.java b/integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/ExemplarTest.java new file mode 100644 index 0000000000000..50e94d6220ae0 --- /dev/null +++ b/integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/ExemplarTest.java @@ -0,0 +1,35 @@ +package io.quarkus.it.micrometer.prometheus; + +import static io.restassured.RestAssured.get; +import static io.restassured.RestAssured.when; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.awaitility.Awaitility.await; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; + +import io.quarkus.test.junit.QuarkusTest; +import io.quarkus.test.junit.TestProfile; + +/** + * See Micrometer Guide + */ +@QuarkusTest +@TestProfile(OtelOnProfile.class) +public class ExemplarTest { + + @Test + void testExemplar() { + when().get("/example/prime/257").then().statusCode(200); + when().get("/example/prime/7919").then().statusCode(200); + + String metricMatch = "http_server_requests_seconds_count{dummy=\"value\",env=\"test\"," + + "env2=\"test\",foo=\"UNSET\",method=\"GET\",outcome=\"SUCCESS\"," + + "registry=\"prometheus\",status=\"200\",uri=\"/example/prime/{number}\"} 2.0 # {span_id=\""; + + await().atMost(5, SECONDS).untilAsserted(() -> { + String body = get("/q/metrics").then().extract().asString(); + assertTrue(body.contains(metricMatch), body); + }); + } +} diff --git a/integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/OtelOffProfile.java b/integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/OtelOffProfile.java new file mode 100644 index 0000000000000..d0b00c7a6e76d --- /dev/null +++ b/integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/OtelOffProfile.java @@ -0,0 +1,16 @@ +package io.quarkus.it.micrometer.prometheus; + +import java.util.HashMap; +import java.util.Map; + +import io.quarkus.test.junit.QuarkusTestProfile; + +public class OtelOffProfile implements QuarkusTestProfile { + + @Override + public Map getConfigOverrides() { + Map config = new HashMap<>(Map.of( + "quarkus.otel.enabled", "false")); + return config; + } +} diff --git a/integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/OtelOnProfile.java b/integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/OtelOnProfile.java new file mode 100644 index 0000000000000..7d6e9084af52b --- /dev/null +++ b/integration-tests/micrometer-prometheus/src/test/java/io/quarkus/it/micrometer/prometheus/OtelOnProfile.java @@ -0,0 +1,16 @@ +package io.quarkus.it.micrometer.prometheus; + +import java.util.HashMap; +import java.util.Map; + +import io.quarkus.test.junit.QuarkusTestProfile; + +public class OtelOnProfile implements QuarkusTestProfile { + + @Override + public Map getConfigOverrides() { + Map config = new HashMap<>(Map.of( + "quarkus.otel.enabled", "true")); + return config; + } +}