-
Notifications
You must be signed in to change notification settings - Fork 847
tracing-subscriber: refactor timings #3038
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
base: master
Are you sure you want to change the base?
Conversation
This commit refactors the `Timings` struct to use `Duration` instead of `u64` to store the idle and busy times of a span, and moves the logic to update the timings to the `Timings` struct itself. This commit also introduces a `display` method to the `Timings` struct that returns the idle and busy times as `HumanReadableDuration` instances (renamed from `TimingDisplay`). Replaces: tokio-rs#2944
mladedav
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this more than #2944 👍
|
What about renaming this to SpanTimings instead of Timings? It's currently private, so this isn't breaking. Side note: |
This allows for the timing subscriber logic to be composed and used by any subscriber rather than just users of the fmt subscriber. TODO: work out how to properly configure the fmt subscriber to use the timing subscriber as a layer. Fixes: tokio-rs#2946 Replaces: tokio-rs#3038
|
Hey maintainers, any thoughts about moving forward with this? |
Motivation
This makes the
fmt::Subscribercode a bit simpler, and preps theTimingtype for lifting elsewhere (e.g. to be made public and partof a timing layer instead of hidden within this Subscriber) (see
#2946)
Solution
This commit refactors the
Timingsstruct to useDurationinstead ofu64to store the idle and busy times of a span, and moves the logic toupdate the timings to the
Timingsstruct itself. This commit alsointroduces a
displaymethod to theTimingsstruct that returns theidle and busy times as
HumanReadableDurationinstances (renamed fromTimingDisplay).Replaces: #2944