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

Allow to disable kafka-clients only while keep kafka-clients-metrics enabled #11635

Open pandaji opened 1 week ago

pandaji commented 1 week ago

Is your feature request related to a problem? Please describe.

After #9518, we have kafka-clients module for tracing and kafka-clients-metrics module for metrics collection. This is good work! However, when I tried to disable only the kafka-clients module, by setting OTEL_INSTRUMENTATION_KAFKA_CLIENTS_ENABLED=false, the metric instrumentation module is disabled too.

It seems impossible to disable only the kafka-clients module while keeping kafka-clients-metrics module enabled because kafka-clients module defines a subset of instrumentation names in kafka-clients-metrics module

Describe the solution you'd like

Add a distinct instrumentation alias to kafka-clients module so we can disable only the tracing for kafka clients, while continue collecting kafka metrics.

Should be pretty straight forward. Thanks in advance!

Describe alternatives you've considered

For now the workaround is to set OTEL_INSTRUMENTATION_COMMON_DEFAULT_ENABLED=false and OTEL_INSTRUMENTATION_KAFKA_CLIENTS_METRICS_ENABLED=true. However, this turns off a bunch of other useful modules which have to be turned on manually as well.

Additional context

No response