Add more subscription stats #2560
Merged
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 of Changes
This adds some gauges related to subscriptions, and adds the reporting to the periodic metric task (instead of updating them each time a subscriber is added or removed). Previously, we just had the number of unique queries. This adds:
spacetime_subscription_connections: The number of connections that are subscribed to something.spacetime_subscription_sets: The number of active subscription sets (since clients subscribe to a set at a time)spacetime_query_subscriptions: The sum of the number of subscribers for each query. For example, if 10 clients each subscribed to the same 5 queries, this would be 50.spacetime_legacy_subscriptions: The number of subscriptions that exist with the old API. We should just check that this is 0 at some point.spacetime_query_subscriptionsis probably the most important one to add, since it gives a better sense of how much fanout is possible.We recompute/update these periodically in the
metrics_taskfor theHost. I added a todo to unregister these when the host is shut down, because the lifecycle is a little messy right now.API and ABI breaking changes
Expected complexity level and risk
Testing
I did a little manual testing locally.