opentelemetry-java-instrumentation
opentelemetry-java-instrumentation copied to clipboard
Allow disabling by data type (metrics, logs, traces)
Is your feature request related to a problem? Please describe.
Similar to https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/9481
The Java Agent allows suppressing specific library instrumentation using environment variables or system properties as is very well documented here: https://opentelemetry.io/docs/instrumentation/java/automatic/agent-config/#suppressing-specific-agent-instrumentation
Currently, you can either disable each individual exporter or disable the auto-instrumentation as a whole (otel.instrumentation.common.default.enabled=false
). This means it doesn't support the use case of wanting auto-instrumentation for one data type, but more granular control for another.
In my use case, I'm trying to retain auto-instrumentation for traces, but only enable one instrumentation (jmx
) for metrics. With the current setup, if I enable the metrics exporter, I get a ton of extra metrics that will need to be filtered out by the collector.
Describe the solution you'd like
Add a feature flag that allows users to disable by data type.
Describe alternatives you've considered
Only alternative would be something similar to a Sampler for the metrics. Does that exist? Could metrics be filtered by instrumentation scope?
Additional context
No response
Only alternative would be something similar to a Sampler for the metrics. Does that exist? Could metrics be filtered by instrumentation scope?
Yes! Check out metric views: https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/incubator#view-file-configuration
I am trying to disable tracing from one framework but keep the metrics enabled. would this be possible through the metric view? Or would I need a custom Sampler as suggested here? I was hoping there'd be some configuration-based option, e.g. OTEL_INSTRUMENTATION_<FRAMEWORK>_TRACING_ENABLED: 'false'
This has been automatically marked as stale because it has been marked as needing author feedback and has not had any activity for 7 days. It will be closed automatically if there is no response from the author within 7 additional days from this comment.
Hi @bcarter97! Can you open a separate issue for your question / use case since it's different from the one on this issue?
This has been automatically marked as stale because it has been marked as needing author feedback and has not had any activity for 7 days. It will be closed automatically if there is no response from the author within 7 additional days from this comment.
In case anyone else is trying to do this, the metric view worked. Followed the discussion from https://github.com/open-telemetry/opentelemetry-java-instrumentation/discussions/10284 and ended up with
- selector:
meter_name: io.opentelemetry.jmx
view:
aggregation: default
- selector:
instrument_name: "*"
view:
aggregation: drop
which drops all metrics except for those produced by the JMX Metric Insight instrumentation. Thanks @trask!