The chrome trace viewer requires events within a thread to strictly nest.
So we need to record the lifetime of the Span objects, not the contexts.
But we still want to show the relationship between spans where a context crosses
threads, so do this with flow events (i.e. arrows).
Before: https://photos.app.goo.gl/q4Dd9u9xtelaXk1v1
After: https://photos.app.goo.gl/5RNLmAMLZR3unvY83
(This could stand some further improvement, in particular I think we want a
container span whenever we schedule work on a thread. But that's another patch)
It feels awkward that endSpan() does not have any parameters explicitly connecting it to beginSpan().
We could change beginSpan() to return a callback that would be called when Span ends instead, that would make the connection clear, albeit it's not very useful for JSONTracer.
Not sure we should change it, just thinking out loud :-)