chore: add subscription activation and per-program metrics#929
chore: add subscription activation and per-program metrics#929
Conversation
Manual Deploy AvailableYou can trigger a manual deploy of this PR branch to testnet: Alternative: Comment
Comment updated automatically when the PR is synchronized. |
📝 WalkthroughWalkthroughThe changes add new observability metrics to track account subscription activations and per-program account updates across the codebase. Two new metrics are introduced in the metrics module: Suggested reviewers
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@magicblock-metrics/src/metrics/mod.rs`:
- Around line 301-309: The metric PER_PROGRAM_ACCOUNT_UPDATES_COUNT currently
uses a free-form "program" label which can explode Prometheus cardinality;
change this by replacing the free-form label with a bounded alternative: either
remove the "program" label and aggregate by client only, introduce a
validated/allowlisted program label (accept only known program IDs) or map
program IDs to a fixed set of buckets/hashes (e.g., canonical names or safe
short buckets) before incrementing the IntCounterVec; implement the guard in the
code path that calls
PER_PROGRAM_ACCOUNT_UPDATES_COUNT.inc_with_label_values(...) so only
allowed/mapped values are used, or add a sanitization function (e.g.,
map_program_label) referenced where the metric is updated to enforce the bounded
set.
* master: chore: add subscription activation and per-program metrics (#929)
Summary
Add metrics for tracking gRPC subscription activations and per-program account updates to
better monitor subscription behavior and account update patterns.
Details
Added two new metrics to track subscription and account update activity:
Subscription Activation Tracking
account_subscription_activations_count: Tracks when new account subscriptions are activated, labeled byclient_idPer-Program Account Updates
per_program_account_updates_count: Tracks all account updates received grouped by program ID, labeled by bothclient_idandprogramprogram_subscription_account_updates_countdescription to clarify it only counts updates matching existing subscriptionsSummary by CodeRabbit
Release Notes