open-telemetry / opentelemetry-go

OpenTelemetry Go API and SDK
https://opentelemetry.io/
Apache License 2.0
5.12k stars 1.03k forks source link

Support OTEL_SDK_DISABLED environment variable. #3559

Open jojotong opened 1 year ago

jojotong commented 1 year ago

Problem Statement

https://github.com/open-telemetry/opentelemetry-specification/blob/main/spec-compliance-matrix.md#environment-variables says go library not support OTEL_SDK_DISABLED environment. Do we have a plan to support it ?

dmathieu commented 1 year ago

We will indeed need to implement it, as it's specified. Feel free to let us know if you want to start working on it, or just to open a PR.

MrAlias commented 1 year ago

I don't think this is worth added to the Go implementation. It was added to the specification for languages that may come with auto-instrumented code. The Go implementation requires a user to explicitly setup a tracer provider and then register or directly use it. I don't see much value to adding this, at least not at this stage in the project.

pellared commented 1 year ago

I don't think this is worth added to the Go implementation. It was added to the specification for languages that may come with auto-instrumented code. The Go implementation requires a user to explicitly setup a tracer provider and then register or directly use it. I don't see much value to adding this, at least not at this stage in the project.

  1. It may be still useful for the users so that it could be used as a "feature-toggle" to disable OTel code
  2. How would we want to support it in https://github.com/open-telemetry/opentelemetry-go-instrumentation?
Aneurysm9 commented 1 year ago

We will indeed need to implement it, as it's specified.

All configuration via environment variables is optional. There is no requirement that we support it.

I think I'm with @MrAlias on this, for now. It's not required and can be implemented in a relatively straightforward manner by an application author that finds it necessary by wrapping their SDK initialization in a check of the environment variable. Adding it to the configuration surface area of the SDK is a one-way door that I don't think we need to walk through right now, but we should keep it open to evaluate at a later time.