-
Notifications
You must be signed in to change notification settings - Fork 754
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
Why is new_span(&self) and not &mut self? #176
Comments
A subscriber may be shared across multiple threads, so it's not possible to have any methods on the There's an issue (#157) for providing a fast concurrent store for span data as a library for subscriber implementors to depend on — there are some optimizations that we can likely make that are specific to the |
So the subscriber itself isn't protected or on the other side of an mpsc or similar? I guess the idea is this can allow different consumers to get some performance gains if they don't need as much protection? |
Yeah, that's right! What data a subscriber stores, and how it stores that data, could vary wildly based on the behaviour it implements: some might not store any data at all, and just write it all to some form of I/O immediately, for example, and others might only store data for a subset of spans or events. Therefore, we determined that this should be left up to the subscriber implementation in The plan is that the |
Interestingly, I cannot protect my |
I think probably it would be very useful if the |
Feature Request
Motivation
It seems like the whole purpose of the
new_span
API is to store data about the new span and associate it with an id. The data will need to be stored in most cases since the event/enter/etc APIs only pass an id. However,new_span
does not take self mutably, so one must resort to hacks in order to store the data anywhere.Proposal
new_span
should take&mut self
Alternatives
mut self
? Probably not needed.The text was updated successfully, but these errors were encountered: