Skip to content

Conversation

@patrick-ogrady
Copy link
Contributor

@patrick-ogrady patrick-ogrady commented Jan 4, 2026

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.

  • When blocked: set gauge to the expiry timestamp (epoch millis)
  • When unblocked: remove the metric entry via Family.remove()
  • Only currently blocked peers appear in metrics
  • Remaining block time can be computed via PromQL: blocked - time() * 1000

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]>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 4, 2026

Deploying monorepo with  Cloudflare Pages  Cloudflare Pages

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

View logs

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 4, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
commonware-mcp f64ce6a Jan 06 2026, 02:53 PM

@patrick-ogrady patrick-ogrady marked this pull request as ready for review January 6, 2026 01:13
@patrick-ogrady
Copy link
Contributor Author

Would be cool if we could store with the expiry time?

patrick-ogrady and others added 2 commits January 5, 2026 17:26
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]>
@patrick-ogrady patrick-ogrady self-assigned this Jan 6, 2026
@patrick-ogrady patrick-ogrady moved this to Ready for Review in Tracker Jan 6, 2026
@patrick-ogrady patrick-ogrady added this to the v0.1.0 milestone Jan 6, 2026
danlaine
danlaine previously approved these changes Jan 6, 2026
Copy link
Collaborator

@danlaine danlaine left a 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.

@patrick-ogrady
Copy link
Contributor Author

Do we want to add a test that checks the expiry time in the 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.

@patrick-ogrady patrick-ogrady added this pull request to the merge queue Jan 6, 2026
Merged via the queue into main with commit 25b52d4 Jan 6, 2026
126 of 127 checks passed
@patrick-ogrady patrick-ogrady deleted the patrick/return-blocked-family branch January 6, 2026 16:45
@github-project-automation github-project-automation bot moved this from Ready for Review to Done in Tracker Jan 6, 2026
@codecov
Copy link

codecov bot commented Jan 6, 2026

Codecov Report

❌ Patch coverage is 90.12346% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.82%. Comparing base (45b0c9a) to head (f64ce6a).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
...uthenticated/discovery/actors/tracker/directory.rs 90.12% 16 Missing ⚠️
...c/authenticated/lookup/actors/tracker/directory.rs 90.12% 16 Missing ⚠️
@@            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     
Files with missing lines Coverage Δ
.../authenticated/discovery/actors/tracker/metrics.rs 100.00% <ø> (ø)
...src/authenticated/lookup/actors/tracker/metrics.rs 100.00% <ø> (ø)
...uthenticated/discovery/actors/tracker/directory.rs 92.27% <90.12%> (+0.39%) ⬆️
...c/authenticated/lookup/actors/tracker/directory.rs 92.97% <90.12%> (+0.24%) ⬆️

... and 87 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 45b0c9a...f64ce6a. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants