Skip to content

Commit

Permalink
Guard against CCE in OTel Vert.x integration
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand committed Jan 4, 2022
1 parent 5ba71b2 commit ca59966
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ public <R> SpanOperation receiveRequest(
final Iterable<Map.Entry<String, String>> headers,
final TagExtractor<R> 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();
Expand All @@ -107,6 +111,10 @@ public <R> void sendResponse(
return;
}

if (!(response instanceof HttpResponse)) {
return;
}

Scope scope = spanOperation.getScope();
if (scope == null) {
return;
Expand All @@ -130,6 +138,10 @@ public <R> SpanOperation sendRequest(
final BiConsumer<String, String> headers,
final TagExtractor<R> 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();
Expand Down Expand Up @@ -157,6 +169,10 @@ public <R> void receiveResponse(
return;
}

if (!(response instanceof HttpResponse)) {
return;
}

Scope scope = spanOperation.getScope();
if (scope == null) {
return;
Expand Down

0 comments on commit ca59966

Please sign in to comment.