-
Notifications
You must be signed in to change notification settings - Fork 847
fix(subscriber): make Layered propagate on_register_dispatch #3379
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
fix(subscriber): make Layered propagate on_register_dispatch #3379
Conversation
|
It seems like this was overlooked in #2269 |
b8ddabe to
a86f408
Compare
hds
left a comment
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.
Thanks for your PR! I've got a couple of comments.
a86f408 to
77aedec
Compare
hds
left a comment
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.
Looking great. Thank you! I've got one Question.
hds
left a comment
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.
Thanks you for all your work on this PR!
I'm preparing some releases and I wanted to get this in first, so I'm merging now. Thanks again!
|
Seems I was just a few minutes late with the negative test. I'll open a separate PR. |
In order to add a regression test, #3379 added support to `tracing-mock` to expect calls to `on_register_dispatch` for both mock subscribers and mock layers. A negative integration test for the layer case was included in #3415. However, there are no negative doctests for this (and as per my own suggestion, there's no negative test for the subscriber method either as I wasn't sure it was possible). After a bit of thought, I realised that we could include a negative test for the `MockSubscriber`. This change adds that test as a doctest, since we have those in almost all of our documentation and also includes the already written negative test for the `MockLayer` to a doctest.
## Motivation In order to add a regression test, #3379 added support to `tracing-mock` to expect calls to `on_register_dispatch` for both mock subscribers and mock layers. A negative integration test for the layer case was included in #3415. However, there are no negative doctests for this (and as per my own suggestion, there's no negative test for the subscriber method either as I wasn't sure it was possible). ## Solution After a bit of thought, I realised that we could include a negative test for the `MockSubscriber`. This change adds that test as a doctest, since we have those in almost all of our documentation and also includes the already written negative test for the `MockLayer` to a doctest.
# 0.3.21 (November 30, 2025) ### Fixed - Change registry exit to decrement local span ref only ([#3331]) - Make Layered propagate `on_register_dispatch` ([#3379]) ### Performance - Remove `clone_span` on enter (#3289) ### Documented - Fix a few small things in the format module ([#3339]) - Fix extra closing brace in layer docs ([#3350]) - Fix link in `FmtSpan` docs ([#3411]) [#3331]: https://github.com/tokio-rs/tracing/pull/#3331 [#3339]: https://github.com/tokio-rs/tracing/pull/#3339 [#3350]: https://github.com/tokio-rs/tracing/pull/#3350 [#3379]: https://github.com/tokio-rs/tracing/pull/#3379 [#3411]: https://github.com/tokio-rs/tracing/pull/#3411
# 0.3.21 (November 30, 2025) ### Fixed - Change registry exit to decrement local span ref only ([#3331]) - Make Layered propagate `on_register_dispatch` ([#3379]) ### Performance - Remove `clone_span` on enter ([#3289]) ### Documented - Fix a few small things in the format module ([#3339]) - Fix extra closing brace in layer docs ([#3350]) - Fix link in `FmtSpan` docs ([#3411]) [#3289]: https://github.com/tokio-rs/tracing/pull/#3289 [#3331]: https://github.com/tokio-rs/tracing/pull/#3331 [#3339]: https://github.com/tokio-rs/tracing/pull/#3339 [#3350]: https://github.com/tokio-rs/tracing/pull/#3350 [#3379]: https://github.com/tokio-rs/tracing/pull/#3379 [#3411]: https://github.com/tokio-rs/tracing/pull/#3411
# 0.3.21 (November 30, 2025) ### Fixed - Change registry exit to decrement local span ref only ([#3331]) - Make Layered propagate `on_register_dispatch` ([#3379]) ### Performance - Remove `clone_span` on enter ([#3289]) ### Documented - Fix a few small things in the format module ([#3339]) - Fix extra closing brace in layer docs ([#3350]) - Fix link in `FmtSpan` docs ([#3411]) [#3289]: https://github.com/tokio-rs/tracing/pull/#3289 [#3331]: https://github.com/tokio-rs/tracing/pull/#3331 [#3339]: https://github.com/tokio-rs/tracing/pull/#3339 [#3350]: https://github.com/tokio-rs/tracing/pull/#3350 [#3379]: https://github.com/tokio-rs/tracing/pull/#3379 [#3411]: https://github.com/tokio-rs/tracing/pull/#3411
# 0.3.21 (November 26, 2025) ### Fixed - Change registry exit to decrement local span ref only ([#3331]) - Make Layered propagate `on_register_dispatch` ([#3379]) ### Changed - `tracing`: updated to 0.1.42 ([#3418]) ### Performance - Remove `clone_span` on enter ([#3289]) ### Documented - Fix a few small things in the format module ([#3339]) - Fix extra closing brace in layer docs ([#3350]) - Fix link in `FmtSpan` docs ([#3411]) [#3289]: https://github.com/tokio-rs/tracing/pull/#3289 [#3331]: https://github.com/tokio-rs/tracing/pull/#3331 [#3339]: https://github.com/tokio-rs/tracing/pull/#3339 [#3350]: https://github.com/tokio-rs/tracing/pull/#3350 [#3379]: https://github.com/tokio-rs/tracing/pull/#3379 [#3411]: https://github.com/tokio-rs/tracing/pull/#3411 [#3418]: https://github.com/tokio-rs/tracing/pull/#3418
# 0.3.21 (November 26, 2025) ### Fixed - Change registry exit to decrement local span ref only ([#3331]) - Make Layered propagate `on_register_dispatch` ([#3379]) ### Changed - `tracing`: updated to 0.1.42 ([#3418]) ### Performance - Remove `clone_span` on enter ([#3289]) ### Documented - Fix a few small things in the format module ([#3339]) - Fix extra closing brace in layer docs ([#3350]) - Fix link in `FmtSpan` docs ([#3411]) [#3289]: https://github.com/tokio-rs/tracing/pull/#3289 [#3331]: https://github.com/tokio-rs/tracing/pull/#3331 [#3339]: https://github.com/tokio-rs/tracing/pull/#3339 [#3350]: https://github.com/tokio-rs/tracing/pull/#3350 [#3379]: https://github.com/tokio-rs/tracing/pull/#3379 [#3411]: https://github.com/tokio-rs/tracing/pull/#3411 [#3418]: https://github.com/tokio-rs/tracing/pull/#3418
Motivation
The
Layeredimplementation ofSubscriberdoes not implement and propagate theon_register_dispatchcallback. This means that combined layers will never have theiron_register_dispatchmethods called.Solution
Implement the missing
on_register_dispatchmethod.