Honor default enabled for instrumentation modules (#10211)

This commit is contained in:
Lauri Tulmin 2024-01-11 17:49:51 +02:00 committed by GitHub
parent 6ce3bd8c14
commit 3dd0925081
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 6 deletions

View File

@ -23,7 +23,8 @@ public class ApplicationLoggingInstrumentationModule extends InstrumentationModu
@Override @Override
public boolean defaultEnabled(ConfigProperties config) { public boolean defaultEnabled(ConfigProperties config) {
// only enable this instrumentation if the application logger is enabled // only enable this instrumentation if the application logger is enabled
return "application".equals(config.getString("otel.javaagent.logging")); return super.defaultEnabled(config)
&& "application".equals(config.getString("otel.javaagent.logging"));
} }
@Override @Override

View File

@ -39,6 +39,6 @@ public class JaxrsInstrumentationModule extends InstrumentationModule {
// This instrumentation produces controller telemetry and sets http route. Http route is set by // This instrumentation produces controller telemetry and sets http route. Http route is set by
// this instrumentation only when it was not already set by a jax-rs framework instrumentation. // this instrumentation only when it was not already set by a jax-rs framework instrumentation.
// This instrumentation uses complex type matcher, disabling it can improve startup performance. // This instrumentation uses complex type matcher, disabling it can improve startup performance.
return ExperimentalConfig.get().controllerTelemetryEnabled(); return super.defaultEnabled(config) && ExperimentalConfig.get().controllerTelemetryEnabled();
} }
} }

View File

@ -42,6 +42,6 @@ public class JaxrsAnnotationsInstrumentationModule extends InstrumentationModule
// This instrumentation produces controller telemetry and sets http route. Http route is set by // This instrumentation produces controller telemetry and sets http route. Http route is set by
// this instrumentation only when it was not already set by a jax-rs framework instrumentation. // this instrumentation only when it was not already set by a jax-rs framework instrumentation.
// This instrumentation uses complex type matcher, disabling it can improve startup performance. // This instrumentation uses complex type matcher, disabling it can improve startup performance.
return ExperimentalConfig.get().controllerTelemetryEnabled(); return super.defaultEnabled(config) && ExperimentalConfig.get().controllerTelemetryEnabled();
} }
} }

View File

@ -42,6 +42,6 @@ public class JaxrsAnnotationsInstrumentationModule extends InstrumentationModule
// This instrumentation produces controller telemetry and sets http route. Http route is set by // This instrumentation produces controller telemetry and sets http route. Http route is set by
// this instrumentation only when it was not already set by a jax-rs framework instrumentation. // this instrumentation only when it was not already set by a jax-rs framework instrumentation.
// This instrumentation uses complex type matcher, disabling it can improve startup performance. // This instrumentation uses complex type matcher, disabling it can improve startup performance.
return ExperimentalConfig.get().controllerTelemetryEnabled(); return super.defaultEnabled(config) && ExperimentalConfig.get().controllerTelemetryEnabled();
} }
} }

View File

@ -28,6 +28,6 @@ public class JwsInstrumentationModule extends InstrumentationModule {
@Override @Override
public boolean defaultEnabled(ConfigProperties config) { public boolean defaultEnabled(ConfigProperties config) {
// this instrumentation only produces controller telemetry // this instrumentation only produces controller telemetry
return ExperimentalConfig.get().controllerTelemetryEnabled(); return super.defaultEnabled(config) && ExperimentalConfig.get().controllerTelemetryEnabled();
} }
} }

View File

@ -27,6 +27,6 @@ public class SpringWsInstrumentationModule extends InstrumentationModule {
@Override @Override
public boolean defaultEnabled(ConfigProperties config) { public boolean defaultEnabled(ConfigProperties config) {
// this instrumentation only produces controller telemetry // this instrumentation only produces controller telemetry
return ExperimentalConfig.get().controllerTelemetryEnabled(); return super.defaultEnabled(config) && ExperimentalConfig.get().controllerTelemetryEnabled();
} }
} }