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

subscriber: add Targets filter, a lighter-weight EnvFilter #1550

Merged
merged 12 commits into from Sep 12, 2021

Commits on Sep 10, 2021

  1. factor out static directives for target filter

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Sep 10, 2021
    Configuration menu
    Copy the full SHA
    ad3c782 View commit details
    Browse the repository at this point in the history
  2. make directive sets smallvec

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Sep 10, 2021
    Configuration menu
    Copy the full SHA
    6d4215a View commit details
    Browse the repository at this point in the history

Commits on Sep 11, 2021

  1. subscriber: add Targets filter, a lighter-weight EnvFilter

    This branch adds a new `Targets` filter to `tracing_subscriber`. The
    `Targets` filter is very similar to `EnvFilter`, but it _only_ consists
    of filtering directives consisting of a target and level. Because it
    doesn't support filtering on field names, span contexts, or field
    values, the implementation is *much* simpler, and it doesn't require the
    `env_filter` feature flag. Also, `Targets` can easily implement the
    `Filter` trait for per-layer filtering, while adding a `Filter`
    implementation for `EnvFilter` will require additional effort.
    
    Because the `Targets` filter doesn't allow specifiyng span or
    field-value filters, the syntax for parsing one from a string is
    significantly simpler than `EnvFilter`'s. Therefore, it can have a very
    simple handwritten parser implementation that doesn't require the
    `regex` crate. This should be useful for users who are concerned about
    the number of dependencies required by `EnvFilter`.
    
    The new implementation is quite small, as it mostly uses the same code
    as the static filter subset of `EnvFilter`. This code was factored out
    into a shared module for use in both `EnvFilter` and `Targets`. The code
    required for _dynamic_ filtering with `EnvFilter` (i.e. on fields and
    spans) is still in the `filter::env` module and is only enabled by the
    `env-filter` feature flag.
    
    I'm open to renaming the new type; I thought `filter::Targets` seemed
    good, but would also be willing to go with `TargetFilter` or something.
    hawkw committed Sep 11, 2021
    Configuration menu
    Copy the full SHA
    81bd477 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    33f030f View commit details
    Browse the repository at this point in the history
  3. doctests fixy

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Sep 11, 2021
    Configuration menu
    Copy the full SHA
    9ec9ae3 View commit details
    Browse the repository at this point in the history
  4. add example mixing PLF and global filters

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Sep 11, 2021
    Configuration menu
    Copy the full SHA
    ffcac85 View commit details
    Browse the repository at this point in the history
  5. directive::ParseError -> DirectiveParseError

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Sep 11, 2021
    Configuration menu
    Copy the full SHA
    fe8dc29 View commit details
    Browse the repository at this point in the history
  6. Merge branch 'eliza/target-filter' of github.com:tokio-rs/tracing int…

    …o eliza/target-filter
    hawkw committed Sep 11, 2021
    Configuration menu
    Copy the full SHA
    a1e3167 View commit details
    Browse the repository at this point in the history
  7. make bounds consistent

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Sep 11, 2021
    Configuration menu
    Copy the full SHA
    0bb8e97 View commit details
    Browse the repository at this point in the history
  8. handle extra trailing garbage in FromStr impl

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Sep 11, 2021
    Configuration menu
    Copy the full SHA
    26e5833 View commit details
    Browse the repository at this point in the history
  9. rm bonus whitespace

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Sep 11, 2021
    Configuration menu
    Copy the full SHA
    e82bb0c View commit details
    Browse the repository at this point in the history
  10. comment parser/misc review feedback

    Signed-off-by: Eliza Weisman <eliza@buoyant.io>
    hawkw committed Sep 11, 2021
    Configuration menu
    Copy the full SHA
    c904879 View commit details
    Browse the repository at this point in the history