-
Notifications
You must be signed in to change notification settings - Fork 741
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
subscriber: explain why we always call inner.register_callsite()
before if statement
#1433
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is correct. register_callsite
is not just responsible for performing filtering, it's also responsible for notifying the collector of the existence of the callsite --- it may choose to, for example, store some data for that callsite. This change means that if the outer Subscriber
returns Interest::sometimes
, the inner subscriber will never have the opportunity to register a callsite that is enabled.
If the subscriber, for example, preallocates storage for spans originating at particular callsites, it may then see a span from a callsite that it never had the opportunity to prepare storage for. The intention behind calling inner.register_callsite
before the if
statement was to ensure that the inner subscriber is informed that the callsite exists regardless of the outer subscriber's filtering decision. So, I think this change would actually introduce a bug.
Perhaps a better solution is to add a comment on that line explaining why we always call register_callsite
on inner
?
…fore if statement
7eece07
to
617ccfd
Compare
register_callsite()
callinner.register_callsite()
before if statement
Thanks, @hawkw. You're right. I have updated the comments. ❤️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks!
…fore if statement (#1433) This backports #1433 from `master`. * subscriber: explain why we always call `inner.register_callsite()` before if statement * Apply suggestions from code review Co-authored-by: Eliza Weisman <[email protected]>
…fore if statement (#1433) This backports #1433 from `master`. * subscriber: explain why we always call `inner.register_callsite()` before if statement * Apply suggestions from code review Co-authored-by: Eliza Weisman <[email protected]>
…fore if statement (tokio-rs#1433) This backports tokio-rs#1433 from `master`. * subscriber: explain why we always call `inner.register_callsite()` before if statement * Apply suggestions from code review Co-authored-by: Eliza Weisman <[email protected]>
I'm sure we can avoid unnecessary
self.inner.register_callsite()
call in these twoLayered
implementations.