open-telemetry / opentelemetry-java-instrumentation

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

Enable opentelemetry-api and opentelemetry-instrumentation-annotations even when default-enabled is false #7201

Open trask opened 1 year ago

trask commented 1 year ago

Based on @laurit's suggestion https://cloud-native.slack.com/archives/C0150QF88FL/p1668593837751519?thread_ts=1668521229.495469&cid=C0150QF88FL

This has been a source of confusion on multiple occasions.

also related: https://opentelemetry.io/docs/instrumentation/java/automatic/agent-config/#enable-manual-instrumentation-only

tylerbenson commented 1 year ago

I agree that the api integration should always be enabled. The @WithSpan integration can actually add a fair bit of startup overhead due to the way it must inspect the classes, so I think there is benefit in allowing it to be disabled along with other integrations.

lesterhaynes commented 8 months ago

+1 to this suggestion

I hit up against this while trying to write some instrumentation. I'm trying to use a workflow where I attach an intelliJ Remote JVM debugger to a locally deployed application running the java agent. In this way I'm able to step through my own code with breakpoints and inspect whether or not the context remains alive in the current thread. This wasn't working for me and I felt like I was losing my mind because I remembered it working before. Wasn't clear until I read https://github.com/open-telemetry/opentelemetry-java-instrumentation/discussions/7485 that disabling opentelemetry-api was the cause.