diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/config/Config.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/config/Config.java index 12010d79dd42..1dc30b471095 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/config/Config.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/config/Config.java @@ -67,7 +67,7 @@ public static Config get() { if (instance == null) { // this should only happen in library instrumentation // - // no need to synchronize because worst case is creating INSTANCE more than once + // no need to synchronize because worst case is creating instance more than once instance = newBuilder().readEnvironmentVariables().readSystemProperties().build(); } return instance; diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/config/ExperimentalConfig.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/config/ExperimentalConfig.java new file mode 100644 index 000000000000..062acbfb7306 --- /dev/null +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/config/ExperimentalConfig.java @@ -0,0 +1,31 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package io.opentelemetry.instrumentation.api.config; + +public final class ExperimentalConfig { + + private static final ExperimentalConfig instance = new ExperimentalConfig(Config.get()); + + private final Config config; + + /** Returns the global agent configuration. */ + public static ExperimentalConfig get() { + return instance; + } + + public ExperimentalConfig(Config config) { + this.config = config; + } + + public boolean suppressControllerSpans() { + return config.getBoolean( + "otel.instrumentation.common.experimental.suppress-controller-spans", false); + } + + public boolean suppressViewSpans() { + return config.getBoolean("otel.instrumentation.common.experimental.suppress-view-spans", false); + } +} diff --git a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/Instrumenter.java b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/Instrumenter.java index b57ec4791225..bb376600102e 100644 --- a/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/Instrumenter.java +++ b/instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/instrumenter/Instrumenter.java @@ -73,6 +73,7 @@ public static InstrumenterBuilder newBuil private final ErrorCauseExtractor errorCauseExtractor; @Nullable private final StartTimeExtractor startTimeExtractor; @Nullable private final EndTimeExtractor endTimeExtractor; + private final boolean disabled; private final SpanSuppressionStrategy spanSuppressionStrategy; Instrumenter(InstrumenterBuilder builder) { @@ -88,6 +89,7 @@ public static InstrumenterBuilder newBuil this.errorCauseExtractor = builder.errorCauseExtractor; this.startTimeExtractor = builder.startTimeExtractor; this.endTimeExtractor = builder.endTimeExtractor; + this.disabled = builder.disabled; this.spanSuppressionStrategy = builder.getSpanSuppressionStrategy(); } @@ -98,6 +100,9 @@ public static InstrumenterBuilder newBuil * without calling those methods. */ public boolean shouldStart(Context parentContext, REQUEST request) { + if (disabled) { + return false; + } SpanKind spanKind = spanKindExtractor.extract(request); boolean suppressed = spanSuppressionStrategy.shouldSuppress(parentContext, spanKind); 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 02d68e414db0..93535b07239d 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 @@ -55,6 +55,7 @@ public final class InstrumenterBuilder { ErrorCauseExtractor errorCauseExtractor = ErrorCauseExtractor.jdk(); @Nullable StartTimeExtractor startTimeExtractor = null; @Nullable EndTimeExtractor endTimeExtractor = null; + boolean disabled = false; private boolean enableSpanSuppressionByType = ENABLE_SPAN_SUPPRESSION_BY_TYPE; @@ -135,6 +136,11 @@ public InstrumenterBuilder setTimeExtractors( return this; } + public InstrumenterBuilder setDisabled(boolean disabled) { + this.disabled = disabled; + return this; + } + // visible for tests /** * Enables suppression based on client instrumentation type. diff --git a/instrumentation/dropwizard-views-0.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/dropwizardviews/DropwizardSingletons.java b/instrumentation/dropwizard-views-0.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/dropwizardviews/DropwizardSingletons.java index 4acf21401fd9..a64094f3c62e 100644 --- a/instrumentation/dropwizard-views-0.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/dropwizardviews/DropwizardSingletons.java +++ b/instrumentation/dropwizard-views-0.7/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/dropwizardviews/DropwizardSingletons.java @@ -7,6 +7,7 @@ import io.dropwizard.views.View; import io.opentelemetry.api.GlobalOpenTelemetry; +import io.opentelemetry.instrumentation.api.config.ExperimentalConfig; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; public final class DropwizardSingletons { @@ -16,6 +17,7 @@ public final class DropwizardSingletons { private static final Instrumenter INSTRUMENTER = Instrumenter.newBuilder( GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, DropwizardSingletons::spanName) + .setDisabled(ExperimentalConfig.get().suppressControllerSpans()) .newInstrumenter(); private static String spanName(View view) { diff --git a/instrumentation/grails-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grails/GrailsSingletons.java b/instrumentation/grails-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grails/GrailsSingletons.java index 65363c2c8b5c..33e5463005a9 100644 --- a/instrumentation/grails-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grails/GrailsSingletons.java +++ b/instrumentation/grails-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/grails/GrailsSingletons.java @@ -6,6 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.grails; import io.opentelemetry.api.GlobalOpenTelemetry; +import io.opentelemetry.instrumentation.api.config.ExperimentalConfig; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; public final class GrailsSingletons { @@ -17,6 +18,7 @@ public final class GrailsSingletons { INSTRUMENTER = Instrumenter.newBuilder( GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, HandlerData::spanName) + .setDisabled(ExperimentalConfig.get().suppressControllerSpans()) .newInstrumenter(); } diff --git a/instrumentation/jaxrs/jaxrs-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrs/v1_0/JaxrsSingletons.java b/instrumentation/jaxrs/jaxrs-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrs/v1_0/JaxrsSingletons.java index 9bb33780debb..ff586cea4cb9 100644 --- a/instrumentation/jaxrs/jaxrs-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrs/v1_0/JaxrsSingletons.java +++ b/instrumentation/jaxrs/jaxrs-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrs/v1_0/JaxrsSingletons.java @@ -6,6 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.jaxrs.v1_0; import io.opentelemetry.api.GlobalOpenTelemetry; +import io.opentelemetry.instrumentation.api.config.ExperimentalConfig; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor; import io.opentelemetry.instrumentation.api.instrumenter.code.CodeAttributesExtractor; @@ -32,6 +33,7 @@ public final class JaxrsSingletons { Instrumenter.newBuilder( GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, spanNameExtractor) .addAttributesExtractor(codeAttributesExtractor) + .setDisabled(ExperimentalConfig.get().suppressControllerSpans()) .newInstrumenter(); } diff --git a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrs/v2_0/JaxrsSingletons.java b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrs/v2_0/JaxrsSingletons.java index 4cd7632697bc..cc0b0590562a 100644 --- a/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrs/v2_0/JaxrsSingletons.java +++ b/instrumentation/jaxrs/jaxrs-2.0/jaxrs-2.0-common/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxrs/v2_0/JaxrsSingletons.java @@ -6,6 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.jaxrs.v2_0; import io.opentelemetry.api.GlobalOpenTelemetry; +import io.opentelemetry.instrumentation.api.config.ExperimentalConfig; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor; import io.opentelemetry.instrumentation.api.instrumenter.code.CodeAttributesExtractor; @@ -32,6 +33,7 @@ public final class JaxrsSingletons { Instrumenter.newBuilder( GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, spanNameExtractor) .addAttributesExtractor(codeAttributesExtractor) + .setDisabled(ExperimentalConfig.get().suppressControllerSpans()) .newInstrumenter(); } diff --git a/instrumentation/jaxws/jaxws-2.0-axis2-1.6/library/src/main/java/io/opentelemetry/instrumentation/axis2/Axis2Singletons.java b/instrumentation/jaxws/jaxws-2.0-axis2-1.6/library/src/main/java/io/opentelemetry/instrumentation/axis2/Axis2Singletons.java index d1959ac60791..a93f8c2f39f9 100644 --- a/instrumentation/jaxws/jaxws-2.0-axis2-1.6/library/src/main/java/io/opentelemetry/instrumentation/axis2/Axis2Singletons.java +++ b/instrumentation/jaxws/jaxws-2.0-axis2-1.6/library/src/main/java/io/opentelemetry/instrumentation/axis2/Axis2Singletons.java @@ -6,6 +6,7 @@ package io.opentelemetry.instrumentation.axis2; import io.opentelemetry.api.GlobalOpenTelemetry; +import io.opentelemetry.instrumentation.api.config.ExperimentalConfig; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; public class Axis2Singletons { @@ -17,6 +18,7 @@ public class Axis2Singletons { INSTRUMENTER = Instrumenter.newBuilder( GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, Axis2Request::spanName) + .setDisabled(ExperimentalConfig.get().suppressControllerSpans()) .newInstrumenter(); } diff --git a/instrumentation/jaxws/jaxws-2.0-cxf-3.0/library/src/main/java/io/opentelemetry/javaagent/instrumentation/cxf/CxfSingletons.java b/instrumentation/jaxws/jaxws-2.0-cxf-3.0/library/src/main/java/io/opentelemetry/javaagent/instrumentation/cxf/CxfSingletons.java index f5e80dcfa358..df465892be92 100644 --- a/instrumentation/jaxws/jaxws-2.0-cxf-3.0/library/src/main/java/io/opentelemetry/javaagent/instrumentation/cxf/CxfSingletons.java +++ b/instrumentation/jaxws/jaxws-2.0-cxf-3.0/library/src/main/java/io/opentelemetry/javaagent/instrumentation/cxf/CxfSingletons.java @@ -6,6 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.cxf; import io.opentelemetry.api.GlobalOpenTelemetry; +import io.opentelemetry.instrumentation.api.config.ExperimentalConfig; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; public class CxfSingletons { @@ -17,6 +18,7 @@ public class CxfSingletons { INSTRUMENTER = Instrumenter.newBuilder( GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, CxfRequest::spanName) + .setDisabled(ExperimentalConfig.get().suppressControllerSpans()) .newInstrumenter(); } diff --git a/instrumentation/jaxws/jaxws-2.0-metro-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/metro/MetroSingletons.java b/instrumentation/jaxws/jaxws-2.0-metro-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/metro/MetroSingletons.java index fba41b2014bd..52830bf8cfbe 100644 --- a/instrumentation/jaxws/jaxws-2.0-metro-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/metro/MetroSingletons.java +++ b/instrumentation/jaxws/jaxws-2.0-metro-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/metro/MetroSingletons.java @@ -6,6 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.metro; import io.opentelemetry.api.GlobalOpenTelemetry; +import io.opentelemetry.instrumentation.api.config.ExperimentalConfig; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; public class MetroSingletons { @@ -17,6 +18,7 @@ public class MetroSingletons { INSTRUMENTER = Instrumenter.newBuilder( GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, MetroRequest::spanName) + .setDisabled(ExperimentalConfig.get().suppressControllerSpans()) .newInstrumenter(); } diff --git a/instrumentation/jaxws/jaxws-common/library/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxws/common/JaxWsSingletons.java b/instrumentation/jaxws/jaxws-common/library/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxws/common/JaxWsSingletons.java index ef66d5aa7ab0..0632a9a19c68 100644 --- a/instrumentation/jaxws/jaxws-common/library/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxws/common/JaxWsSingletons.java +++ b/instrumentation/jaxws/jaxws-common/library/src/main/java/io/opentelemetry/javaagent/instrumentation/jaxws/common/JaxWsSingletons.java @@ -6,6 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.jaxws.common; import io.opentelemetry.api.GlobalOpenTelemetry; +import io.opentelemetry.instrumentation.api.config.ExperimentalConfig; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor; import io.opentelemetry.instrumentation.api.instrumenter.code.CodeAttributesExtractor; @@ -24,6 +25,7 @@ public class JaxWsSingletons { Instrumenter.newBuilder( GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, JaxWsRequest::spanName) .addAttributesExtractor(codeAttributes) + .setDisabled(ExperimentalConfig.get().suppressControllerSpans()) .newInstrumenter(); } diff --git a/instrumentation/jsf/mojarra-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mojarra/MojarraSingletons.java b/instrumentation/jsf/mojarra-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mojarra/MojarraSingletons.java index e54f71724e11..2aa78eebda1b 100644 --- a/instrumentation/jsf/mojarra-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mojarra/MojarraSingletons.java +++ b/instrumentation/jsf/mojarra-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/mojarra/MojarraSingletons.java @@ -6,6 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.mojarra; import io.opentelemetry.api.GlobalOpenTelemetry; +import io.opentelemetry.instrumentation.api.config.ExperimentalConfig; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.jsf.JsfErrorCauseExtractor; import io.opentelemetry.instrumentation.jsf.JsfRequest; @@ -20,6 +21,7 @@ public class MojarraSingletons { Instrumenter.newBuilder( GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, JsfRequest::spanName) .setErrorCauseExtractor(new JsfErrorCauseExtractor()) + .setDisabled(ExperimentalConfig.get().suppressControllerSpans()) .newInstrumenter(); } diff --git a/instrumentation/jsf/myfaces-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/myfaces/MyFacesSingletons.java b/instrumentation/jsf/myfaces-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/myfaces/MyFacesSingletons.java index 842910680b4a..e8383fe71706 100644 --- a/instrumentation/jsf/myfaces-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/myfaces/MyFacesSingletons.java +++ b/instrumentation/jsf/myfaces-1.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/myfaces/MyFacesSingletons.java @@ -6,6 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.myfaces; import io.opentelemetry.api.GlobalOpenTelemetry; +import io.opentelemetry.instrumentation.api.config.ExperimentalConfig; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.jsf.JsfRequest; @@ -19,6 +20,7 @@ public class MyFacesSingletons { Instrumenter.newBuilder( GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, JsfRequest::spanName) .setErrorCauseExtractor(new MyFacesErrorCauseExtractor()) + .setDisabled(ExperimentalConfig.get().suppressControllerSpans()) .newInstrumenter(); } diff --git a/instrumentation/spring/spring-webflux-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/server/WebfluxSingletons.java b/instrumentation/spring/spring-webflux-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/server/WebfluxSingletons.java index 39a16fd452ea..84fc3ce13f36 100644 --- a/instrumentation/spring/spring-webflux-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/server/WebfluxSingletons.java +++ b/instrumentation/spring/spring-webflux-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/webflux/server/WebfluxSingletons.java @@ -6,6 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.spring.webflux.server; import io.opentelemetry.api.GlobalOpenTelemetry; +import io.opentelemetry.instrumentation.api.config.ExperimentalConfig; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder; import io.opentelemetry.javaagent.instrumentation.spring.webflux.SpringWebfluxConfig; @@ -24,7 +25,8 @@ public final class WebfluxSingletons { builder.addAttributesExtractor(new ExperimentalAttributesExtractor()); } - INSTRUMENTER = builder.newInstrumenter(); + INSTRUMENTER = + builder.setDisabled(ExperimentalConfig.get().suppressControllerSpans()).newInstrumenter(); } public static Instrumenter instrumenter() { diff --git a/instrumentation/spring/spring-webmvc-3.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/springwebmvc/SpringWebMvcSingletons.java b/instrumentation/spring/spring-webmvc-3.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/springwebmvc/SpringWebMvcSingletons.java index f3bca44f5422..a2939a93c237 100644 --- a/instrumentation/spring/spring-webmvc-3.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/springwebmvc/SpringWebMvcSingletons.java +++ b/instrumentation/spring/spring-webmvc-3.1/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/springwebmvc/SpringWebMvcSingletons.java @@ -6,6 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.springwebmvc; import io.opentelemetry.api.GlobalOpenTelemetry; +import io.opentelemetry.instrumentation.api.config.ExperimentalConfig; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import org.springframework.web.servlet.ModelAndView; @@ -20,6 +21,7 @@ public final class SpringWebMvcSingletons { HANDLER_INSTRUMENTER = Instrumenter.newBuilder( GlobalOpenTelemetry.get(), INSTRUMENTATION_NAME, new HandlerSpanNameExtractor()) + .setDisabled(ExperimentalConfig.get().suppressControllerSpans()) .newInstrumenter(); MODEL_AND_VIEW_INSTRUMENTER = @@ -28,6 +30,7 @@ public final class SpringWebMvcSingletons { INSTRUMENTATION_NAME, new ModelAndViewSpanNameExtractor()) .addAttributesExtractor(new ModelAndViewAttributesExtractor()) + .setDisabled(ExperimentalConfig.get().suppressViewSpans()) .newInstrumenter(); } diff --git a/instrumentation/spring/spring-ws-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/ws/SpringWsSingletons.java b/instrumentation/spring/spring-ws-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/ws/SpringWsSingletons.java index e1fcdd6490e1..1a3e16a3113e 100644 --- a/instrumentation/spring/spring-ws-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/ws/SpringWsSingletons.java +++ b/instrumentation/spring/spring-ws-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/ws/SpringWsSingletons.java @@ -6,6 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.spring.ws; import io.opentelemetry.api.GlobalOpenTelemetry; +import io.opentelemetry.instrumentation.api.config.ExperimentalConfig; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.code.CodeAttributesExtractor; import io.opentelemetry.instrumentation.api.instrumenter.code.CodeSpanNameExtractor; @@ -24,6 +25,7 @@ public class SpringWsSingletons { INSTRUMENTATION_NAME, CodeSpanNameExtractor.create(codeAttributes)) .addAttributesExtractor(codeAttributes) + .setDisabled(ExperimentalConfig.get().suppressControllerSpans()) .newInstrumenter(); } diff --git a/instrumentation/struts-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/struts2/StrutsSingletons.java b/instrumentation/struts-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/struts2/StrutsSingletons.java index fae0a36f0af7..edfa993a9726 100644 --- a/instrumentation/struts-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/struts2/StrutsSingletons.java +++ b/instrumentation/struts-2.3/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/struts2/StrutsSingletons.java @@ -7,6 +7,7 @@ import com.opensymphony.xwork2.ActionInvocation; import io.opentelemetry.api.GlobalOpenTelemetry; +import io.opentelemetry.instrumentation.api.config.ExperimentalConfig; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import io.opentelemetry.instrumentation.api.instrumenter.code.CodeAttributesExtractor; import io.opentelemetry.instrumentation.api.instrumenter.code.CodeSpanNameExtractor; @@ -25,6 +26,7 @@ public class StrutsSingletons { INSTRUMENTATION_NAME, CodeSpanNameExtractor.create(codeAttributes)) .addAttributesExtractor(codeAttributes) + .setDisabled(ExperimentalConfig.get().suppressControllerSpans()) .newInstrumenter(); } diff --git a/instrumentation/tapestry-5.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/tapestry/TapestrySingletons.java b/instrumentation/tapestry-5.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/tapestry/TapestrySingletons.java index db1d0f818219..d6323c918535 100644 --- a/instrumentation/tapestry-5.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/tapestry/TapestrySingletons.java +++ b/instrumentation/tapestry-5.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/tapestry/TapestrySingletons.java @@ -6,6 +6,7 @@ package io.opentelemetry.javaagent.instrumentation.tapestry; import io.opentelemetry.api.GlobalOpenTelemetry; +import io.opentelemetry.instrumentation.api.config.ExperimentalConfig; import io.opentelemetry.instrumentation.api.instrumenter.ErrorCauseExtractor; import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; import org.apache.tapestry5.runtime.ComponentEventException; @@ -26,6 +27,7 @@ public class TapestrySingletons { } return ErrorCauseExtractor.jdk().extractCause(error); }) + .setDisabled(ExperimentalConfig.get().suppressControllerSpans()) .newInstrumenter(); }