Fix topic statistics source collision for multiple subscriptions#3171
Open
Saigirish23 wants to merge 1 commit into
Open
Fix topic statistics source collision for multiple subscriptions#3171Saigirish23 wants to merge 1 commit into
Saigirish23 wants to merge 1 commit into
Conversation
Signed-off-by: Saigirish23 <b24me1066@iitj.ac.in>
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.
Description
When topic statistics are enabled for multiple subscriptions within the same node,
all statistics messages currently use the same
measurement_source_namebecause
SubscriptionTopicStatisticsonly uses the node name when constructingthe source identifier.
This makes it difficult to determine which subscription produced a particular
statistics message when a node subscribes to multiple topics.
This PR addresses the issue by including the subscribed topic name in the
statistics source identifier. The resulting identifier is constructed as
node_name/topic_name, allowing statistics from different subscriptions withinthe same node to be distinguished.
Changes included in this PR:
SubscriptionTopicStatisticsto accept the subscribed topic name.test_multiple_subscriptions_differentiated) to verify that statistics generated by multiple subscriptions in the same node have distinct source identifiers.Fixes #2756
Is this user-facing behavior change?
Yes.
When topic statistics are enabled, statistics messages published on
/statisticswill now contain uniquemeasurement_source_namevalues fordifferent subscriptions within the same node. This makes it possible to
correctly identify which subscription produced a given statistics message.
Did you use Generative AI?
Yes.
I used ChatGPT (GPT-5.5) to assist with investigating the issue, discussing
possible implementation approaches, reviewing code changes, and drafting parts
of the regression test and PR description. All code changes, testing, and final
content were reviewed and validated manually.
Additional Information
A similar fix was initially proposed for the Humble branch, but it could not be
merged because the required constructor change introduces an API change that is
not suitable for a stable release. This PR targets the Rolling branch, where
such changes are permitted.