jonhoo / tracing-timing

Inter-event timing metrics on top of tracing.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Track span timing in addition to inter-event timing

david-mcgillicuddy-moixa opened this issue · comments

Hi, I might be misunderstanding how this library works but it looks to me like spans are only tracked in order to label their events. I would like to be able to track the spans themselves, so it can be used with e.g. the #[instrument] macro.

It's certainly possible to make a span wrapper that emits an event on start and end but it seems a bit superfluous. Currently my proof of concept was just https://gist.github.com/david-mcgillicuddy-moixa/e925cd78d48a8c3324414ee492532b14

So, tracing-timing aims to give you information about time spent in various parts of a "family" of spans. For example, if each request is given its own span, but those spans share a name, then you'll get aggregate states for the time distributions of the events within those spans collectively.

It sounds like what you're looking for is a histogram of the total time spent in each span, is that right? If so, I think the way we'd do that is to add a line near

// reclaim its id

which takes the current time, subtracts it from the span's start time, which you'd record in here:
let sg = SpanGroupContext {

You'd then write some code that's essentially a simplified version of fn time to record an extra "full time" event.

Any progress on this?

I think span close events (#12) addresses this.

Yup, looks like it does thanks.