-
Notifications
You must be signed in to change notification settings - Fork 726
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 everything up to November 2024 #3144
Commits on Nov 21, 2024
-
subscriber: fix flaky reload tests (#2798)
fixes https://github.com/tokio-rs/tracing/actions/runs/6785393202/job/18443641813 cargo test runs tests in the same file in parallel by default, causing race condition, this can be proven by running `cargo test --test reload -- --test-threads=1` => successes `cargo test --test reload -- --test-threads=2` => flaky multiple times This fix runs only the two tests in serial. We could seperate the tests in different files, but they share the same testing dependencies, so I left them in the same file.
Configuration menu - View commit details
-
Copy full SHA for e4ee3a5 - Browse repository at this point
Copy the full SHA e4ee3a5View commit details -
examples: suppress false positive clippy lint (#2846)
Signed-off-by: Alex Saveau <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 9883438 - Browse repository at this point
Copy the full SHA 9883438View commit details -
Configuration menu - View commit details
-
Copy full SHA for 182420f - Browse repository at this point
Copy the full SHA 182420fView commit details -
journald: make level mappings configurable (#2824)
This allows to manually map tracing levels to journald levels. It seems that @little-dude, who started the original PR, doesn't have time to finish this, so I picked it up. Reapplied the changes to the newest master branch and fixed the latest comments/issues. This will also fix/close: Closes #2649 Closes #2661 Closes #2347 (the original pr)
Configuration menu - View commit details
-
Copy full SHA for a8ae276 - Browse repository at this point
Copy the full SHA a8ae276View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4f08512 - Browse repository at this point
Copy the full SHA 4f08512View commit details -
docs: fix typo "synchonous" => "synchronous" (#2850)
Fix typo "synchonous" => "synchronous" in the crate level documentation. This commit is empty, it's being backported so that we don't try and baackport it later.
Configuration menu - View commit details
-
Copy full SHA for a46974d - Browse repository at this point
Copy the full SHA a46974dView commit details -
Configuration menu - View commit details
-
Copy full SHA for c4aed1d - Browse repository at this point
Copy the full SHA c4aed1dView commit details -
use const
thread_local
s when possible (#2838)This results in a substantial performance improvement, and is compatible with our MSRV. Signed-off-by: Alex Saveau <[email protected]> Co-authored-by: Eliza Weisman <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for ce5b644 - Browse repository at this point
Copy the full SHA ce5b644View commit details -
macros: Fix missing field prefixes (#2878)
## Motivation In the simple macro cases with e.g. only "name" or only "target" these prefixes exist, but for the more complicated cases like "name + target" the prefixes were not piped through and silently ignored. This led to the compiler complaining about `Value` not being implemented despite the usage of the `?` or `%` prefixes: <img width="1056" alt="Bildschirmfoto 2024-02-14 um 12 38 00" src="https://github.com/tokio-rs/tracing/assets/141300/f8b0b1af-fe66-41d8-9a08-2ecba2d67f9e"> ## Solution This change adds the missing prefixes to the `$($k)` tokens, like they already exist for the simple cases mentioned above.
Configuration menu - View commit details
-
Copy full SHA for 92633c8 - Browse repository at this point
Copy the full SHA 92633c8View commit details -
macros: Fix non-simple macro usage without message (#2879)
If something like `warn!(?foo)` and `warn!(name: "foo", ?foo)` works, then `warn!(name: "foo", target: "foo_events", ?foo)` should arguably also work. Before this change the more complicated variants of the macros however required a message argument, due to the usage of the `+` specifier in the macro definitions. This commit changes the `+` (1 or more) to `*` (0 or more), which matches how the `field` tokens are used in the simpler variants of the macro.
Configuration menu - View commit details
-
Copy full SHA for 83136ef - Browse repository at this point
Copy the full SHA 83136efView commit details -
tracing: fix event macros with constant field names in the first posi…
…tion (#2883) ## Motivation Const argumetns in `level!` macros do not work when in the first position. This also seems to have fixed #2748 where literals for fields names like `info!("foo" = 2)` could not be used outside the `event!` macro. Fixes #2837 Fixes #2738 ## Solution Previsously, `level!($(args:tt))` was forwarded to `event!(target: ..., level: ..., { $(args:tt) })` but the added curly braces seem to have prevented the `event` macro from correctly understanding the arguments and it tried to pass them to `format!`. With this change there may have some performance impact when expanding the macros in most cases where the braces could have been added as it will take one more step. These are the two relevant `event!` blocks I believe, the new tests used to expand to the first one (with empty fields), now they expand to the latter: ``` (target: $target:expr, $lvl:expr, { $($fields:tt)* }, $($arg:tt)+ ) => ( $crate::event!( target: $target, $lvl, { message = $crate::__macro_support::format_args!($($arg)+), $($fields)* } ) ); (target: $target:expr, $lvl:expr, $($arg:tt)+ ) => ( $crate::event!(target: $target, $lvl, { $($arg)+ }) ); ```
Configuration menu - View commit details
-
Copy full SHA for 7bb5bb2 - Browse repository at this point
Copy the full SHA 7bb5bb2View commit details -
tracing: allow
&[u8]
to be recorded as event/span field (#2954)Users may want to pass data to `Subscribe`s which is not valid UTF-8. Currently, it would have to be encoded into `&str` to be passed as a field value. This branch adds a `record_bytes` method to `Visit`. It has an implementation falling back to `record_debug` so it is not be a breaking change. `JsonVisitor` got an overridden implementation as it should not use `Debug` output and encode it as a string, but rather store the bytes as an array. `PrettyVisitor` go an overridden implementation to make the output more pretty. Co-authored-by: Eliza Weisman <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 93f430c - Browse repository at this point
Copy the full SHA 93f430cView commit details -
Configuration menu - View commit details
-
Copy full SHA for e9d3468 - Browse repository at this point
Copy the full SHA e9d3468View commit details -
tracing-attributes: support const values for
target
andname
(#2941)Fixes #2960 Co-authored-by: Matthijs Brobbel <[email protected]> Co-authored-by: Hayden Stainsby <[email protected]> Co-authored-by: Eliza Weisman <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for d921d5f - Browse repository at this point
Copy the full SHA d921d5fView commit details -
docs: remove non-existing method in comments (#2894)
In the documentation of the layer context span_scope method, the note contained a reference to a `scope()` method, which was removed some time ago. Also fixed a phrasing error above. Fixes: #2890
Configuration menu - View commit details
-
Copy full SHA for 59a48c7 - Browse repository at this point
Copy the full SHA 59a48c7View commit details
Commits on Nov 22, 2024
-
macros: allow field path segments to be keywords (#2925)
Currently, a keyword like `type` fails compilation as (a path segment of) a field name, for no clear reason. Trying to use `r#type` instead leads to the `r#` being part of the field name, which is unhelpful¹. Don't require the field path to match a `macro_rules!` `expr`, use repeated `tt` instead. I can't tell why this was ever required: The internal stringify macro was introduced in 55091c9#diff-315c02cd05738da173861537577d159833f70f79cfda8cd7cf1a0d7a28ace31b with an `expr` matcher without any explanation, and no tests are failing from making it match upstream's `stringify!` input format. Special thanks to whoever implemented the unstable `macro-backtrace` feature in rustc, otherwise this would have been nigh impossible to track down! ¹ this can likely be fixed too by some sort of "unraw" macro that turns `r#foo` into `foo`, but that's a separate change not made in this PR
Configuration menu - View commit details
-
Copy full SHA for f3d83a1 - Browse repository at this point
Copy the full SHA f3d83a1View commit details -
fix: prefix macro calls with ::core to avoid clashing with local macr…
Configuration menu - View commit details
-
Copy full SHA for 322c7e4 - Browse repository at this point
Copy the full SHA 322c7e4View commit details -
fix: correct SerializeField definition and doc formatting (#3040)
Clippy in 1.80.0 alerted us to the fact that `SerializeField` was never constructed (and due to its non-`pub` member, it can't be constructed outside the `tracing-serde` crate where it's from). This change fixes the definition to hold a reference to a `Field`, which is what the other `Serialize*` types do. It also implements `AsSerde` for this type and uses it inside the `SerializeFieldSet` type. As a bonus, Clippy is now also happy that the type is constructed. The example collector in the `tracing-serde` crate was also renamed from `JsonSubscriber` to `JsonCollector`. Some additional doc formatting issues in `tracing-subscriber` were fixed so that list items that run to multiple lines are correctly indented.
Configuration menu - View commit details
-
Copy full SHA for c15bff6 - Browse repository at this point
Copy the full SHA c15bff6View commit details -
Add
json-subscriber
to ecosystem (#3121)## Motivation I've created a library for better customization of JSON log lines and would like to make it more discoverable. This subscriber could help with a lot of issues such as #1531 ## Solution Add `json-subscriber` to the ecosystem.
Configuration menu - View commit details
-
Copy full SHA for 9210501 - Browse repository at this point
Copy the full SHA 9210501View commit details -
tracing: add index API for
Field
(#2820)## Motivation Expose the index of the field in order to support cases such as sending field information by index instead of by the string name in Tokio Console. Details: tokio-rs/console#462 (comment) ## Solution Adds a new API which exposes the index of a field, which is how it is stored internally (together with a reference to the `FieldSet` containing the ordered field names. Signed-off-by: hi-rustin <[email protected]> Co-authored-by: Hayden Stainsby <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for b6cb99e - Browse repository at this point
Copy the full SHA b6cb99eView commit details -
subscriber: set
log
max level when reloading (#1270)This modifies the `tracing_subscriber::reload` layer to also set the `log` crate's max level with the current max `tracing` level filter after reloading. If reloading the subscriber caused the max `tracing` level to change, this ensures that the change is propagated to the `log` crate as well. In the case where the max level was made more verbose, this will ensure that `log` records which were previously disabled are enabled correctly; in the case where it was made less verbose, this improve performance by not having to perfrom more costly filtering for those `log` records. The `log` max level is set only after rebuilding the callsite interest cache, which is what sets the max `tracing` level filter. This ensures that we pass the latest state to the `log` crate. Signed-off-by: Eliza Weisman <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 5294a84 - Browse repository at this point
Copy the full SHA 5294a84View commit details