diff options
author | Eliza Weisman <eliza@buoyant.io> | 2019-03-26 16:43:05 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-26 16:43:05 -0700 |
commit | d8177f81ac671a7667fb59f24ba9e2cdb7d3fe77 (patch) | |
tree | bfb7fdfb12503744948dc6bbb07ef92531f3b4bb /.cirrus.yml | |
parent | ceca2a3cd65aadc4f28160c34653bd7d4446ad89 (diff) |
trace: Allow trace instrumentation to emit log records (#992)
## Motivation
`tokio-trace` currently offers a strategy for compatibility with the
`log` crate: its macros can be dropped in as a replacement for `log`'s
macros, and a subscriber can be used that translates trace events to log
records. However, this requires the application to be aware of
`tokio-trace` and manually set up this subscriber.
Many libraries currently emit `log` records, and would like to be able
to emit `tokio-trace` instrumentation instead. The `tokio` runtimes are
one such example. However, with the current log compatibility strategy,
replacing existing logging with trace instrumentation would break
`tokio`'s logs for any downstream user which is using only `log` and not
`tokio-trace`. It is desirable for libraries to have the option to emit
both `log` _and_ `tokio-trace` diagnostics from the same instrumentation
points.
## Solution
This branch adds a `log` feature flag to the `tokio-trace` crate, which
when set, causes `tokio-trace` instrumentation to emit log records as well
as `tokio-trace` instrumentation.
## Notes
In order to allow spans to log their names when they are entered and
exited even when the span is disabled, this branch adds an
`&'static Metadata` to the `Span` type. This was previously stored in
the `Inner` type and was thus only present when the span was enabled.
This makes disabled spans one word longer, but enabled spans remain
the same size.
Fixes: #949
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Diffstat (limited to '.cirrus.yml')
-rw-r--r-- | .cirrus.yml | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/.cirrus.yml b/.cirrus.yml index 053ce41e..922c5bee 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -32,6 +32,7 @@ task: test_script: - . $HOME/.cargo/env - cargo test --all --no-fail-fast + - (cd tokio-trace/test-log-support && cargo test) - (cd tokio-trace/test_static_max_level_features && cargo test) - cargo doc --all i686_test_script: |