Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent kafka client-id from being emitted #6781

Open
naumaan123 opened this issue Oct 10, 2024 · 6 comments
Open

Prevent kafka client-id from being emitted #6781

naumaan123 opened this issue Oct 10, 2024 · 6 comments

Comments

@naumaan123
Copy link

naumaan123 commented Oct 10, 2024

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.

@trask
Copy link
Member

trask commented Oct 10, 2024

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:

@naumaan123
Copy link
Author

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

@jack-berg
Copy link
Member

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.

@naumaan123
Copy link
Author

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?

@jack-berg
Copy link
Member

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.

@naumaan123
Copy link
Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants