@@ -394,21 +394,19 @@ SpanSuppressor buildSpanSuppressor() {
394394 @ Nullable
395395 private String getSpanSuppressionStrategy () {
396396 // we cannot use DeclarativeConfigUtil here because it's not available in instrumentation-api
397- if (maybeDeclarativeConfig (openTelemetry )) {
397+ DeclarativeConfigProperties commonConfig = empty ();
398+ if (openTelemetry instanceof ExtendedOpenTelemetry ) {
398399 DeclarativeConfigProperties instrumentationConfig =
399400 ((ExtendedOpenTelemetry ) openTelemetry ).getConfigProvider ().getInstrumentationConfig ();
400- if (instrumentationConfig == null ) {
401- return null ;
401+ if (instrumentationConfig != null ) {
402+ commonConfig =
403+ instrumentationConfig .getStructured ("java" , empty ()).getStructured ("common" , empty ());
402404 }
403-
404- return instrumentationConfig
405- .getStructured ("java" , empty ())
406- .getStructured ("common" , empty ())
407- .getString ("span_suppression_strategy/development" );
408- } else {
409- return ConfigPropertiesUtil .getString (
410- "otel.instrumentation.experimental.span-suppression-strategy" );
411405 }
406+ return commonConfig .getString (
407+ "span_suppression_strategy/development" ,
408+ ConfigPropertiesUtil .getString (
409+ "otel.instrumentation.experimental.span-suppression-strategy" ));
412410 }
413411
414412 private Set <SpanKey > getSpanKeysFromAttributesExtractors () {
@@ -488,15 +486,6 @@ public void setSpanStatusExtractorCustomizer(
488486 }
489487 }
490488
491- /**
492- * Returns true if the current classpath supports declarative config and the instance may support
493- * declarative config (the agent implements ExtendedOpenTelemetry even when declarative config
494- * isn't used).
495- */
496- private static boolean maybeDeclarativeConfig (OpenTelemetry openTelemetry ) {
497- return supportsDeclarativeConfig && openTelemetry instanceof ExtendedOpenTelemetry ;
498- }
499-
500489 private interface InstrumenterConstructor <RQ , RS > {
501490 Instrumenter <RQ , RS > create (InstrumenterBuilder <RQ , RS > builder );
502491
0 commit comments