Replies: 1 comment 8 replies
-
Could you describe what you are trying to achieve? Disabling instrumentation at runtime is not something supported by the OTel specification, unless you use custom sampler. |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I would like to disable completely instrumentation at runtime, after having configured the Sdk.
Initially, I was trying to use the AlwaysOff sampler on traces, but discovered that Activity are still returned by the ActivitySource.
It seems intentional because even when then sampler should discard, the root activity is emitted to preserve and propagate the trace id.
But SuppressInstrumentationScope will drop all traces, and I would like to apply this behavior globally.
My suggestion could be to simply add a public setter on Sdk.SuppressInstrumentation with a bool backend. Combine SuppressInstrumentationScope.IsSuppressed and the backing field on get, and set the backing field on set:
Current:
My suggestion:
I don't think this value is expected to be cached by the caller (because SuppressInstrumentationScope rely on this), so I don't see any downside on this feature.
Beta Was this translation helpful? Give feedback.
All reactions