From 0374b7d3abb496154d6c876f79123f10a01e817e Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Mon, 23 Oct 2023 11:57:50 +0200 Subject: [PATCH 1/6] Creating ByContextKey SpanSuppressor --- .../api/instrumenter/SpanSuppressors.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressors.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressors.java index 0867f4b2febb..4aa4c16a7055 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressors.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressors.java @@ -9,6 +9,7 @@ import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.SpanKind; import io.opentelemetry.context.Context; +import io.opentelemetry.context.ContextKey; import io.opentelemetry.instrumentation.api.internal.SpanKey; import java.util.Map; import java.util.Set; @@ -85,4 +86,24 @@ public boolean shouldSuppress(Context parentContext, SpanKind spanKind) { return true; } } + + static class ByContextKey implements SpanSuppressor { + private final SpanSuppressor delegate; + private static final ContextKey SUPPRESS_INSTRUMENTATION = ContextKey.named("suppress_instrumentation"); + + ByContextKey(SpanSuppressor delegate) {this.delegate = delegate;} + + @Override + public Context storeInContext(Context context, SpanKind spanKind, Span span) { + return delegate.storeInContext(context, spanKind, span); + } + + @Override + public boolean shouldSuppress(Context parentContext, SpanKind spanKind) { + if(Boolean.TRUE.equals(parentContext.get(SUPPRESS_INSTRUMENTATION))) { + return true; + } + return delegate.shouldSuppress(parentContext, spanKind); + } + } } From 4d2817fca8138c2cb96919339e16964e10c006b7 Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Mon, 23 Oct 2023 12:04:54 +0200 Subject: [PATCH 2/6] Wrapping non-NOOP span suppressors with ByContextKey span suppressor --- .../api/instrumenter/SpanSuppressionStrategy.java | 10 +++++----- .../api/instrumenter/SpanSuppressors.java | 9 ++++++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressionStrategy.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressionStrategy.java index 6210a74c8154..88a3f6a111ff 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressionStrategy.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressionStrategy.java @@ -8,6 +8,7 @@ import static java.util.Collections.singleton; import io.opentelemetry.api.trace.SpanKind; +import io.opentelemetry.instrumentation.api.instrumenter.SpanSuppressors.ByContextKey; import io.opentelemetry.instrumentation.api.instrumenter.SpanSuppressors.BySpanKey; import io.opentelemetry.instrumentation.api.instrumenter.SpanSuppressors.DelegateBySpanKind; import io.opentelemetry.instrumentation.api.instrumenter.SpanSuppressors.Noop; @@ -44,7 +45,7 @@ SpanSuppressor create(Set spanKeys) { delegates.put(SpanKind.CLIENT, new BySpanKey(singleton(SpanKey.KIND_CLIENT))); delegates.put(SpanKind.CONSUMER, new BySpanKey(singleton(SpanKey.KIND_CONSUMER))); delegates.put(SpanKind.PRODUCER, new BySpanKey(singleton(SpanKey.KIND_PRODUCER))); - strategy = new DelegateBySpanKind(delegates); + strategy = new ByContextKey(new DelegateBySpanKind(delegates)); } @Override @@ -65,10 +66,9 @@ SpanSuppressor create(Set spanKeys) { SEMCONV { @Override SpanSuppressor create(Set spanKeys) { - if (spanKeys.isEmpty()) { - return Noop.INSTANCE; - } - return new BySpanKey(spanKeys); + SpanSuppressor instance = (spanKeys.isEmpty()) ? Noop.INSTANCE : new BySpanKey(spanKeys); + + return new ByContextKey(instance); } }; diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressors.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressors.java index 4aa4c16a7055..af9360cb885b 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressors.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressors.java @@ -89,9 +89,12 @@ public boolean shouldSuppress(Context parentContext, SpanKind spanKind) { static class ByContextKey implements SpanSuppressor { private final SpanSuppressor delegate; - private static final ContextKey SUPPRESS_INSTRUMENTATION = ContextKey.named("suppress_instrumentation"); + private static final ContextKey SUPPRESS_INSTRUMENTATION = + ContextKey.named("suppress_instrumentation"); - ByContextKey(SpanSuppressor delegate) {this.delegate = delegate;} + ByContextKey(SpanSuppressor delegate) { + this.delegate = delegate; + } @Override public Context storeInContext(Context context, SpanKind spanKind, Span span) { @@ -100,7 +103,7 @@ public Context storeInContext(Context context, SpanKind spanKind, Span span) { @Override public boolean shouldSuppress(Context parentContext, SpanKind spanKind) { - if(Boolean.TRUE.equals(parentContext.get(SUPPRESS_INSTRUMENTATION))) { + if (Boolean.TRUE.equals(parentContext.get(SUPPRESS_INSTRUMENTATION))) { return true; } return delegate.shouldSuppress(parentContext, spanKind); From b16da68d9e6b6c6529a8c94b34f12edd91ac983c Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Mon, 23 Oct 2023 12:11:31 +0200 Subject: [PATCH 3/6] Wrapping all span suppressors with ByContextKey --- .../api/instrumenter/InstrumenterBuilder.java | 3 ++- .../api/instrumenter/SpanSuppressionStrategy.java | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBuilder.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBuilder.java index ff1f5d08539a..df9516f1e8be 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBuilder.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBuilder.java @@ -5,6 +5,7 @@ package io.opentelemetry.instrumentation.api.instrumenter; +import static io.opentelemetry.instrumentation.api.instrumenter.SpanSuppressors.*; import static java.util.Objects.requireNonNull; import static java.util.logging.Level.WARNING; @@ -354,7 +355,7 @@ private String getSchemaUrl() { } SpanSuppressor buildSpanSuppressor() { - return spanSuppressionStrategy.create(getSpanKeysFromAttributesExtractors()); + return new ByContextKey(spanSuppressionStrategy.create(getSpanKeysFromAttributesExtractors())); } private Set getSpanKeysFromAttributesExtractors() { diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressionStrategy.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressionStrategy.java index 88a3f6a111ff..6210a74c8154 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressionStrategy.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressionStrategy.java @@ -8,7 +8,6 @@ import static java.util.Collections.singleton; import io.opentelemetry.api.trace.SpanKind; -import io.opentelemetry.instrumentation.api.instrumenter.SpanSuppressors.ByContextKey; import io.opentelemetry.instrumentation.api.instrumenter.SpanSuppressors.BySpanKey; import io.opentelemetry.instrumentation.api.instrumenter.SpanSuppressors.DelegateBySpanKind; import io.opentelemetry.instrumentation.api.instrumenter.SpanSuppressors.Noop; @@ -45,7 +44,7 @@ SpanSuppressor create(Set spanKeys) { delegates.put(SpanKind.CLIENT, new BySpanKey(singleton(SpanKey.KIND_CLIENT))); delegates.put(SpanKind.CONSUMER, new BySpanKey(singleton(SpanKey.KIND_CONSUMER))); delegates.put(SpanKind.PRODUCER, new BySpanKey(singleton(SpanKey.KIND_PRODUCER))); - strategy = new ByContextKey(new DelegateBySpanKind(delegates)); + strategy = new DelegateBySpanKind(delegates); } @Override @@ -66,9 +65,10 @@ SpanSuppressor create(Set spanKeys) { SEMCONV { @Override SpanSuppressor create(Set spanKeys) { - SpanSuppressor instance = (spanKeys.isEmpty()) ? Noop.INSTANCE : new BySpanKey(spanKeys); - - return new ByContextKey(instance); + if (spanKeys.isEmpty()) { + return Noop.INSTANCE; + } + return new BySpanKey(spanKeys); } }; From 831e1eb1f82914463261c9a8a21fbf860e256919 Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Mon, 23 Oct 2023 13:43:57 +0200 Subject: [PATCH 4/6] Adding verification --- .../api/instrumenter/InstrumenterBuilder.java | 3 +- .../api/instrumenter/SpanSuppressors.java | 7 +++-- .../SpanSuppressionStrategyTest.java | 28 +++++++++++++++++++ 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBuilder.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBuilder.java index df9516f1e8be..6e944dee070e 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBuilder.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBuilder.java @@ -5,7 +5,6 @@ package io.opentelemetry.instrumentation.api.instrumenter; -import static io.opentelemetry.instrumentation.api.instrumenter.SpanSuppressors.*; import static java.util.Objects.requireNonNull; import static java.util.logging.Level.WARNING; @@ -355,7 +354,7 @@ private String getSchemaUrl() { } SpanSuppressor buildSpanSuppressor() { - return new ByContextKey(spanSuppressionStrategy.create(getSpanKeysFromAttributesExtractors())); + return new SpanSuppressors.ByContextKey(spanSuppressionStrategy.create(getSpanKeysFromAttributesExtractors())); } private Set getSpanKeysFromAttributesExtractors() { diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressors.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressors.java index af9360cb885b..813b15baf31d 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressors.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressors.java @@ -12,6 +12,7 @@ import io.opentelemetry.context.ContextKey; import io.opentelemetry.instrumentation.api.internal.SpanKey; import java.util.Map; +import java.util.Objects; import java.util.Set; final class SpanSuppressors { @@ -89,8 +90,8 @@ public boolean shouldSuppress(Context parentContext, SpanKind spanKind) { static class ByContextKey implements SpanSuppressor { private final SpanSuppressor delegate; - private static final ContextKey SUPPRESS_INSTRUMENTATION = - ContextKey.named("suppress_instrumentation"); + static final ContextKey SUPPRESS_INSTRUMENTATION = + ContextKey.named("suppress_instrumentation");//todo must use the key defined in the Java SDK. ByContextKey(SpanSuppressor delegate) { this.delegate = delegate; @@ -103,7 +104,7 @@ public Context storeInContext(Context context, SpanKind spanKind, Span span) { @Override public boolean shouldSuppress(Context parentContext, SpanKind spanKind) { - if (Boolean.TRUE.equals(parentContext.get(SUPPRESS_INSTRUMENTATION))) { + if (Objects.equals(parentContext.get(SUPPRESS_INSTRUMENTATION), true)) { return true; } return delegate.shouldSuppress(parentContext, spanKind); diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressionStrategyTest.java b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressionStrategyTest.java index 1593c4efde82..9a75d80fbf47 100644 --- a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressionStrategyTest.java +++ b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressionStrategyTest.java @@ -5,6 +5,7 @@ package io.opentelemetry.instrumentation.api.instrumenter; +import static io.opentelemetry.instrumentation.api.instrumenter.SpanSuppressors.ByContextKey.SUPPRESS_INSTRUMENTATION; import static java.util.Arrays.asList; import static java.util.Collections.emptySet; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -157,4 +158,31 @@ void semconv_shouldNotSuppressContextWithPartiallyDifferentSpanKeys() { assertFalse(suppressor.shouldSuppress(context, SpanKind.SERVER)); } + + @Test + void context_shouldSuppressWhenKeyIsAvailableAndTrue() { + Context context = Context.current().with(SUPPRESS_INSTRUMENTATION, true); + SpanSuppressor suppressor = + new SpanSuppressors.ByContextKey(SpanSuppressionStrategy.NONE.create(emptySet())); + + assertTrue(suppressor.shouldSuppress(context, SpanKind.CLIENT)); + } + + @Test + void context_shouldNotSuppressWhenKeyIsAvailableAndFalse() { + Context context = Context.current().with(SUPPRESS_INSTRUMENTATION, false); + SpanSuppressor suppressor = + new SpanSuppressors.ByContextKey(SpanSuppressionStrategy.NONE.create(emptySet())); + + assertFalse(suppressor.shouldSuppress(context, SpanKind.CLIENT)); + } + + @Test + void context_shouldNotSuppressWhenKeyIsNotAvailable() { + Context context = Context.current(); + SpanSuppressor suppressor = + new SpanSuppressors.ByContextKey(SpanSuppressionStrategy.NONE.create(emptySet())); + + assertFalse(suppressor.shouldSuppress(context, SpanKind.CLIENT)); + } } From a0680dff535bb4f85b34f998452f95aa7ee2be29 Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Mon, 23 Oct 2023 13:44:27 +0200 Subject: [PATCH 5/6] Spotless --- .../instrumentation/api/instrumenter/InstrumenterBuilder.java | 3 ++- .../instrumentation/api/instrumenter/SpanSuppressors.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBuilder.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBuilder.java index 6e944dee070e..8c68cd0890d4 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBuilder.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/InstrumenterBuilder.java @@ -354,7 +354,8 @@ private String getSchemaUrl() { } SpanSuppressor buildSpanSuppressor() { - return new SpanSuppressors.ByContextKey(spanSuppressionStrategy.create(getSpanKeysFromAttributesExtractors())); + return new SpanSuppressors.ByContextKey( + spanSuppressionStrategy.create(getSpanKeysFromAttributesExtractors())); } private Set getSpanKeysFromAttributesExtractors() { diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressors.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressors.java index 813b15baf31d..f9de40bb8049 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressors.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressors.java @@ -91,7 +91,8 @@ public boolean shouldSuppress(Context parentContext, SpanKind spanKind) { static class ByContextKey implements SpanSuppressor { private final SpanSuppressor delegate; static final ContextKey SUPPRESS_INSTRUMENTATION = - ContextKey.named("suppress_instrumentation");//todo must use the key defined in the Java SDK. + ContextKey.named( + "suppress_instrumentation"); // todo must use the key defined in the Java SDK. ByContextKey(SpanSuppressor delegate) { this.delegate = delegate; From eacfbc21c1107b5e905d6de86edae879ad8e773f Mon Sep 17 00:00:00 2001 From: Cesar Munoz <56847527+LikeTheSalad@users.noreply.github.com> Date: Thu, 16 Nov 2023 11:02:30 +0100 Subject: [PATCH 6/6] Suppressing by context key through reflection --- instrumentation-api/build.gradle.kts | 1 + .../api/instrumenter/SpanSuppressors.java | 32 +++++++++++++++---- .../SpanSuppressionStrategyTest.java | 21 ++++-------- 3 files changed, 34 insertions(+), 20 deletions(-) diff --git a/instrumentation-api/build.gradle.kts b/instrumentation-api/build.gradle.kts index b3b901763645..876742ff1043 100644 --- a/instrumentation-api/build.gradle.kts +++ b/instrumentation-api/build.gradle.kts @@ -20,6 +20,7 @@ dependencies { testImplementation(project(":testing-common")) testImplementation("io.opentelemetry:opentelemetry-sdk-testing") + testImplementation("io.opentelemetry:opentelemetry-exporter-common") testImplementation("org.junit-pioneer:junit-pioneer") jmhImplementation(project(":instrumentation-api-semconv")) diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressors.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressors.java index f9de40bb8049..14748f778338 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressors.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressors.java @@ -9,10 +9,10 @@ import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.SpanKind; import io.opentelemetry.context.Context; -import io.opentelemetry.context.ContextKey; import io.opentelemetry.instrumentation.api.internal.SpanKey; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.Map; -import java.util.Objects; import java.util.Set; final class SpanSuppressors { @@ -90,12 +90,20 @@ public boolean shouldSuppress(Context parentContext, SpanKind spanKind) { static class ByContextKey implements SpanSuppressor { private final SpanSuppressor delegate; - static final ContextKey SUPPRESS_INSTRUMENTATION = - ContextKey.named( - "suppress_instrumentation"); // todo must use the key defined in the Java SDK. + private final Method shouldSuppressInstrumentation; ByContextKey(SpanSuppressor delegate) { this.delegate = delegate; + Method shouldSuppressInstrumentation; + try { + Class instrumentationUtil = + Class.forName("io.opentelemetry.exporter.internal.InstrumentationUtil"); + shouldSuppressInstrumentation = + instrumentationUtil.getDeclaredMethod("shouldSuppressInstrumentation", Context.class); + } catch (ClassNotFoundException | NoSuchMethodException e) { + shouldSuppressInstrumentation = null; + } + this.shouldSuppressInstrumentation = shouldSuppressInstrumentation; } @Override @@ -105,10 +113,22 @@ public Context storeInContext(Context context, SpanKind spanKind, Span span) { @Override public boolean shouldSuppress(Context parentContext, SpanKind spanKind) { - if (Objects.equals(parentContext.get(SUPPRESS_INSTRUMENTATION), true)) { + if (suppressByContextKey(parentContext)) { return true; } return delegate.shouldSuppress(parentContext, spanKind); } + + private boolean suppressByContextKey(Context context) { + if (shouldSuppressInstrumentation == null) { + return false; + } + + try { + return (boolean) shouldSuppressInstrumentation.invoke(null, context); + } catch (IllegalAccessException | InvocationTargetException e) { + return false; + } + } } } diff --git a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressionStrategyTest.java b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressionStrategyTest.java index 9a75d80fbf47..6ec5d802f874 100644 --- a/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressionStrategyTest.java +++ b/instrumentation-api/src/test/java/io/opentelemetry/instrumentation/api/instrumenter/SpanSuppressionStrategyTest.java @@ -5,7 +5,6 @@ package io.opentelemetry.instrumentation.api.instrumenter; -import static io.opentelemetry.instrumentation.api.instrumenter.SpanSuppressors.ByContextKey.SUPPRESS_INSTRUMENTATION; import static java.util.Arrays.asList; import static java.util.Collections.emptySet; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -17,6 +16,7 @@ import io.opentelemetry.api.trace.Span; import io.opentelemetry.api.trace.SpanKind; import io.opentelemetry.context.Context; +import io.opentelemetry.exporter.internal.InstrumentationUtil; import io.opentelemetry.instrumentation.api.internal.SpanKey; import java.util.HashSet; import java.util.Set; @@ -161,20 +161,13 @@ void semconv_shouldNotSuppressContextWithPartiallyDifferentSpanKeys() { @Test void context_shouldSuppressWhenKeyIsAvailableAndTrue() { - Context context = Context.current().with(SUPPRESS_INSTRUMENTATION, true); - SpanSuppressor suppressor = - new SpanSuppressors.ByContextKey(SpanSuppressionStrategy.NONE.create(emptySet())); + InstrumentationUtil.suppressInstrumentation( + () -> { + SpanSuppressor suppressor = + new SpanSuppressors.ByContextKey(SpanSuppressionStrategy.NONE.create(emptySet())); - assertTrue(suppressor.shouldSuppress(context, SpanKind.CLIENT)); - } - - @Test - void context_shouldNotSuppressWhenKeyIsAvailableAndFalse() { - Context context = Context.current().with(SUPPRESS_INSTRUMENTATION, false); - SpanSuppressor suppressor = - new SpanSuppressors.ByContextKey(SpanSuppressionStrategy.NONE.create(emptySet())); - - assertFalse(suppressor.shouldSuppress(context, SpanKind.CLIENT)); + assertTrue(suppressor.shouldSuppress(Context.current(), SpanKind.CLIENT)); + }); } @Test