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

tracing: don't emit log events if a subscriber has been set #346

Merged
merged 7 commits into from Sep 13, 2019

Commits on Sep 12, 2019

  1. tracing: don't emit log events if a subscriber has been set

    Motivation:
    
    Currently, when `tracing`'s `log` feature is enabled, all spans and
    events will emit `log` records as well as `tracing` events. When
    `tracing-log` is being used to convert `log` records into `tracing`
    events, this results in duplicate events being observed: those emitted
    by the event macros directly, and those generated from the log records
    they emit by `tracing-log`.
    
    Solution:
    
    In `tracing-core` 0.1.6, we added an internal API for checking if a
    `tracing` subscriber has ever been set. In addition to the performance
    optimizations which this was initially intended to enable, this also
    gives us a way for `tracing` macros in libraries to check if a
    downstream application that depends on those libraries is actually using
    `tracing`. If `tracing` is in use and a subscriber has been set, the
    macros can be disabled.
    
    In a handful of cases, users _may_ wish to collect `log` records and
    `tracing` events totally separately. For example, `log` records might be
    output to the console while `tracing` is used to generate metrics or for
    performance profiling. In this case, there is an additional `log-always`
    feature flag which applications can set to enable all of `tracing`'s log
    records regardless of whether a subscriber is in use. In most cases
    where the `log` feature is currently used (libraries that want to emit
    both `tracing` and `log` diagnostics for their users), this will not be
    necessary.
    
    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Sep 12, 2019
    Copy the full SHA
    f94ccf2 View commit details
    Browse the repository at this point in the history
  2. rustfmt

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Sep 12, 2019
    Copy the full SHA
    5dd613e View commit details
    Browse the repository at this point in the history
  3. unify macros

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Sep 12, 2019
    Copy the full SHA
    2baaee3 View commit details
    Browse the repository at this point in the history
  4. Update tracing/src/macros.rs

    Co-Authored-By: Sam Scott <sam@osohq.com>
    hawkw and samscott89 committed Sep 12, 2019
    Copy the full SHA
    94cc069 View commit details
    Browse the repository at this point in the history
  5. add missing feature flags

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Sep 12, 2019
    Copy the full SHA
    df761f7 View commit details
    Browse the repository at this point in the history
  6. fix tests

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Sep 12, 2019
    Copy the full SHA
    91afa83 View commit details
    Browse the repository at this point in the history

Commits on Sep 13, 2019

  1. Copy the full SHA
    64c6960 View commit details
    Browse the repository at this point in the history