-
Notifications
You must be signed in to change notification settings - Fork 742
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
backport changes from master
#1609
Merged
Merged
Conversation
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
It turns out panic hooks also work nicely even when panics are captured. I figured we may as well have an example demoing this!
Co-authored-by: Eliza Weisman <[email protected]>
## Motivation Looks like doc is missing a parenthesis ## Solution Add a parenthesis
Allow the deprecated API for now, until the next MSRV bump. Signed-off-by: Eliza Weisman <[email protected]>
This should *actually* fix the build on no-std. Signed-off-by: Eliza Weisman <[email protected]>
## Motivation When a `RollingFileAppender` is refreshed, the previous `BufWriter` may encounter and suppress errors in `drop`. From https://doc.rust-lang.org/std/io/struct.BufWriter.html: > It is critical to call flush before BufWriter<W> is dropped. Though > dropping will attempt to flush the contents of the buffer, any errors > that happen in the process of dropping will be ignored. ## Solution Explicitly flush the previous buffer before dropping, printing any error to stderr.
The version of `WithSubscriber` in `tracing::instrument` (rather than in `tracing-futures`) is currently...useless, since there is no `Future` impl for the `WithDispatch` type. This means that calling `with_collector` on a `Future` returns a value that _isn't_ a `Future`. Additionally, the `WithSubscriber` trait isn't actually implemented for anything (although this was fixed on v0.1.x). This branch adds the missing implementations. I also improved the docs a bit. Note that the `Future` impl requires the "std" feature flag, but the `WithSubscriber` trait and `WithDispatch` type do not. This is because requiring the feature flag for these definitions would *technically* be a breaking change, since they were previously published without the feature flag and could e.g. be imported...even though they were totally useless. Sigh. Signed-off-by: Eliza Weisman <[email protected]> ; Conflicts: ; tracing/src/instrument.rs
## Motivation In #1600, the `instrument` code generation was changed to avoid ever constructing a `Span` struct if the level is explicitly disabled. However, for `async` functions, `#[instrument]` will currently still create the span, but simply skips constructing an `Instrument` future if the level is disabled. ## Solution This branch changes the `#[instrument]` code generation for async blocks to totally skip constructing the span if the level is disabled. I also simplfied the code generation a bit by combining the shared code between the `err` and non-`err` cases, reducing code duplication a bit. Signed-off-by: Eliza Weisman <[email protected]>
Signed-off-by: Eliza Weisman <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
this backports the following changes from
master
tov0.1.x
:async
spans if level disabled (attributes: skipasync
spans if level disabled #1607)Future
impl forWithDispatch
(tracing: add missingFuture
impl forWithDispatch
#1602)spin_loop_hint
deprecation (core: fixspin_loop_hint
deprecation warnings #1603)dyn
inVisit
docs example (doc typo #1595)tokio_panic_hook
example (examples: addtokio_panic_hook
example #1593)Of these commits, only #1602 required meaningful modification for v0.1.x
(beyond tracking renamings). It was necessary to change the feature
flagging of
WithDispatch
/WithSubscriber
from the version onmaster
, so that theFuture
impl requires the "std" feature flag,but the
WithSubscriber
trait andWithDispatch
type do not. This isbecause requiring the feature flag for these definitions would
technically be a breaking change, since they were previously published
without the feature flag and could e.g. be imported...even though they
were totally useless. Sigh.