fix(subscriber): make Layered propagate on_register_dispatch#3379
Merged
hds merged 4 commits intotokio-rs:mainfrom Nov 24, 2025
Merged
Conversation
Contributor
Author
|
It seems like this was overlooked in #2269 |
This was referenced Sep 29, 2025
b8ddabe to
a86f408
Compare
hds
requested changes
Nov 20, 2025
Contributor
hds
left a comment
There was a problem hiding this comment.
Thanks for your PR! I've got a couple of comments.
a86f408 to
77aedec
Compare
hds
reviewed
Nov 21, 2025
Contributor
hds
left a comment
There was a problem hiding this comment.
Looking great. Thank you! I've got one Question.
hds
reviewed
Nov 24, 2025
hds
approved these changes
Nov 24, 2025
Contributor
hds
left a comment
There was a problem hiding this comment.
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!
Contributor
Author
|
Seems I was just a few minutes late with the negative test. I'll open a separate PR. |
Contributor
Author
hds
added a commit
that referenced
this pull request
Nov 24, 2025
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.
hds
added a commit
that referenced
this pull request
Nov 24, 2025
## 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.
hds
added a commit
that referenced
this pull request
Nov 25, 2025
# 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
hds
added a commit
that referenced
this pull request
Nov 25, 2025
# 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
hds
added a commit
that referenced
this pull request
Nov 25, 2025
# 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
hds
added a commit
that referenced
this pull request
Nov 26, 2025
# 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
hds
added a commit
that referenced
this pull request
Nov 26, 2025
# 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.