Prevent kafka `client-id` from being emitted
I have a spring boot app auto configured with opentelemetry, and am using kafka to send some messages. I am attempting to prevent some attributes/metrics from being emitted such as client-id and kafka.producer.io_ratio. Here is a sample of a properties file
otel.experimental.resource.disabled-keys=client-id,kafka.producer.io_ratio
I am not getting the expected results. I may have a fundamental misunderstanding of this prop as it seems to work for some other attributes, can someone point out what im doing wrong? I also tried creating a view-config.yml file and had the below
- selector:
instrument_name: kafka.producer.io_ratio
views:
aggregation: drop
but this seemed to disable all sorts of tracing and the entire kafka metrics.
hi @naumaan123,
otel.experimental.resource.disabled-keys=client-id,kafka.producer.io_ratio
this won't work because those are metric attributes (as opposed to resource attributes)
here's some links that may help:
- https://github.com/open-telemetry/opentelemetry-java-instrumentation/discussions/12395
- https://github.com/open-telemetry/opentelemetry-java-examples/tree/main/javaagent
Thanks for the links, this is close to what im looking for. For the view configs to disable metrics, whats the appropriate system property to set, these 3 seem to be setup similarly if i want to disable specific metrics from kafka for example
otel.config.file
otel.experimental.config.file
otel.experimental.metrics.view-config
Best case for now is to use otel.experimental.metrics.view-config. Documentation available here.
We're actively working towards stringing the final pieces together that would allow you to use otel.experimental.config.file in the java agent. Documentation available here. This is currently blocked on this PR, and should be available in the upcoming release of opentelemetry-java-instrumentation.
Appreciate the followup. It seems like otel.experimental.metrics.view-config doesn't allow removing/excluding attribute_keys, only the declarative configuration, am i reading that correcting?
No it does support that. The example from the docs is setting the list of attributes to retain. Any not in that set are excluded. The declarative config solution is more expressive, supporting both disallow and allow lists, but they achieve the same affect.
Gotcha. I guess for me that would be overly complex since i simply want to filter out a single attribute and kafka has tons id have to account for. This is a legacy ssytem im working in so i dont want to accidentally drop attributes that are being used. Ill likely wait until the declaritive configuration is ready. Thanks!
Closing as declarative config is now available in the java agent.