-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tokio console and log filter reloading (#2868)
# Description #2815 reverted 2 changes (#2791, #2792) because we again saw issues with logs that were suddenly no longer emitted. This problem also happened the last time we merged support for `tokio-console` but I hoped that: 1. the issue was resolved in one of the related dependencies somehow 2. making the feature opt-in with a CLI flag would allow normal operations when disabled However, even with the feature disabled we saw that logs were again missing. I tried to debug the underlying issue and it appears that for some reason a log like `::tracing::event!(target: "sqlx::query", tracing::Level::DEBUG, summary);` would not get logged with the original implementation (not a huge deal since we weren't using them) but these logs would also cause the NEXT log that would normally be emitted to be skipped. This can be seen in this [code](5ba4666) which reproduced the error. Unfortunately `sqlx` is using `tracing::event!()` when executing an SQL query which means with the described problem it could happen randomly that some logs are missing. Luckily there are also scenarios where some SQL query always gets executed before a log we issue ourselves (e.g. `saving fee policies` log in the autopilot run loop would always be skipped) which made it easier to find the underlying cause. # Changes 1. Add `tokio-console` and `filter reloading` feature again 2. Fiddled around with how the tracing subscriber gets initialized until the test that reproduced the issue no longer skipped any logs. This was not straight forward since initializing the tokio console and our regular log filters requires you to jump through a few type system hoops. 3. removed CLI flag since this did not have the originally intended effect anyway # How to review The only important change happend in 41c47ae. The other stuff is just the revert commit. ## How to test Run test that reproduced the issue and check that the targeted log does not get skipped. This doesn't necessarily mean that all is well now. To get more confidence on the change I would just run the CI and compare the number of logs with CI runs that don't change the tracing setup. If both have roughly the same number of logs (I assume some variance will always be there) the change should be good.
- Loading branch information
1 parent
76b843c
commit 95ecc4e
Showing
10 changed files
with
363 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[build] | ||
rustflags = ["--cfg", "tokio_unstable"] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
fn main() { | ||
// Make build system aware of custom config flags to avoid clippy warnings | ||
println!("cargo::rustc-check-cfg=cfg(tokio_unstable)"); | ||
} |
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
Oops, something went wrong.