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

backport 9 commits from master #2174

Merged
merged 9 commits into from
Jun 22, 2022
Merged

backport 9 commits from master #2174

merged 9 commits into from
Jun 22, 2022

Commits on Jun 22, 2022

  1. opentelemetry: add more comments to example (#2140)

    This patch adds a bit more context around why we are creating a smaller
    scope for the spans, and also what happens when we call
    `global::shutdown_tracer_provider()` (that comment was copied from
    the`rust-opentelemetry` repo).
    
    Co-authored-by: Eliza Weisman <eliza@buoyant.io>
    bryangarza and hawkw committed Jun 22, 2022
    Configuration menu
    Copy the full SHA
    09df7ba View commit details
    Browse the repository at this point in the history
  2. chore: bin/publish shell script fixes (#2162)

    * fix use of `cargo --list` in bin/publish
    * fix shellcheck lints in bin/publish
    * set -euo pipefail
    * fix cargo hack exit status check
    * fix wrong emptystring args
    * prompt before installing cargo-hack
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jun 22, 2022
    Configuration menu
    Copy the full SHA
    7302a88 View commit details
    Browse the repository at this point in the history
  3. core, subscriber: more downcast_ref & is methods (#2160)

    Adds inherent `downcast_ref` and `is` inherent methods to:
      - `dyn Subscriber + Send`
      - `dyn Subscriber + Sync`
      - `dyn Subscriber + Send + Sync`
      - `Layered`
    
    These additional implementations reduce the circumstances in which one
    must cast to `dyn Subscriber` (which, previously, was the only type for
    which `downcast_ref` and `is` were available).
    jswrenn authored and hawkw committed Jun 22, 2022
    Configuration menu
    Copy the full SHA
    240cd50 View commit details
    Browse the repository at this point in the history
  4. docs: add tracing-logfmt to related crates (#2163)

    Adds tracing-logfmt crate to the related crates section
    fredr authored and hawkw committed Jun 22, 2022
    Configuration menu
    Copy the full SHA
    5a90095 View commit details
    Browse the repository at this point in the history
  5. core: impl field::Value for String (#2164)

    ## Motivation
    
    Currently, it is rather difficult to record `String`s as field values,
    even though `&str` is a primitive `Value` type. For example, this code
    does not currently compile:
    
    ```rust
    let my_string = String::from("hello world!");
    tracing::debug!(my_string);
    ```
    
    Instead, it is necessary to explicitly call `String::as_str` or a
    similar conversion method:
    
    ```rust
    let my_string = String::from("hello world!");
    tracing::debug!(my_string = my_string.as_str());
    ```
    
    This is unfortunate, as it makes a fairly straightforward, commomplace
    task (recording a `String` as a field) unnecessarily verbose.
    
    ## Solution
    
    This branch adds an `impl Value for String` in `tracing-core`. The impl
    simply calls `String::as_str` and then calls `record_str`. Because
    `Value` takes an `&self`, and there are preexisting `impl<T: Value>
    Value` for `&T` and `&mut T`, the string is not consumed, and `&String`
    or `&mut String`s can also be used as `Value`s.
    
    I've also added tests validating that this actually works.
    hawkw committed Jun 22, 2022
    Configuration menu
    Copy the full SHA
    f90b455 View commit details
    Browse the repository at this point in the history
  6. core: impl<S: Subscriber + ?Sized> Subscriber for Box<S>, Arc<S> (

    #2161)
    
    These broader impls supersede the previous impls where the inner type was a
    `dyn Subscriber`. With these generic impls, you no longer must (but
    still can, if you wish) cast the inner type of a boxed or arc'd
    subscriber to `dyn Subscriber` to use it as a `Subscriber`.
    jswrenn authored and hawkw committed Jun 22, 2022
    Configuration menu
    Copy the full SHA
    a6cb13e View commit details
    Browse the repository at this point in the history
  7. core: add support for recording 128-bit integers (#2166)

    ## Motivation
    
    I've received a request at work to record 128-bit integers and realized
    that we should probably support recording them.
    
    ## Solution
    
    Added two methods to the `Visit` trait, `record_i128` and `record_u128`.
    However, I didn't add the size conversions present for 64-bit integers,
    as 128-bit integers are, at this time, more specialized.
    davidbarsky authored and hawkw committed Jun 22, 2022
    Configuration menu
    Copy the full SHA
    cc95319 View commit details
    Browse the repository at this point in the history
  8. core, subscriber: add event_enabled to filter events on fields (#2008)

    ## Motivation
    
    Allow filter layers to filter on the contents of events (see #2007).
    
    ## Solution
    
    This branch adds a new `Subscriber::event_enabled` method, taking an
    `Event` and returning `bool`. This is called before the
    `Subscriber::event` method, and if it returns `false`,
    `Subscriber::event` is not called.
    
    For simple subscriber (e.g. not using `Layer`s), the `event_enabled`
    method is not particulary necessary, as the subscriber can just skip the
    `event` call. However, this branch also adds a new
    `Layer::event_enabled` method, with the signature:
    ```rust
    fn event_enabled(&self, event: &Event<'_>, ctx: Context<'_, S>) -> bool;
    ```
    
    This is called before `Layer::on_event`, and if `event_enabled`
    returns `false`, `on_event` is not called (nor is `Subscriber::event`).
    This allows filter `Layer`s to filter out an `Event` based on its
    fields.
    
    Closes #2007
    CAD97 authored and hawkw committed Jun 22, 2022
    Configuration menu
    Copy the full SHA
    907604c View commit details
    Browse the repository at this point in the history
  9. chore(ci): run MSRV checks with minimal versions (#2171)

    In many cases, new releases of a dependency can break compatibility with
    `tracing`'s minimum supported Rust version (MSRV). It shouldn't be
    necessary for a `tracing` crate to bump its MSRV when a dependency does,
    as users on older Rust versions should be able to depend on older
    versions of that crate explicitly and avoid bumping. Instead, we should
    probably just run our MSRV checks with minimal dependency versions. This
    way, we don't need to bump our MSRV when the latest version of a
    dependency does, unless we actually *need* to pick up that new version.
    
    This branch changes the `check_msrv` CI jobs to do that. I also did some
    minor dependency editing to actually make tracing build with
    `-Zminimal-versions`.
    
    Note that `tracing-futures` is currently excluded from the MSRV build
    because it depends on a really ancient version of Tokio that pulls in
    broken deps. We should probably drop support for Tokio 0.1 and release a
    new version of that crate, but for now, we have to skip it from the CI
    job temporarily.
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Jun 22, 2022
    Configuration menu
    Copy the full SHA
    0231ad6 View commit details
    Browse the repository at this point in the history