-
Notifications
You must be signed in to change notification settings - Fork 893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add SuppressTracing flag #3103
add SuppressTracing flag #3103
Conversation
c1c12cd
to
ac5229f
Compare
Co-authored-by: Yuri Shkuro <[email protected]>
Co-authored-by: Yuri Shkuro <[email protected]>
Sharing what OpenTelemetry .NET has done:
Related discussions: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do this in the SDK instead of the API?
In OpenTelemetry .NET the SDK has provided a mechanism which seems sufficient open-telemetry/opentelemetry-dotnet#960.
@reyang the functionality may need to be available in instrumentation libraries, which are not supposed to be aware of the SDK |
this is the mechanism that all of the Java Instrumentation uses: open-telemetry/oteps#172 |
In JS some (but by far not all) instrumentations check the In python it seems that the concrete instrumentations check if suppress context key is set and if if is set they do not even call I think we should add handling in SDK to avoid the needed that everyone has to check the context before calling We might also want to distinguish between suppressing nested/inner spans (e.g. HTTPS calls public, instrumented HTTP APIs internal) but keep child spans like DNS and propagation to other processes or suppress the complete subtrace which would include the need to propagate the suppress flag to avoid that receiver starts a new trace. |
Yep. I think there are two parts:
|
@reyang a publicly accessible (via API) Context key to suppress tracing is a possible alternative, but the "obscurity" argument doesn't sit well with me (and it's also less type-safe than the dedicated methods). If someone has a valid need to suppress tracing this way, it seems strange to make the feature harder to find (i.e. it won't come up in auto-complete). It also bifurcates the way API users are asked to interact with the API, without actually reducing the mental model of the API surface. |
Based on the research I've done in #1767, each language SIG has (or had at the time I did it) has some version of a suppression flag (links are 1.5 years old)
Suppression flag works great to suppress the instrumentation of exporter calls, but for application/library instrumentation purposes, it's not expressive enough. |
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
Any chance that this gets re-opened as the problem is unsolved yet? |
As mentioned before, this is something that several SDKs are already doing. How about reopening the issue? This would be interesting for Go as well, as we currently don't want to let folks override the |
There was a reasonable objection to this approach raised in #3103 (comment) by @lmolkova . |
Fixes #530
Changes
This PR proposes a new Context key to be used at Span creation time to disable creation of any child Spans. This feature is useful in cases like disabling tracing within an exporter when it calls the HTTP or grpc client.
The feature exists already in multiple implementations.
Prior art:
This PR is based on the PR from @dyladan but with the difference in how
StartSpan operates when suppressed. Add Suppress Tracing context key #1653
Ruby:
untraced
fix: untraced only works with parent-based sampler opentelemetry-ruby#1412Javascript:
suppressTracing
/unsuppressTracing
https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-core/src/trace/suppress-tracing.tsWhy return the parent
My thinking here is that
Unsuppress
picks up where it left off. The user doesnot end up with an invalid parent or, if valid spans were used in this PR
instead, with a parent that is not recorded.
I'm torn on the usefulness of this because usually the user would be instead
returning to the previous Context (Contexts being immutable) and have no need to
either
Unsuppress
or be tracking the parent.Why not suppress all signals
The plan I have is to add suppression for all signals, which can be wrapped in a
SuppressSignals
or similar function. The reason is I think it would be verycommon to want to suppress tracing and possibly metrics but would not want
suppression logging. In the example of not tracing an exporter you'd likely
still want any logs from the HTTP/grpc client in case something goes wrong.
What about Propagation
That is an open question not covered by this PR yet. I think I've come around to
suppression not having an effect on propagation and leave it up to libraries to
support overriding the global propagator with a no-op propagator so the user is
able to disable propagation.