mirror of
https://github.com/tokio-rs/tracing.git
synced 2025-10-02 07:20:35 +00:00

Fixes #24. Requires #34. Currently, spans and events both have `std::time::Instant` fields that record a timestamp of when the span or event was created. Furthermore, the `Subscriber::enter` and `Subscriber::exit` trait methods take an `Instant` argument representing a timestamp of when the span was entered or exited. As described in #24, this is a potential performance issue, as `Instant::now` may result in an expensive syscall. Since some subscriber implementations may not need timestamps, or may not need to record them for _all_ possible events, we should not perform these syscalls by default. This branch removes the timestamps from spans and events, and from the `Subscriber` API. If subscribers require timestamps for events or spans, they can call `Instant::now` or `SystemTime::now`. This has the side benefit of allowing subscriber implementations to choose what timestamp type is appropriate for their use case. Since event and span entry/exit notifications are broadcast to subscribers synchronously as they occur, if a subscriber records a timestamp itself, it should still be sufficiently accurate. This branch requires PR #34 to be merged first, so that span identifiers may be used for testing span equality, rather than the timestamps. Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Description
Languages
Rust
99.8%
Shell
0.2%