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

Subscription count metrics is always returning 0 #125

Open
jayeshkm opened this issue Nov 29, 2024 · 3 comments
Open

Subscription count metrics is always returning 0 #125

jayeshkm opened this issue Nov 29, 2024 · 3 comments

Comments

@jayeshkm
Copy link

Subscribing to topic $SYS/broker/subscriptions/count always returns subscription count as 0 even though there are valid subscriptions

@halfgaar
Copy link
Owner

You're right, it should be fixed. I had to disable it at some point because counting it accurately was causing too much load. At least with that implementation. It needs refactor.

@jayeshkm
Copy link
Author

jayeshkm commented Dec 2, 2024

I have not went in depth into the code, but I see subscriptionCount variable in subscription store. Can we just return that?

@halfgaar
Copy link
Owner

halfgaar commented Dec 3, 2024

No, it's more complicated. It has to do with how sessions are added to the subscription tree as weak pointers. They will expire sooner or later, but this can't easily be tracked.

I may make the subscription counter indicative instead of 100% correct. It can be recalculated upon certain internal maintenance jobs, but that means that the count will be (a bit) higher than factually correct.

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

No branches or pull requests

2 participants