From 849b9885395e4b698a0c03213e2599d759621fb8 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Fri, 3 Sep 2021 11:28:21 +0300 Subject: [PATCH] Fix use of OpenTelemetry OTLP exporter in native mode Essentially the fact that ClientTracingFilter was using a static field for TextMapPropagator was causing GraalVM to initialize the entire telemetry infrastructure at build time Fixes: #19877 --- .../restclient/ClientTracingFilter.java | 2 +- .../resteasy-reactive-rest-client/pom.xml | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/restclient/ClientTracingFilter.java b/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/restclient/ClientTracingFilter.java index 9d34efb149b28..5f43898887b75 100644 --- a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/restclient/ClientTracingFilter.java +++ b/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/restclient/ClientTracingFilter.java @@ -26,7 +26,7 @@ @Priority(Priorities.HEADER_DECORATOR) public class ClientTracingFilter implements ClientRequestFilter, ClientResponseFilter { - private static final TextMapPropagator TEXT_MAP_PROPAGATOR = GlobalOpenTelemetry.getPropagators().getTextMapPropagator(); + private final TextMapPropagator TEXT_MAP_PROPAGATOR = GlobalOpenTelemetry.getPropagators().getTextMapPropagator(); private static final String SCOPE_KEY = ClientTracingFilter.class.getName() + ".scope"; private static final String SPAN_KEY = ClientTracingFilter.class.getName() + ".span"; diff --git a/integration-tests/resteasy-reactive-rest-client/pom.xml b/integration-tests/resteasy-reactive-rest-client/pom.xml index 2d8b52256bea0..00b80a5053e23 100644 --- a/integration-tests/resteasy-reactive-rest-client/pom.xml +++ b/integration-tests/resteasy-reactive-rest-client/pom.xml @@ -31,6 +31,11 @@ io.quarkus quarkus-opentelemetry + + + io.quarkus + quarkus-opentelemetry-exporter-otlp + @@ -99,6 +104,19 @@ + + io.quarkus + quarkus-opentelemetry-exporter-otlp-deployment + ${project.version} + pom + test + + + * + * + + +