While we're making breaking changes to `tokio-trace`, it would be good to get rid of the `AsId` trait. The goal of span functions that are generic over `Span`/`Id` can be achieved without the unnecessary complexity of defining a new trait. This would also make the API added to `tokio_trace_core::Event` in #1109 more consistent with the `tokio-trace::Span` API. This branch removes `AsId` from `tokio-trace` and replaces its uses with `impl Into<Option<Id>>` and `impl Into<Option<&'a Id>>`. While `AsRef` might be more semantically correct for the borrowed-`Id` conversion, its signature doesn't permit conversion into an `Option`. Implementations of `Into<Option<Id>>` and `Into<Option<&'a Id>>` have been added for `tokio_trace::Span`. This is _technically_ a breaking API change, as it changes function signatures. However, the existing macro syntax still works as-is, and the tests which pass `&Id`, `&Span`, and `&Option<Id>` to the span macros all still compile after this change. Closes #1143 Signed-off-by: Eliza Weisman <[email protected]>
tokio-trace-core
Core primitives for tokio-trace.
Overview
tokio-trace is a framework for instrumenting Rust programs to collect
structured, event-based diagnostic information. This crate defines the core
primitives of tokio-trace.
The crate provides:
-
Spanidentifies a span within the execution of a program. -
Eventrepresents a single event within a trace. -
Subscriber, the trait implemented to collect trace data. -
Field,FieldSet,Value, andValueSetrepresent the structured data attached to aSpan. -
Dispatchallows span events to be dispatched toSubscribers.
In addition, it defines the global callsite registry and per-thread current dispatcher which other components of the tracing system rely on.
Application authors will typically not use this crate directly. Instead, they
will use the tokio-trace crate, which provides a much more fully-featured
API. However, this crate's API will change very infrequently, so it may be used
when dependencies must be very stable.
License
This project is licensed under the MIT license.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Tokio by you, shall be licensed as MIT, without any additional terms or conditions.