Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: tokio-rs/tracing
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: tracing-0.1.30
Choose a base ref
...
head repository: tokio-rs/tracing
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: tracing-0.1.31
Choose a head ref
  • 18 commits
  • 60 files changed
  • 9 contributors

Commits on Feb 4, 2022

  1. docs: document tracing-subscriber valuable support (#1901)

    This PR adds documentation on `valuable` support in `tracing-serde` and
    `tracing-subscriber`.
    hawkw authored Feb 4, 2022
    Configuration menu
    Copy the full SHA
    31df8cd View commit details
    Browse the repository at this point in the history
  2. subscriber: fix broken docs links (#1902)

    This branch fixes some broken documentation links and other docs issues
    in `tracing-subscriber`.
    hawkw authored Feb 4, 2022
    Configuration menu
    Copy the full SHA
    4b2903f View commit details
    Browse the repository at this point in the history
  3. subscriber: add Targets::would_enable (#1903

    ## Motivation
    
    As discussed on discord, this API + `Targets` being `: Clone` makes it
    easier to solve the original problem I had tried to solve in
    #1889.
    
    My plan on how to use this is in
    https://github.com/MaterializeInc/materialize/issues/10441 if you are
    interested!
    
    ## Solution
    
    I considered doing some macro magic to create a `Metadata` with a
    callsite and empty fields and everything, to be able to called
    `DirectiveSet::enabled`, but it felt cleaner and easier to reason about
    the special-case-ness (`Targets` never having field filters) using a new
    set of methods that do a similar thing.
    
    For testing I opted for just a doc-test, let me know if thats fine!
    guswynn authored Feb 4, 2022
    Configuration menu
    Copy the full SHA
    b411a5c View commit details
    Browse the repository at this point in the history
  4. serde: prepare to release 0.1.3 (#1904)

    # 0.1.3 (February 4, 2022)
    
    This release adds *experimental* support for recording structured field
    values using the [`valuable`] crate. See [this blog post][post] for
    details on `valuable`.
    
    Note that `valuable` support currently requires `--cfg
    tracing_unstable`. See the documentation for details.
    
    ### Added
    
    - **valuable**: Experimental support for serializing user-defined types
      using [`valuable`] and [`valuable-serde`] ([#1862])
    - Support for serializing `f64` values ([#1507])
    
    ### Fixed
    
    - Fixed incorrect size hint in `SerializeFieldSet` ([#1333])
    - A number of documentation fixes
    
    Thanks to @akinnane and @maxburke for contributing to this release!
    
    [`valuable`]: https://crates.io/crates/valuable
    [`valuable-serde`]: https://crates.io/crates/valuable-serde
    [post]: https://tokio.rs/blog/2021-05-valuable
    [#1862]: #1862
    [#1507]: #1507
    [#1333]: #1333
    
    (I also noticed there was a missing changelog entry for v0.1.2, so I
    fixed that while I was here)
    hawkw authored Feb 4, 2022
    Configuration menu
    Copy the full SHA
    c661c23 View commit details
    Browse the repository at this point in the history
  5. subscriber: prepare to release v0.3.8 (#1905)

    # 0.3.8 (Feb 4, 2022)
    
    This release adds *experimental* support for recording structured field
    values using the [`valuable`] crate to the `format::Json` formatter. In
    particular, user-defined types which are recorded using their
    [`valuable::Valuable`] implementations will be serialized as JSON
    objects, rather than using their `fmt::Debug` representation. See [this
    blog post][post] for details on `valuable`.
    
    Note that `valuable` support currently requires `--cfg
    tracing_unstable`. See the documentation for details.
    
    Additionally, this release includes a number of other smaller API
    improvements.
    
    ### Added
    
    - **json**: Experimental support for recording [`valuable`] values as
      structured JSON ([#1862], [#1901])
    - **filter**: `Targets::would_enable` method for testing if a `Targets`
      filter would enable a given target ([#1903])
    - **fmt**: `map_event_format`, `map_fmt_fields`, and `map_writer`
      methods to `fmt::Layer` and `fmt::SubscriberBuilder` ([#1871])
    
    ### Changed
    
    - `tracing-core`: updated to [0.1.22][core-0.1.22]
    
    ### Fixed
    
    - Set `smallvec` minimal version to 1.2.0, to fix compilation errors
      with `-Z minimal-versions` ([#1890])
    - Minor documentation fixes ([#1902], [#1893])
    
    Thanks to @guswynn, @glts, and @lilyball for contributing to this
    release!
    
    [`valuable`]: https://crates.io/crates/valuable
    [`valuable::Valuable`]: https://docs.rs/valuable/latest/valuable/trait.Valuable.html
    [post]: https://tokio.rs/blog/2021-05-valuable
    [core-0.1.22]: https://github.com/tokio-rs/tracing/releases/tag/tracing-core-0.1.22
    [#1862]: #1862
    [#1901]: #1901
    [#1903]: #1903
    [#1871]: #1871
    [#1890]: #1890
    [#1902]: #1902
    [#1893]: #1893
    hawkw authored Feb 4, 2022
    Configuration menu
    Copy the full SHA
    b37220c View commit details
    Browse the repository at this point in the history

Commits on Feb 7, 2022

  1. chore: update MSRVs from 1.42 to 1.49 (#1913)

    This updates all crates' MSRVs to 1.49 if they were not already greater
    than that (`tracing-appender` is at 1.53). Rust 1.49+ is required to
    update `parking_lot` to v0.12 (see #1878). Also, `futures-task` (which I
    believe is only needed as a transitive dep) now needs 1.45+, so this
    also fixes our CI build.
    
    Because `tracing-opentelemetry` previously required 1.46.0, it had a
    separate CI MSRV job. Since 1.49.0 is greater than 1.46.0, the separate
    check for `tracing-opentelemetry` is no longer needed.
    
    In the process, I removed deprecated uses of
    `core::atomic::spin_loop_hint`, which is replaced with
    `core::hint::spin_loop` in 1.49.
    hawkw committed Feb 7, 2022
    Configuration menu
    Copy the full SHA
    3222527 View commit details
    Browse the repository at this point in the history
  2. journald: make memfd_create syscall directly (#1912)

    Fixes #1879
    
    ## Motivation
    
    `journald-tracing>=0.2.1` doesn't build with old glibc.
    
    ## Solution
    
    Make the `memfd_create` syscall ourselves.
    
    cc @lunaryorn @Ralith
    9999years authored and hawkw committed Feb 7, 2022
    Configuration menu
    Copy the full SHA
    9834705 View commit details
    Browse the repository at this point in the history
  3. build(deps): update parking_lot requirement from 0.11.2 to 0.12.0 (#1878

    )
    
    Updates the requirements on [parking_lot](https://github.com/Amanieu/parking_lot) to permit the latest version.
    - [Release notes](https://github.com/Amanieu/parking_lot/releases)
    - [Changelog](https://github.com/Amanieu/parking_lot/blob/master/CHANGELOG.md)
    - [Commits](Amanieu/parking_lot@0.11.2...0.12.0)
    
    ---
    updated-dependencies:
    - dependency-name: parking_lot
      dependency-type: direct:production
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    Co-authored-by: Eliza Weisman <eliza@buoyant.io>
    dependabot[bot] and hawkw committed Feb 7, 2022
    Configuration menu
    Copy the full SHA
    aede02d View commit details
    Browse the repository at this point in the history

Commits on Feb 8, 2022

  1. journald: prepare to release v0.2.3

    # 0.2.3 (February 7, 2022)
    
    ### Fixed
    
    - Fixed missing `memfd_create` with `glibc` versions < 2.25 ([#1912])
    
    ### Changed
    
    - Updated minimum supported Rust version to 1.49.0 ([#1913])
    
    Thanks to @9999years for contributing to this release!
    
    [#1912]: #1912
    [#1913]: #1913
    hawkw authored Feb 8, 2022
    Configuration menu
    Copy the full SHA
    3280f79 View commit details
    Browse the repository at this point in the history

Commits on Feb 9, 2022

  1. tracing: fix macro hygiene for concat! (#1918)

    Re-application of changes made in #1842 which were lost in f1cf1f1
    
    Integration tests added for regression.
    
    ---
    
    ## Motivation
    
    In my library I define a `macro_rules! concat` macro, i.e.
    [`callbag::concat`](https://docs.rs/callbag/latest/callbag/macro.concat.html).
    
    When I try to call `tracing::info!(...)`, I get error output such as
    this:
    
    <details>
    <summary>error output</summary>
    
    <!-- leave a blank line above -->
    ```
    > RUSTFLAGS='-Z macro-backtrace' cargo +nightly clippy --features trace
        Checking callbag v0.14.0 (/home/teohhanhui/projects/teohhanhui/callbag-rs)
    error[E0308]: mismatched types
      --> src/concat.rs:89:9
       |
    89 |         info!("from sink: {message:?}");
       |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&str`, found `u32`
    
    error[E0277]: the trait bound `std::sync::Arc<core::Callbag<never::Never, _>>: std::convert::From<&str>` is not satisfied
        --> src/concat.rs:58:9
         |
    56   | / macro_rules! concat {
    57   | |     ($($s:expr),* $(,)?) => {
    58   | |         $crate::concat(::std::vec![$($s),*].into_boxed_slice())
         | |         ^^^^^^^^^^^^^^ the trait `std::convert::From<&str>` is not implemented for `std::sync::Arc<core::Callbag<never::Never, _>>`
    59   | |     };
    60   | | }
         | |_- in this expansion of `concat!` (#5)
    ...
    89   |           info!("from sink: {message:?}");
         |           ------------------------------- in this macro invocation (#1)
         |
        ::: src/utils/tracing.rs:47:1
         |
    47   | / macro_rules! info {
    48   | |     ($($arg:tt)+) => {
    49   | |         ::cfg_if::cfg_if! {
    50   | |             if #[cfg(feature = "trace")] {
    51   | |                 ::tracing::info!($($arg)+)
         | |                 -------------------------- in this macro invocation (#2)
    ...    |
    54   | |     };
    55   | | }
         | |_- in this expansion of `info!` (#1)
         |
        ::: /home/teohhanhui/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-0.1.29/src/macros.rs:586:1
         |
    586  |   macro_rules! event {
         |  _-
         | |_|
         | |
    587  | |     (target: $target:expr, parent: $parent:expr, $lvl:expr, { $($fields:tt)* } )=> (
    588  | |         $crate::__tracing_log!(
    589  | |             target: $target,
    ...    |
    644  |                   name: concat!(
         |  _______________________-
    645  |                       "event ",
    646  |                       file!(),
    647  |                       ":",
    648  |                       line!()
    649  | |                 ),
         | |_________________- in this macro invocation (#5)
    ...
    667  | /         $crate::event!(
    668  |               target: $target,
    669  |               $lvl,
    670  |               { message = format_args!($($arg)+), $($fields)* }
    671  | |         )
         | |_________- in this macro invocation (#4)
    ...
    791  | |     );
    792  | | }
         | | -
         | |_|
         | |_in this expansion of `$crate::event!` (#3)
         |   in this expansion of `$crate::event!` (#4)
    ...
    1229 | / macro_rules! info {
    1230 |        (target: $target:expr, parent: $parent:expr, { $($field:tt)* }, $($arg:tt)* ) => (
    1231 |           $crate::event!(target: $target, parent: $parent, $crate::Level::INFO, { $($field)* }, $($arg)*)
    1232 |       );
    ...
    1398 | /         $crate::event!(
    1399 | |             target: module_path!(),
    1400 | |             $crate::Level::INFO,
    1401 | |             {},
    1402 | |             $($arg)+
    1403 | |         )
         | |_________- in this macro invocation (#3)
    1404 |       );
    1405 | | }
         | |_- in this expansion of `::tracing::info!` (#2)
         |
         = help: the following implementations were found:
                   <std::sync::Arc<B> as std::convert::From<std::borrow::Cow<'a, B>>>
                   <std::sync::Arc<T> as std::convert::From<T>>
                   <std::sync::Arc<T> as std::convert::From<std::boxed::Box<T>>>
                   <std::sync::Arc<[T]> as std::convert::From<&[T]>>
                 and 9 others
         = note: required because of the requirements on the impl of `std::convert::Into<std::sync::Arc<core::Callbag<never::Never, _>>>` for `&str`
    note: required by a bound in `concat::concat`
        --> src/concat.rs:81:8
         |
    72   | pub fn concat<
         |        ------ required by a bound in this
    ...
    81   |     S: Into<Arc<Source<T>>> + Send + Sync,
         |        ^^^^^^^^^^^^^^^^^^^^ required by this bound in `concat::concat`
    
    error[E0308]: mismatched types
        --> src/concat.rs:58:9
         |
    56   | / macro_rules! concat {
    57   | |     ($($s:expr),* $(,)?) => {
    58   | |         $crate::concat(::std::vec![$($s),*].into_boxed_slice())
         | |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&str`, found struct `core::Callbag`
    59   | |     };
    60   | | }
         | |_- in this expansion of `concat!` (#5)
    ...
    89   |           info!("from sink: {message:?}");
         |           ------------------------------- in this macro invocation (#1)
         |
        ::: src/utils/tracing.rs:47:1
         |
    47   | / macro_rules! info {
    48   | |     ($($arg:tt)+) => {
    49   | |         ::cfg_if::cfg_if! {
    50   | |             if #[cfg(feature = "trace")] {
    51   | |                 ::tracing::info!($($arg)+)
         | |                 -------------------------- in this macro invocation (#2)
    ...    |
    54   | |     };
    55   | | }
         | |_- in this expansion of `info!` (#1)
         |
        ::: /home/teohhanhui/.cargo/registry/src/github.com-1ecc6299db9ec823/tracing-0.1.29/src/macros.rs:586:1
         |
    586  |   macro_rules! event {
         |  _-
         | |_|
         | |
    587  | |     (target: $target:expr, parent: $parent:expr, $lvl:expr, { $($fields:tt)* } )=> (
    588  | |         $crate::__tracing_log!(
    589  | |             target: $target,
    ...    |
    644  |                   name: concat!(
         |  _______________________-
    645  |                       "event ",
    646  |                       file!(),
    647  |                       ":",
    648  |                       line!()
    649  | |                 ),
         | |_________________- in this macro invocation (#5)
    ...
    667  | /         $crate::event!(
    668  |               target: $target,
    669  |               $lvl,
    670  |               { message = format_args!($($arg)+), $($fields)* }
    671  | |         )
         | |_________- in this macro invocation (#4)
    ...
    791  | |     );
    792  | | }
         | | -
         | |_|
         | |_in this expansion of `$crate::event!` (#3)
         |   in this expansion of `$crate::event!` (#4)
    ...
    1229 | / macro_rules! info {
    1230 |        (target: $target:expr, parent: $parent:expr, { $($field:tt)* }, $($arg:tt)* ) => (
    1231 |           $crate::event!(target: $target, parent: $parent, $crate::Level::INFO, { $($field)* }, $($arg)*)
    1232 |       );
    ...
    1398 | /         $crate::event!(
    1399 | |             target: module_path!(),
    1400 | |             $crate::Level::INFO,
    1401 | |             {},
    1402 | |             $($arg)+
    1403 | |         )
         | |_________- in this macro invocation (#3)
    1404 |       );
    1405 | | }
         | |_- in this expansion of `::tracing::info!` (#2)
         |
         = note: expected reference `&'static str`
                       found struct `core::Callbag<never::Never, _>`
    
    Some errors have detailed explanations: E0277, E0308.
    For more information about an error, try `rustc --explain E0277`.
    error: could not compile `callbag` due to 3 previous errors
    ```
    </details>
    
    This is because of my `concat` macro being in scope.
    
    ## Solution
    
    Change all the `tracing` macros to use the re-export of `core::concat!`
    in the `__macro_support` module, rather than using an un-namespaced
    `concat!`. The re-export ensures that everything still works even in a
    crate that redefines the `core` name to something else.
    teohhanhui authored Feb 9, 2022
    Configuration menu
    Copy the full SHA
    3e5318d View commit details
    Browse the repository at this point in the history

Commits on Feb 11, 2022

  1. opentelemetry: forward event source locations (#1911)

    This branch adds the source code file, module path, and line number to
    OpenTelemetry events as the OpenTelemetry `code.filepath`,
    `code.namespace`, and `code.lineno` fields, respectively, if they are
    set in the `tracing` event's metadata.
    
    Fixes #1910
    djc authored and hawkw committed Feb 11, 2022
    Configuration menu
    Copy the full SHA
    f8a93f1 View commit details
    Browse the repository at this point in the history
  2. opentelemetry: allocate fewer strings for recording events (#1917)

    ## Motivation
    
    Currently, the `tracing-opentelemetry` subscriber will allocate several
    strings for opentelemetry key-value fields in its `on_event`
    implementation. Some of these allocations are not necessary, since
    `opentelemetry::Value::String` can take a `Cow`, allowing `&'static str`s
    to be used without allocating a new `String`.
    
    Since this happens for _every_ event that's recorded to opentelemetry,
    this probably has a meaningful performance impact.
    
    ## Solution
    
    This branch makes two primary changes:
    
    + Change the `on_event` method to subscriber to use `&'static str`s for
      event targets when possible, similarly to how we did this for source
      locations in #1911. This way, when events were not recorded via the
      `tracing-log` adapter, we will use the `&'static` tracing metadata
      string for their targets, rather than allocating a new `String`. New
      `String`s are only allocated when an event came from the `log` crate
      and its target is not valid for the `'static` lifetime.
    
    * Use `Level::as_str` for the `Level` key-value field, instead of
      `Level::to_string`. `to_string` calls `fmt::Display` and returns a
      `String`, while `as_str` returns an `&'static str`. This way, levels
      will never allocate a `String`.
    hawkw committed Feb 11, 2022
    Configuration menu
    Copy the full SHA
    21eb741 View commit details
    Browse the repository at this point in the history
  3. opentelemetry: prepare to release v0.17.1 (#1922)

    # 0.17.1 (February 11, 2022)
    
    ### Added
    
    - `OpenTelemetryLayer` can now add detailed location information to
      forwarded events (defaults to on) ([#1911])
    - `OpenTelemetryLayer::with_event_location` to control whether source
      locations are recorded ([#1911])
    ### Changed
    
    - Avoid unnecessary allocations to improve performance when recording
      events ([#1917])
    
    Thanks to @djc for contributing to this release!
    
    [#1917]: #1917
    [#1911]: #1911
    
    Closes #1919
    hawkw authored Feb 11, 2022
    Configuration menu
    Copy the full SHA
    f4a44cf View commit details
    Browse the repository at this point in the history

Commits on Feb 15, 2022

  1. docs: update Compact formatter docs (#1926)

    ## Motivation
    
    Currently, the RustDoc for the `format::Compact` formatter in
    `tracing-subscriber` describes the output from the `master` (v0.2.x)
    version of the formatter, not the version on the v0.1.x branch.
    
    ## Solution
    
    This PR updates the documentation to describe the actual output format.
    Also, I added an example of the formatter in the `examples` directory.
    
    Closes #1909
    hawkw authored Feb 15, 2022
    Configuration menu
    Copy the full SHA
    e5921ba View commit details
    Browse the repository at this point in the history

Commits on Feb 17, 2022

  1. tracing: fix wrong log level in warn! macro (#1930)

    ## Motivation
    
    I was scrolling through the code in `tracing/src/macros.rs` and noticed
    a possibly wrong log level in the `warn!` macro:
    
    https://github.com/tokio-rs/tracing/blob/4e65750b13721fee7a7ac05b053e1b9c3d21244f/tracing/src/macros.rs#L1698
    
    ## Solution
    
    This branch changes the level to `Level::WARN` in the incorrect macro
     arm.
    
    Fixes: #1929
    
    Co-authored-by: Nicolaas Geldenhuys <nicolaas.geldenhuys@cartrack.com>
    2 people authored and hawkw committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    b37d8af View commit details
    Browse the repository at this point in the history
  2. docs: add tracing-forest to "Related Crates" section (#1935)

    ## Motivation
    
    This PR adds [`tracing-forest`](https://crates.io/crates/tracing-forest)
    to the list of related crates. `tracing-forest` provides contextual
    coherence when writing logs, and is being used by projects like
    [Kanidm](https://github.com/kanidm/kanidm/).
    
    ## Solution
    
    I added it to the documentation in `lib.rs` and in the README. Am I
    missing anything else?
    QnnOkabayashi authored and hawkw committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    38a99d8 View commit details
    Browse the repository at this point in the history
  3. docs: clean up tracing_subscriber::fmt formatter docs (#1927)

    ## Motivation
    
    Currently, the documentation for the `fmt` module shows examples of the
    output for each formatter in the top-level module. This is a lot of text
    that makes finding other things in the documentation more difficult.
    Meanwhile, the type-level docs for the various formatters are quite
    terse and don't offer much useful information.
    
    ## Solution
    
    This branch moves the example output to the type-level docs for the
    various formatters, and links to it from the list of formatters. I've
    also updated and expanded some of the documentation for the formatters,
    and added a similar list of formatters to the `fmt::format` module.
    Hopefully, this makes things easier to navigate?
    
    Finally, I've re-generated all example output with the latest versions
    of each formatter.
    
    ## Alternatives
    
    Alternatively, we could not move the example output. The initial
    intention for putting it in the top-level `fmt` module docs was to make
    it _very_ easy to find what the different formats look like. Perhaps
    this is worth having a lot of text to scroll through in the
    module-level docs?
    hawkw committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    94379a3 View commit details
    Browse the repository at this point in the history
  4. tracing: prepare to release v0.1.31 (#1937)

    # 0.1.31 (February 17th, 2022)
    
    This release increases the minimum supported Rust version (MSRV) to
    1.49.0. In addition, it fixes some relatively rare macro bugs.
    
    ### Added
    
    - Added `tracing-forest` to the list of related crates ([#1935])
    
    ### Changed
    
    - Updated minimum supported Rust version (MSRV) to 1.49.0 ([#1913])
    
    ### Fixed
    
    - Fixed the `warn!` macro incorrectly generating an event with the
      `TRACE` level ([#1930])
    - Fixed macro hygiene issues when used in a crate that defines its own
      `concat!` macro, for real this time ([#1918])
    
    Thanks to @QnnOkabayashi, @nicolaasg, and @teohhanhui for contributing
    to this release!
    
    [#1935]: #1935
    [#1913]: #1913
    [#1930]: #1930
    [#1918]: #1918
    hawkw authored Feb 17, 2022
    Configuration menu
    Copy the full SHA
    846a53e View commit details
    Browse the repository at this point in the history
Loading