-
Notifications
You must be signed in to change notification settings - Fork 43
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
chore: track backoff time for connected peers #445
Conversation
src/index.ts
Outdated
for (const backoff of this.backoff.values()) { | ||
backoffSize += backoff.size | ||
for (const [peer, expiredMs] of backoff.entries()) { | ||
if (this.peers.has(peer)) { | ||
metrics.connectedPeersBackoffSec.observe((expiredMs - now) / 1000) |
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.
Reset the histogram values above to have a read of current status. Similar to Lodestar's gossipsub metrics. Also record only positive numbers or histograms render poorly Math.max(0, expiredMs - now) / 1000
src/metrics.ts
Outdated
connectedPeersBackoffSec: register.histogram({ | ||
name: 'gossipsub_connected_peers_backoff_seconds', | ||
help: 'Backoff time in seconds', | ||
buckets: [1, 2, 4, 8, 16, 32, 64, 128, 256] |
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.
Values could align more with spec parameters such that
[1,2,4,10,20,60,120]
also do add a comment like:
Using 1 seconds as minimum as that's close to the heartbeat duration, no need for more resolution.
As per spec, backoff times are 10 seconds for UnsubscribeBackoff and 60 seconds for PruneBackoff.
Higher values of 60 seconds should not occur, but we add 120 seconds just in case
https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.1.md#overview-of-new-parameters
291e4c2
to
ff794b4
Compare
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## master #445 +/- ##
==========================================
- Coverage 82.51% 82.39% -0.13%
==========================================
Files 48 48
Lines 11966 11984 +18
Branches 1279 1279
==========================================
Hits 9874 9874
- Misses 2092 2110 +18
☔ View full report in Codecov by Sentry. |
Motivation
Description
Closes Track backoff times in connected peers #442