From ca599666a9fb5f7ce21443afbe30b16181a83b54 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Tue, 4 Jan 2022 15:50:27 +0200 Subject: [PATCH] Guard against CCE in OTel Vert.x integration Fixes: #22597 --- .../tracing/vertx/OpenTelemetryVertxTracer.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/vertx/OpenTelemetryVertxTracer.java b/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/vertx/OpenTelemetryVertxTracer.java index 5e30cce13e71a..10c9dc8af9244 100644 --- a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/vertx/OpenTelemetryVertxTracer.java +++ b/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/vertx/OpenTelemetryVertxTracer.java @@ -81,6 +81,10 @@ public SpanOperation receiveRequest( final Iterable> headers, final TagExtractor tagExtractor) { + if (!(request instanceof HttpRequest)) { + return null; + } + io.opentelemetry.context.Context parentContext = context.getLocal(ACTIVE_CONTEXT); if (parentContext == null) { parentContext = io.opentelemetry.context.Context.root(); @@ -107,6 +111,10 @@ public void sendResponse( return; } + if (!(response instanceof HttpResponse)) { + return; + } + Scope scope = spanOperation.getScope(); if (scope == null) { return; @@ -130,6 +138,10 @@ public SpanOperation sendRequest( final BiConsumer headers, final TagExtractor tagExtractor) { + if (!(request instanceof HttpRequest)) { + return null; + } + io.opentelemetry.context.Context parentContext = context.getLocal(ACTIVE_CONTEXT); if (parentContext == null) { parentContext = io.opentelemetry.context.Context.root(); @@ -157,6 +169,10 @@ public void receiveResponse( return; } + if (!(response instanceof HttpResponse)) { + return; + } + Scope scope = spanOperation.getScope(); if (scope == null) { return;