Skip to content

Why is there an indirection from span::Id to registry::SpanRef via Context/LookupSpan? #1691

Answered by hawkw
Swatinem asked this question in Q&A
Discussion options

You must be logged in to vote

I think maybe the reasoning for all this comes from the fact that the core tracing API only outputs a flat stream of span events, and has no notion of hierarchy and attached data at all?
Registry would be the thing that offers this functionality, making sure that spans are put into a hierarchy, and that they can have data attached to them, right?

This is correct. Depending on the use-case, it may be desirable to not store span data in the program at all, and simply write that data out to a file or network IO immediately. Therefore, we chose not to make in-memory storage of any span data a core part of tracing, and instead, made it opt-in when required.

For example, I've seen tracing use…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by Swatinem
Comment options

You must be logged in to vote
1 reply
@davidbarsky
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants