open-telemetry / opentelemetry-java-instrumentation

OpenTelemetry auto-instrumentation and instrumentation libraries for Java
https://opentelemetry.io
Apache License 2.0
1.79k stars 782 forks source link

Alter instrumentation suppression behavior #11640

Open laurit opened 1 week ago

laurit commented 1 week ago

Resolves https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/11635 Currently instrumentation that is enabled by default will be disabled if otel.instrumentation.[name].enabled flag is false for any of the names given for the instrumentation, even if the flag is true for some of the names. This PR alters the behavior so that instrumentation is enabled or disabled based on the value otel.instrumentation.[name].enabled for the first instrumentation name where the value is set, if it isn't set then the default value will be used. This allows using otel.instrumentation.kafka-clients-metrics.enabled=true otel.instrumentation.kafka-clients.enabled=false to enable only the kafka metrics instrumentation and disable the rest.