-
Notifications
You must be signed in to change notification settings - Fork 747
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tracing: add
Span::or_current
to help with efficient propagation (#…
…1538) This adds a new `Span::or_current` method that returns the span it's called on, if that span is enabled, or the current span if that span is not enabled. This should provide a more efficient alternative to writing code like ```rust tokio::spawn( future .instrument(some_span) .in_current_span() ); ``` since it doesn't wrap the future in two different spans which are (potentially) both entered on polls. It's also a little more concise to write, which (hopefully) will encourage people to use it instead of the less efficient alternative. `Span::or_current` may be useful in other cases as well. Signed-off-by: Eliza Weisman <eliza@buoyant.io>
- Loading branch information
Showing
3 changed files
with
173 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters