-
-
Notifications
You must be signed in to change notification settings - Fork 107
Open
Labels
A-networkingArea: Networking, ring protocol, peer discoveryArea: Networking, ring protocol, peer discoveryE-mediumExperience needed to fix/implement: Medium / intermediateExperience needed to fix/implement: Medium / intermediateT-enhancementType: Improvement to existing functionalityType: Improvement to existing functionality
Description
Summary
The Meter struct in crates/core/src/topology/meter.rs provides infrastructure for tracking resource usage (bandwidth) attributed to peers and delegates, but it's not currently wired up.
Current State
MetertracksInboundBandwidthBytesandOutboundBandwidthBytesperAttributionSource(Peer or Delegate)- Uses running averages with configurable window sizes
- Has caching for estimated usage rates
- The
report()method is marked#[allow(dead_code)]with// fixme: use this
Why This Matters
Resource usage tracking would enable:
- Fair resource allocation - identify peers/delegates consuming disproportionate bandwidth
- Abuse prevention - detect and throttle misbehaving actors
- Capacity planning - understand actual resource consumption patterns
- Contract storage decisions - factor resource cost into seeding/eviction (related but separate concern)
Suggested Approach
- Identify bandwidth consumption points in the networking code
- Call
meter.report()at those points with appropriate attribution - Expose usage metrics via the node API for monitoring
- Consider using the data to inform routing/throttling decisions
Related Code
crates/core/src/topology/meter.rs- the Meter implementationcrates/core/src/topology/rate.rs- Rate type used by Metercrates/core/src/topology/running_average.rs- RunningAverage used internally
[AI-assisted - Claude]
Metadata
Metadata
Assignees
Labels
A-networkingArea: Networking, ring protocol, peer discoveryArea: Networking, ring protocol, peer discoveryE-mediumExperience needed to fix/implement: Medium / intermediateExperience needed to fix/implement: Medium / intermediateT-enhancementType: Improvement to existing functionalityType: Improvement to existing functionality
Type
Projects
Status
Triage