Skip to content
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

clarify span enter warning #2010

Merged
merged 3 commits into from
Mar 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions tracing/src/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,9 +605,13 @@ impl Span {
/// async fn my_async_function() {
/// let span = info_span!("my_async_function");
///
/// // THIS WILL RESULT IN INCORRECT TRACES
/// // WARNING: This span will remain entered until this
/// // guard is dropped...
/// let _enter = span.enter();
/// some_other_async_function().await;
/// // ...but the `await` keyword may yield, causing the
/// // runtime to switch to another task, while remaining in
/// // this span!
/// some_other_async_function().await
///
/// // ...
/// }
Expand Down