mirror of
https://github.com/tokio-rs/tracing.git
synced 2025-09-30 14:30:42 +00:00

## Motivation The `tracing-tower` crate for compatibility with `tower` is currently pretty half-baked and incomplete, and doesn't conver a majority of use-cases. ## Solution This branch completely rewrites the `tracing-tower` support crate, hopefully making it more useful. We now provide a set of `request_span` middleware for instrumenting a service so that each request passing through it is instrumented with its own span, and a set of `service_span` metadata that instruments the entire service with a single span. Additionally, there are now implementations of `Layer` and `MakeService`, when the `tower-layer` and `tower-util` crates are also in use. Finally, I've reworked the `InstrumentableService` extension trait a bit to make it easier to implement services in different ways, although the old behaviour of `InstrumentableService::instrument` is unchanged (I've heard @LucioFranco is using this in prod...). Most of the functionality of the `tracing-tower-http` crate can now be reimplemented using the new `tracing-tower` crate (and a feature-flagged `http` dependency), so that crate should _probably_ now be deprecated. I've reimplemented its example using `tracing-tower`. Signed-off-by: Eliza Weisman <eliza@buoyant.io>