From f981ad25524d5cf164fcd481491798314944b25a Mon Sep 17 00:00:00 2001 From: jack-berg <34418638+jack-berg@users.noreply.github.com> Date: Thu, 12 Jan 2023 17:35:15 -0600 Subject: [PATCH] Minimize public surface area of OpenTracingShim (#5110) --- .../OpenTracingPropagators.java | 54 --------------- .../OpenTracingPropagatorsBuilder.java | 45 ------------- .../opentracingshim/OpenTracingShim.java | 62 ++++-------------- .../opentracingshim/Propagation.java | 20 +++--- .../opentracingshim/TracerShim.java | 7 +- .../OpenTracingPropagatorsTest.java | 65 ------------------- .../opentracingshim/OpenTracingShimTest.java | 43 +++++------- .../opentracingshim/TracerShimTest.java | 41 +++--------- 8 files changed, 56 insertions(+), 281 deletions(-) delete mode 100644 opentracing-shim/src/main/java/io/opentelemetry/opentracingshim/OpenTracingPropagators.java delete mode 100644 opentracing-shim/src/main/java/io/opentelemetry/opentracingshim/OpenTracingPropagatorsBuilder.java delete mode 100644 opentracing-shim/src/test/java/io/opentelemetry/opentracingshim/OpenTracingPropagatorsTest.java diff --git a/opentracing-shim/src/main/java/io/opentelemetry/opentracingshim/OpenTracingPropagators.java b/opentracing-shim/src/main/java/io/opentelemetry/opentracingshim/OpenTracingPropagators.java deleted file mode 100644 index 1c2fc3ec5c8..00000000000 --- a/opentracing-shim/src/main/java/io/opentelemetry/opentracingshim/OpenTracingPropagators.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.opentracingshim; - -import io.opentelemetry.context.propagation.TextMapPropagator; - -/** - * Container for {@link io.opentracing.propagation.Format.Builtin#TEXT_MAP} and {@link - * io.opentracing.propagation.Format.Builtin#HTTP_HEADERS} format propagators. - * - * @since 1.1.0 - */ -public class OpenTracingPropagators { - private final TextMapPropagator textMapPropagator; - private final TextMapPropagator httpHeadersPropagator; - - OpenTracingPropagators( - TextMapPropagator textMapPropagator, TextMapPropagator httpHeadersPropagator) { - this.textMapPropagator = textMapPropagator; - this.httpHeadersPropagator = httpHeadersPropagator; - } - - /** - * Returns a new builder instance for {@link OpenTracingPropagators}. - * - * @return a new builder instance for {@link OpenTracingPropagators}. - */ - public static OpenTracingPropagatorsBuilder builder() { - return new OpenTracingPropagatorsBuilder(); - } - - /** - * Returns the propagator for {@link io.opentracing.propagation.Format.Builtin#TEXT_MAP} format. - * - * @return the propagator for {@link io.opentracing.propagation.Format.Builtin#TEXT_MAP} format. - */ - public TextMapPropagator textMapPropagator() { - return textMapPropagator; - } - - /** - * Returns the propagator for {@link io.opentracing.propagation.Format.Builtin#HTTP_HEADERS} - * format. - * - * @return the propagator for {@link io.opentracing.propagation.Format.Builtin#HTTP_HEADERS} - * format. - */ - public TextMapPropagator httpHeadersPropagator() { - return httpHeadersPropagator; - } -} diff --git a/opentracing-shim/src/main/java/io/opentelemetry/opentracingshim/OpenTracingPropagatorsBuilder.java b/opentracing-shim/src/main/java/io/opentelemetry/opentracingshim/OpenTracingPropagatorsBuilder.java deleted file mode 100644 index 09c29a70b21..00000000000 --- a/opentracing-shim/src/main/java/io/opentelemetry/opentracingshim/OpenTracingPropagatorsBuilder.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.opentracingshim; - -import io.opentelemetry.api.GlobalOpenTelemetry; -import io.opentelemetry.context.propagation.TextMapPropagator; -import java.util.Objects; - -/** Builder for {@link OpenTracingPropagators}. */ -public class OpenTracingPropagatorsBuilder { - - private TextMapPropagator textMapPropagator = - GlobalOpenTelemetry.getPropagators().getTextMapPropagator(); - private TextMapPropagator httpHeadersPropagator = - GlobalOpenTelemetry.getPropagators().getTextMapPropagator(); - - OpenTracingPropagatorsBuilder() {} - - /** Set propagator for {@link io.opentracing.propagation.Format.Builtin#TEXT_MAP} format. */ - public OpenTracingPropagatorsBuilder setTextMap(TextMapPropagator textMapPropagator) { - Objects.requireNonNull(textMapPropagator, "textMapPropagator"); - this.textMapPropagator = textMapPropagator; - return this; - } - - /** Set propagator for {@link io.opentracing.propagation.Format.Builtin#HTTP_HEADERS} format. */ - public OpenTracingPropagatorsBuilder setHttpHeaders(TextMapPropagator httpHeadersPropagator) { - Objects.requireNonNull(httpHeadersPropagator, "httpHeadersPropagator"); - this.httpHeadersPropagator = httpHeadersPropagator; - return this; - } - - /** - * Constructs a new instance of the {@link OpenTracingPropagators} based on the builder's values. - * If propagators are not set then {@code GlobalOpenTelemetry.getPropagators()} is used. - * - * @return a new Propagators instance. - */ - public OpenTracingPropagators build() { - return new OpenTracingPropagators(textMapPropagator, httpHeadersPropagator); - } -} diff --git a/opentracing-shim/src/main/java/io/opentelemetry/opentracingshim/OpenTracingShim.java b/opentracing-shim/src/main/java/io/opentelemetry/opentracingshim/OpenTracingShim.java index 59403daedea..d8e0a746d65 100644 --- a/opentracing-shim/src/main/java/io/opentelemetry/opentracingshim/OpenTracingShim.java +++ b/opentracing-shim/src/main/java/io/opentelemetry/opentracingshim/OpenTracingShim.java @@ -5,10 +5,9 @@ package io.opentelemetry.opentracingshim; -import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.OpenTelemetry; -import io.opentelemetry.api.trace.Tracer; import io.opentelemetry.api.trace.TracerProvider; +import io.opentelemetry.context.propagation.TextMapPropagator; /** * Factory for creating an OpenTracing {@link io.opentracing.Tracer} that is implemented using the @@ -18,50 +17,16 @@ public final class OpenTracingShim { private OpenTracingShim() {} /** - * Creates a {@code io.opentracing.Tracer} shim out of {@code - * GlobalOpenTelemetry.getTracerProvider()} and {@code GlobalOpenTelemetry.getPropagators()}. - * - * @return a {@code io.opentracing.Tracer}. - */ - public static io.opentracing.Tracer createTracerShim() { - return createTracerShim(getTracer(GlobalOpenTelemetry.getTracerProvider())); - } - - /** - * Creates a {@code io.opentracing.Tracer} shim using provided Tracer instance and {@code - * GlobalOpenTelemetry.getPropagators()}. - * - * @return a {@code io.opentracing.Tracer}. - */ - public static io.opentracing.Tracer createTracerShim(Tracer tracer) { - return createTracerShim(tracer, OpenTracingPropagators.builder().build()); - } - - /** - * Creates a {@code io.opentracing.Tracer} shim using provided Tracer instance and {@code - * OpenTracingPropagators} instance. - * - * @return a {@code io.opentracing.Tracer}. - * @since 1.1.0 - */ - public static io.opentracing.Tracer createTracerShim( - Tracer tracer, OpenTracingPropagators propagators) { - return new TracerShim(tracer, propagators); - } - - /** - * Creates a {@code io.opentracing.Tracer} shim using the provided OpenTelemetry instance. + * Creates a {@code io.opentracing.Tracer} shim using the provided {@link OpenTelemetry} instance. + * Uses the {@link TracerProvider} and {@link TextMapPropagator} associated with the {@link + * OpenTelemetry} instance. * * @param openTelemetry the {@code OpenTelemetry} instance used to create this shim. * @return a {@code io.opentracing.Tracer}. */ public static io.opentracing.Tracer createTracerShim(OpenTelemetry openTelemetry) { - return createTracerShim( - getTracer(openTelemetry.getTracerProvider()), - OpenTracingPropagators.builder() - .setTextMap(openTelemetry.getPropagators().getTextMapPropagator()) - .setHttpHeaders(openTelemetry.getPropagators().getTextMapPropagator()) - .build()); + TextMapPropagator propagator = openTelemetry.getPropagators().getTextMapPropagator(); + return createTracerShim(openTelemetry.getTracerProvider(), propagator, propagator); } /** @@ -69,15 +34,16 @@ public static io.opentracing.Tracer createTracerShim(OpenTelemetry openTelemetry * {@code TextMapPropagator} instance. * * @param provider the {@code TracerProvider} instance used to create this shim. - * @param propagators the {@code OpenTracingPropagators} instance used to create this shim. + * @param textMapPropagator the propagator used for {@link + * io.opentracing.propagation.Format.Builtin#TEXT_MAP} format. + * @param httpPropagator the propagator used for {@link + * io.opentracing.propagation.Format.Builtin#HTTP_HEADERS} format. * @return a {@code io.opentracing.Tracer}. */ public static io.opentracing.Tracer createTracerShim( - TracerProvider provider, OpenTracingPropagators propagators) { - return createTracerShim(getTracer(provider), propagators); - } - - private static Tracer getTracer(TracerProvider tracerProvider) { - return tracerProvider.get("opentracing-shim"); + TracerProvider provider, + TextMapPropagator textMapPropagator, + TextMapPropagator httpPropagator) { + return new TracerShim(provider.get("opentracing-shim"), textMapPropagator, httpPropagator); } } diff --git a/opentracing-shim/src/main/java/io/opentelemetry/opentracingshim/Propagation.java b/opentracing-shim/src/main/java/io/opentelemetry/opentracingshim/Propagation.java index d32541905c0..a9cc5636e90 100644 --- a/opentracing-shim/src/main/java/io/opentelemetry/opentracingshim/Propagation.java +++ b/opentracing-shim/src/main/java/io/opentelemetry/opentracingshim/Propagation.java @@ -20,15 +20,12 @@ final class Propagation { private static final TextMapSetter SETTER_INSTANCE = new TextMapSetter(); private static final TextMapGetter GETTER_INSTANCE = new TextMapGetter(); - private final OpenTracingPropagators propagators; + private final TextMapPropagator textMapPropagator; + private final TextMapPropagator httpPropagator; - Propagation(OpenTracingPropagators propagators) { - this.propagators = propagators; - } - - // Visible for testing - OpenTracingPropagators propagators() { - return propagators; + Propagation(TextMapPropagator textMapPropagator, TextMapPropagator httpPropagator) { + this.textMapPropagator = textMapPropagator; + this.httpPropagator = httpPropagator; } void injectTextMap(SpanContextShim contextShim, Format format, TextMapInject carrier) { @@ -56,11 +53,12 @@ SpanContextShim extractTextMap(Format format, TextMapExtract carrier) { return new SpanContextShim(span.getSpanContext(), baggage); } - private TextMapPropagator getPropagator(Format format) { + // Visible for testing + TextMapPropagator getPropagator(Format format) { if (format == Format.Builtin.HTTP_HEADERS) { - return propagators.httpHeadersPropagator(); + return httpPropagator; } - return propagators.textMapPropagator(); + return textMapPropagator; } static final class TextMapSetter diff --git a/opentracing-shim/src/main/java/io/opentelemetry/opentracingshim/TracerShim.java b/opentracing-shim/src/main/java/io/opentelemetry/opentracingshim/TracerShim.java index 338a70ebe6b..32cbc30e2af 100644 --- a/opentracing-shim/src/main/java/io/opentelemetry/opentracingshim/TracerShim.java +++ b/opentracing-shim/src/main/java/io/opentelemetry/opentracingshim/TracerShim.java @@ -5,6 +5,7 @@ package io.opentelemetry.opentracingshim; +import io.opentelemetry.context.propagation.TextMapPropagator; import io.opentracing.Scope; import io.opentracing.ScopeManager; import io.opentracing.Span; @@ -26,9 +27,11 @@ final class TracerShim implements Tracer { private volatile boolean isClosed; TracerShim( - io.opentelemetry.api.trace.Tracer tracer, OpenTracingPropagators openTracingPropagators) { + io.opentelemetry.api.trace.Tracer tracer, + TextMapPropagator textMapPropagator, + TextMapPropagator httpPropagator) { this.tracer = tracer; - this.propagation = new Propagation(openTracingPropagators); + this.propagation = new Propagation(textMapPropagator, httpPropagator); this.scopeManagerShim = new ScopeManagerShim(); } diff --git a/opentracing-shim/src/test/java/io/opentelemetry/opentracingshim/OpenTracingPropagatorsTest.java b/opentracing-shim/src/test/java/io/opentelemetry/opentracingshim/OpenTracingPropagatorsTest.java deleted file mode 100644 index 2953f9b02b7..00000000000 --- a/opentracing-shim/src/test/java/io/opentelemetry/opentracingshim/OpenTracingPropagatorsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright The OpenTelemetry Authors - * SPDX-License-Identifier: Apache-2.0 - */ - -package io.opentelemetry.opentracingshim; - -import static org.assertj.core.api.Assertions.assertThat; - -import io.opentelemetry.context.propagation.TextMapPropagator; -import org.junit.jupiter.api.Test; - -class OpenTracingPropagatorsTest { - - @Test - public void defaultPropagators() { - OpenTracingPropagators openTracingPropagators = OpenTracingPropagators.builder().build(); - assertThat(openTracingPropagators.textMapPropagator()) - .isSameAs(openTracingPropagators.httpHeadersPropagator()); - } - - @Test - public void textMapPropagator() { - TextMapPropagator textMapPropagator = new CustomTextMapPropagator(); - - OpenTracingPropagators openTracingPropagators = - OpenTracingPropagators.builder().setTextMap(textMapPropagator).build(); - - assertThat(openTracingPropagators.textMapPropagator()) - .isNotSameAs(openTracingPropagators.httpHeadersPropagator()); - - assertThat(openTracingPropagators.textMapPropagator()).isSameAs(textMapPropagator); - } - - @Test - public void httpHeadersPropagator() { - TextMapPropagator httpHeadersPropagator = new CustomTextMapPropagator(); - - OpenTracingPropagators openTracingPropagators = - OpenTracingPropagators.builder().setHttpHeaders(httpHeadersPropagator).build(); - - assertThat(openTracingPropagators.textMapPropagator()) - .isNotSameAs(openTracingPropagators.httpHeadersPropagator()); - - assertThat(openTracingPropagators.httpHeadersPropagator()).isSameAs(httpHeadersPropagator); - } - - @Test - public void bothCustomPropagator() { - TextMapPropagator textMapPropagator = new CustomTextMapPropagator(); - TextMapPropagator httpHeadersPropagator = new CustomTextMapPropagator(); - - OpenTracingPropagators openTracingPropagators = - OpenTracingPropagators.builder() - .setTextMap(textMapPropagator) - .setHttpHeaders(httpHeadersPropagator) - .build(); - - assertThat(openTracingPropagators.textMapPropagator()) - .isNotSameAs(openTracingPropagators.httpHeadersPropagator()); - - assertThat(openTracingPropagators.textMapPropagator()).isSameAs(textMapPropagator); - assertThat(openTracingPropagators.httpHeadersPropagator()).isSameAs(httpHeadersPropagator); - } -} diff --git a/opentracing-shim/src/test/java/io/opentelemetry/opentracingshim/OpenTracingShimTest.java b/opentracing-shim/src/test/java/io/opentelemetry/opentracingshim/OpenTracingShimTest.java index a09d971d532..74189efdbf1 100644 --- a/opentracing-shim/src/test/java/io/opentelemetry/opentracingshim/OpenTracingShimTest.java +++ b/opentracing-shim/src/test/java/io/opentelemetry/opentracingshim/OpenTracingShimTest.java @@ -11,10 +11,11 @@ import io.opentelemetry.api.GlobalOpenTelemetry; import io.opentelemetry.api.OpenTelemetry; -import io.opentelemetry.api.trace.Tracer; +import io.opentelemetry.api.trace.TracerProvider; import io.opentelemetry.context.propagation.ContextPropagators; import io.opentelemetry.context.propagation.TextMapPropagator; import io.opentelemetry.sdk.trace.SdkTracerProvider; +import io.opentracing.propagation.Format; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Test; @@ -25,28 +26,27 @@ void tearDown() { GlobalOpenTelemetry.resetForTest(); } - @Test - void createTracerShim_default() { - TracerShim tracerShim = (TracerShim) OpenTracingShim.createTracerShim(); - assertThat(tracerShim.tracer()).isEqualTo(GlobalOpenTelemetry.getTracer("opentracing-shim")); - } - @Test void createTracerShim_fromOpenTelemetryInstance() { OpenTelemetry openTelemetry = mock(OpenTelemetry.class); SdkTracerProvider sdk = SdkTracerProvider.builder().build(); when(openTelemetry.getTracerProvider()).thenReturn(sdk); + TextMapPropagator textMapPropagator = mock(TextMapPropagator.class); ContextPropagators contextPropagators = mock(ContextPropagators.class); - when(contextPropagators.getTextMapPropagator()).thenReturn(mock(TextMapPropagator.class)); + when(contextPropagators.getTextMapPropagator()).thenReturn(textMapPropagator); when(openTelemetry.getPropagators()).thenReturn(contextPropagators); TracerShim tracerShim = (TracerShim) OpenTracingShim.createTracerShim(openTelemetry); + assertThat(tracerShim.propagation().getPropagator(Format.Builtin.TEXT_MAP)) + .isSameAs(textMapPropagator); + assertThat(tracerShim.propagation().getPropagator(Format.Builtin.HTTP_HEADERS)) + .isSameAs(textMapPropagator); assertThat(tracerShim.tracer()).isEqualTo(sdk.get("opentracing-shim")); } @Test void createTracerShim_withPropagators() { - Tracer tracer = mock(Tracer.class); + TracerProvider tracerProvider = mock(TracerProvider.class); TextMapPropagator textMapPropagator = new CustomTextMapPropagator(); TextMapPropagator httpHeadersPropagator = new CustomTextMapPropagator(); @@ -54,15 +54,11 @@ void createTracerShim_withPropagators() { TracerShim tracerShim = (TracerShim) OpenTracingShim.createTracerShim( - tracer, - OpenTracingPropagators.builder() - .setTextMap(textMapPropagator) - .setHttpHeaders(httpHeadersPropagator) - .build()); + tracerProvider, textMapPropagator, httpHeadersPropagator); - assertThat(tracerShim.propagation().propagators().textMapPropagator()) + assertThat(tracerShim.propagation().getPropagator(Format.Builtin.TEXT_MAP)) .isSameAs(textMapPropagator); - assertThat(tracerShim.propagation().propagators().httpHeadersPropagator()) + assertThat(tracerShim.propagation().getPropagator(Format.Builtin.HTTP_HEADERS)) .isSameAs(httpHeadersPropagator); } @@ -70,18 +66,15 @@ void createTracerShim_withPropagators() { void createTracerShim_withTraceProviderAndPropagator() { TextMapPropagator textMapPropagator = new CustomTextMapPropagator(); TextMapPropagator httpHeadersPropagator = new CustomTextMapPropagator(); - OpenTracingPropagators propagators = - OpenTracingPropagators.builder() - .setTextMap(textMapPropagator) - .setHttpHeaders(httpHeadersPropagator) - .build(); SdkTracerProvider sdk = SdkTracerProvider.builder().build(); - TracerShim tracerShim = (TracerShim) OpenTracingShim.createTracerShim(sdk, propagators); + TracerShim tracerShim = + (TracerShim) + OpenTracingShim.createTracerShim(sdk, textMapPropagator, httpHeadersPropagator); - assertThat(tracerShim.propagation().propagators().httpHeadersPropagator()) - .isSameAs(httpHeadersPropagator); - assertThat(tracerShim.propagation().propagators().textMapPropagator()) + assertThat(tracerShim.propagation().getPropagator(Format.Builtin.TEXT_MAP)) .isSameAs(textMapPropagator); + assertThat(tracerShim.propagation().getPropagator(Format.Builtin.HTTP_HEADERS)) + .isSameAs(httpHeadersPropagator); assertThat(tracerShim.tracer()).isSameAs(sdk.get("opentracing-shim")); } } diff --git a/opentracing-shim/src/test/java/io/opentelemetry/opentracingshim/TracerShimTest.java b/opentracing-shim/src/test/java/io/opentelemetry/opentracingshim/TracerShimTest.java index 5ba79bb7ab5..fafdbca8d87 100644 --- a/opentracing-shim/src/test/java/io/opentelemetry/opentracingshim/TracerShimTest.java +++ b/opentracing-shim/src/test/java/io/opentelemetry/opentracingshim/TracerShimTest.java @@ -11,6 +11,7 @@ import io.opentelemetry.api.baggage.propagation.W3CBaggagePropagator; import io.opentelemetry.api.trace.Tracer; import io.opentelemetry.context.Context; +import io.opentelemetry.context.propagation.TextMapPropagator; import io.opentelemetry.sdk.testing.junit5.OpenTelemetryExtension; import io.opentracing.Scope; import io.opentracing.Span; @@ -44,7 +45,10 @@ class TracerShimTest { @BeforeEach void setUp() { tracer = otelTesting.getOpenTelemetry().getTracer("opentracingshim"); - tracerShim = new TracerShim(tracer, OpenTracingPropagators.builder().build()); + TextMapPropagator propagator = + otelTesting.getOpenTelemetry().getPropagators().getTextMapPropagator(); + ; + tracerShim = new TracerShim(tracer, propagator, propagator); } @Test @@ -274,13 +278,7 @@ void inject_textMap() { Map map = new HashMap<>(); CustomTextMapPropagator textMapPropagator = new CustomTextMapPropagator(); CustomTextMapPropagator httpHeadersPropagator = new CustomTextMapPropagator(); - tracerShim = - new TracerShim( - tracer, - OpenTracingPropagators.builder() - .setTextMap(textMapPropagator) - .setHttpHeaders(httpHeadersPropagator) - .build()); + tracerShim = new TracerShim(tracer, textMapPropagator, httpHeadersPropagator); io.opentelemetry.api.trace.Span span = tracer.spanBuilder("span").startSpan(); SpanContext context = new SpanShim(span).context(); @@ -294,13 +292,7 @@ void inject_httpHeaders() { Map map = new HashMap<>(); CustomTextMapPropagator textMapPropagator = new CustomTextMapPropagator(); CustomTextMapPropagator httpHeadersPropagator = new CustomTextMapPropagator(); - tracerShim = - new TracerShim( - tracer, - OpenTracingPropagators.builder() - .setTextMap(textMapPropagator) - .setHttpHeaders(httpHeadersPropagator) - .build()); + tracerShim = new TracerShim(tracer, textMapPropagator, httpHeadersPropagator); io.opentelemetry.api.trace.Span span = tracer.spanBuilder("span").startSpan(); SpanContext context = new SpanShim(span).context(); @@ -314,13 +306,7 @@ void extract_textMap() { Map map = new HashMap<>(); CustomTextMapPropagator textMapPropagator = new CustomTextMapPropagator(); CustomTextMapPropagator httpHeadersPropagator = new CustomTextMapPropagator(); - tracerShim = - new TracerShim( - tracer, - OpenTracingPropagators.builder() - .setTextMap(textMapPropagator) - .setHttpHeaders(httpHeadersPropagator) - .build()); + tracerShim = new TracerShim(tracer, textMapPropagator, httpHeadersPropagator); tracerShim.extract(Format.Builtin.TEXT_MAP, new TextMapAdapter(map)); assertThat(textMapPropagator.isExtracted()).isTrue(); @@ -332,13 +318,7 @@ void extract_httpHeaders() { Map map = new HashMap<>(); CustomTextMapPropagator textMapPropagator = new CustomTextMapPropagator(); CustomTextMapPropagator httpHeadersPropagator = new CustomTextMapPropagator(); - tracerShim = - new TracerShim( - tracer, - OpenTracingPropagators.builder() - .setTextMap(textMapPropagator) - .setHttpHeaders(httpHeadersPropagator) - .build()); + tracerShim = new TracerShim(tracer, textMapPropagator, httpHeadersPropagator); tracerShim.extract(Format.Builtin.HTTP_HEADERS, new TextMapAdapter(map)); assertThat(textMapPropagator.isExtracted()).isFalse(); @@ -348,8 +328,7 @@ void extract_httpHeaders() { @Test void extract_onlyBaggage() { W3CBaggagePropagator propagator = W3CBaggagePropagator.getInstance(); - tracerShim = - new TracerShim(tracer, OpenTracingPropagators.builder().setTextMap(propagator).build()); + tracerShim = new TracerShim(tracer, propagator, TextMapPropagator.noop()); io.opentelemetry.api.baggage.Baggage baggage = io.opentelemetry.api.baggage.Baggage.builder().put("foo", "bar").build();