Disable opentelemetry-go based on a flag #2659
Replies: 4 comments 5 replies
-
OpenTelemetry will default all spans creation to noop unless another tracer provider is included. For example, in the named tracer example, if you don't call the As for performance of the noop provider, the impact should be minimal. You can see how the provider and spans work there: https://github.com/open-telemetry/opentelemetry-go/blob/main/trace/noop.go |
Beta Was this translation helpful? Give feedback.
-
Hi @dmathieu, Thanks for your suggestion. |
Beta Was this translation helpful? Give feedback.
-
@Ajaykumarkolipaka Did you manage to solve this ? I am looking for exactly same thing. |
Beta Was this translation helpful? Give feedback.
-
a little bit late, but try: // in func SetupOTelSDK
if(traceEnabled == "false") {
otel.SetTracerProvider(noop.NewTracerProvider())
} else {
// use non noop provider
} |
Beta Was this translation helpful? Give feedback.
-
Hello Community,
Can someone know best way to tackle this?
I'm following this doc to instrument the code. I want to disable the tracer feature so that there won't be any span creation and exporter tasks will happen.
Beta Was this translation helpful? Give feedback.
All reactions