opentelemetry-demo
opentelemetry-demo copied to clipboard
Make it possible to disable OpenTelemetry Instrumentation
Feature Request
Is your feature request related to a problem?
#589, #606 and some other issues ask for the capability to autoinstrument services, especially by using the otel operator which comes with the capability to inject Automatic Instrumentation. While creating new services which are then auto instrumented is a possibility, I'd like to propose another solution:
By making it possibile to disable manual OpenTelemetry instrumentation, it would be possible to apply injected automatic instrumentation via the operator instead.
This not only removes the need to add even more services, it also allows has a few other benefits:
- You could "gradually" instrument your application and see how a full picture builds, or you could leave a certain service un-instrumented on purpose to see what information you still get from an upstream service.
- from a vendor perspective I could use my existing APM agents instead and have a way to compare what I see with OpenTelemetry and what I see with my existing solution.
Describe the solution you'd like:
My naive assumption is that this might be fairly easy to implement:
- Add an environment variable like
OTEL_DO_NOT_INSTRUMENT="true"
- In the code of a service, put the SDK initalisation into a condiational block that checks for the value of that (
if(!env.OTEL_DO_NOT_INSTRUMENT) { intializeSDK(); }
)
follow up on this, I have played around with this in this branch:
- Java (ad-service, frauddetection-service) works just fine without the agent
- NodeJS (frontend, paymentservice) fail with a lot of errors, because the API returns
undefined
as spans if the SDK is not loaded (see https://github.com/open-telemetry/opentelemetry-js/issues/3316, cc @open-telemetry/javascript-approvers)
This seems like a bug in the node.js sample.