opentelemetry-demo icon indicating copy to clipboard operation
opentelemetry-demo copied to clipboard

Make it possible to disable OpenTelemetry Instrumentation

Open svrnm opened this issue 2 years ago • 2 comments

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(); })

svrnm avatar Dec 21 '22 10:12 svrnm

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)

svrnm avatar Jan 09 '23 12:01 svrnm

This seems like a bug in the node.js sample.

Flarna avatar Jan 10 '23 08:01 Flarna