Skip to content
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

[Issue-10611] consumer related topic stats only available while consumer or reader are connected #10644

Merged
merged 1 commit into from
May 21, 2021

Conversation

dlg99
Copy link
Contributor

@dlg99 dlg99 commented May 19, 2021

(If this PR fixes a github issue, please add Fixes #<xyz>.)

Fixes #10611

Motivation

Stats report wrong values when consumers unsubscribe.

Modifications

Preserved specific stats for the consumer on its removal.

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change added tests and can be verified as follows:

  • Added unit tests for persistent and non-persistent topics to check that specific counters preserved after consumers/producers removal. Tests failed before the fix.

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): (NO
  • The public API: NO
  • The schema: NO
  • The default values of configurations: NO
  • The wire protocol: NO
  • The rest endpoints: NO
  • The admin cli options: NO
  • Anything that affects deployment: NO

Documentation

  • Does this pull request introduce a new feature? NO

subscriptions.remove(subscriptionName);
PersistentSubscription sub = subscriptions.remove(subscriptionName);
// preserve accumulative stats form removed subscription
SubscriptionStats stats = sub.getStats(false, false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it'd be worth adding specific getters for the two counters we want here? I am specifically concerned about the overhead of building out the whole SubscriptionStats object many times. I'm not sure how expensive the getStats method really is, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removeSubscription does not happen that frequently.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right. I had been thinking of consumers, not subscriptions.

Copy link
Member

@michaeljmarshall michaeljmarshall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@eolivelli
Copy link
Contributor

@codelipenghui PTAL

@codelipenghui codelipenghui merged commit bad185a into apache:master May 21, 2021
@codelipenghui codelipenghui added this to the 2.8.0 milestone May 21, 2021
yangl pushed a commit to yangl/pulsar that referenced this pull request Jun 23, 2021
@dlg99 dlg99 deleted the topic-counters branch October 14, 2021 23:30
bharanic-dev pushed a commit to bharanic-dev/pulsar that referenced this pull request Mar 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

consumer related topic stats only available while consumer or reader are connected
4 participants