-
Notifications
You must be signed in to change notification settings - Fork 169
[p2p] Add Blocked Peers to Metrics #2687
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
Conversation
Change the blocked metric from a simple Gauge (count) to a Family<Peer, Gauge> that reports which specific peers are blocked. This enables debugging by showing exactly who is blocked, while still supporting count computation via PromQL. - When blocked: set gauge to 1 for that peer - When unblocked: remove the metric entry via Family.remove() - Only currently blocked peers appear in metrics 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Deploying monorepo with
|
| Latest commit: |
f64ce6a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9aa708dc.monorepo-eu0.pages.dev |
| Branch Preview URL: | https://patrick-return-blocked-famil.monorepo-eu0.pages.dev |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
commonware-mcp | f64ce6a | Jan 06 2026, 02:53 PM |
|
Would be cool if we could store with the expiry time? |
Change the blocked metric from storing 1 (boolean indicator) to storing the expiry timestamp as epoch millis. This allows monitoring systems to see both which peers are blocked and when each block expires. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Use .get().is_some() to check if a peer is blocked instead of .get_or_create().get() > 0. Use .get().is_none() to check if a peer is not blocked instead of .get_or_create().get() == 0. This avoids creating metric entries as a side effect of test assertions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to add a test that checks the expiry time in blocked? e.g. Block a peer, get the expiry time, unblock them, re-block them, get the new expiry time and assert that it's greater than the old one.
IIRC we already have tests that check this but if not, definitely. |
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #2687 +/- ##
==========================================
+ Coverage 92.77% 92.82% +0.05%
==========================================
Files 362 361 -1
Lines 106074 107035 +961
==========================================
+ Hits 98412 99359 +947
- Misses 7662 7676 +14
... and 87 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Related: #2570
Change the blocked metric from a simple Gauge (count) to a Family<Peer, Gauge> that reports which specific peers are blocked and when each block expires. This enables debugging by showing exactly who is blocked and for how long.
blocked - time() * 1000