You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Implement a per-region bandwidth accounting log so operators can see how much data was served to and from each geographic region for capacity planning and regulatory compliance reporting #750
kind:featureNew capability or a change to current behaviorprio:lowWhen convenientrustDependabot: a Cargo update; use area: labels for Rust code otherwise
The node currently tracks per-peer reputation and payment vouchers but has no aggregated view of bytes served broken down by the region field from NodeAnnounce. A structured periodic log or admin endpoint showing bytes-in/bytes-out per region would help operators optimize regional capacity bonding and satisfy any data-residency reporting requirements.
This feature request asks for per-region bytes-in/bytes-out accounting surfaced via a structured periodic log or admin endpoint. The region dimension would come from the region field in NodeAnnounce gossip messages. The stated use cases are capacity-bonding optimization and data-residency/regulatory compliance reporting.
The request is underspecified in a few ways: it doesn't propose where the state lives (e.g. reputation crate EWMA-style, or a new node-level counter map), what the admin RPC shape would look like, or how region attribution flows from the serving handler to the accounting layer. It also touches ADR 036 territory (bytesPerEpoch / FeeRouter) and the existing decdn_bytes_served_total work (#317).
📊 Assessment
Dimension
Value
Reasoning
Type
Feature
New observability/reporting capability, not a bug fix
Labels
enhancement, technical, rust
Already has enhancement + technical; adding rust aligns with #418 which is the closest precedent
Coding agent
Needs more info
Scope and design are underspecified — region attribution path from serving handler → accounting store is not defined, nor is the admin RPC contract
🔗 Similar issues
Add cache hit/miss + bytes-from-cache metrics to CacheEngine #418 (related) — Added decdn_cache_* metrics to CacheEngine; established the pattern for adding instrumentation (cache owns MetricsGroup, node registers it). Same observability domain but cache-scoped, not region-scoped.
Region attribution source: NodeAnnounce.region is a self-attested field on the peer side (ADR 030). For bytes served to clients, there is no client-side region in the current wire protocol. Maintainers should clarify: is this tracking (a) bytes served by this node broken down by the node's own region, (b) bytes served to peers grouped by their NodeAnnounce.region, or (c) something else?
State location: Options include a HashMap<String, (u64, u64)> (region → in/out bytes) inside the node's serving handler, an extension to DecdnMetrics using labeled Prometheus counters (decdn_bytes_served_total{region="us-east"} etc.), or a new RegionAccountant struct. Labeled counters would reuse the existing metrics pipeline and be queryable by Prometheus/Grafana without a separate admin endpoint.
Admin endpoint vs. structured log: ADR appendix-local-admin-http and the AdminRpc trait are the correct extension points if a queryable endpoint is wanted. A structured log (tracing span with region tag) is much simpler and sufficient for most compliance use cases.
ADR 036 interaction: FeeRouter.bytesPerEpoch is already the governance-canonical bytes counter. If the per-region breakdown is meant to feed epoch-level accounting, the design should align with that epoch boundary and the windowEpochs parameter rather than introduce a parallel counter.
Suggested sub-tasks (if proceeding):
Clarify region attribution semantics (see Q1 above)
Decide on state representation: labeled Prometheus counter vs. in-memory map vs. new admin RPC field
If admin endpoint: extend AdminRpc trait in common with a region_stats RPC returning Vec<(String, u64, u64)>
Implement counter increments in the cdn/client/v1 serving handler in crates/node/
Consider data-residency logging requirements: structured tracing events with region tag may satisfy compliance needs without a queryable endpoint
Leaf-crate constraint reminder: decdn-node → decdn-cache direction is fine; any new accounting state touching region labels must live in node or common, not in cache or gossip (which are leaf crates per CLAUDE.md dependency rules).
kind:featureNew capability or a change to current behaviorprio:lowWhen convenientrustDependabot: a Cargo update; use area: labels for Rust code otherwise
Activity
github-actions commentedon May 31, 2026
🎯 Triage report
This feature request asks for per-region bytes-in/bytes-out accounting surfaced via a structured periodic log or admin endpoint. The region dimension would come from the
regionfield inNodeAnnouncegossip messages. The stated use cases are capacity-bonding optimization and data-residency/regulatory compliance reporting.The request is underspecified in a few ways: it doesn't propose where the state lives (e.g.
reputationcrate EWMA-style, or a newnode-level counter map), what the admin RPC shape would look like, or how region attribution flows from the serving handler to the accounting layer. It also touches ADR 036 territory (bytesPerEpoch/FeeRouter) and the existingdecdn_bytes_served_totalwork (#317).📊 Assessment
enhancement,technical,rustrustaligns with #418 which is the closest precedent🔗 Similar issues
decdn_cache_*metrics toCacheEngine; established the pattern for adding instrumentation (cache ownsMetricsGroup, node registers it). Same observability domain but cache-scoped, not region-scoped.decdn_bytes_served_totalnetwork-side counter; this issue is essentially a per-region breakdown of that same signal.💡 Notes and suggestions
Design questions to answer before implementation:
Region attribution source:
NodeAnnounce.regionis a self-attested field on the peer side (ADR 030). For bytes served to clients, there is no client-side region in the current wire protocol. Maintainers should clarify: is this tracking (a) bytes served by this node broken down by the node's own region, (b) bytes served to peers grouped by theirNodeAnnounce.region, or (c) something else?State location: Options include a
HashMap<String, (u64, u64)>(region → in/out bytes) inside the node's serving handler, an extension toDecdnMetricsusing labeled Prometheus counters (decdn_bytes_served_total{region="us-east"}etc.), or a newRegionAccountantstruct. Labeled counters would reuse the existing metrics pipeline and be queryable by Prometheus/Grafana without a separate admin endpoint.Admin endpoint vs. structured log: ADR appendix-local-admin-http and the
AdminRpctrait are the correct extension points if a queryable endpoint is wanted. A structured log (tracing span with region tag) is much simpler and sufficient for most compliance use cases.ADR 036 interaction:
FeeRouter.bytesPerEpochis already the governance-canonical bytes counter. If the per-region breakdown is meant to feed epoch-level accounting, the design should align with that epoch boundary and thewindowEpochsparameter rather than introduce a parallel counter.Suggested sub-tasks (if proceeding):
regionlabel todecdn_bytes_served_totalin Implement cdn/client/v1 paid delivery protocol (StreamRequest, StreamResponse, ChunkData, vouchers) #317 scope (or as a follow-on to that issue)AdminRpctrait incommonwith aregion_statsRPC returningVec<(String, u64, u64)>cdn/client/v1serving handler incrates/node/tracingevents with region tag may satisfy compliance needs without a queryable endpointLeaf-crate constraint reminder:
decdn-node→decdn-cachedirection is fine; any new accounting state touching region labels must live innodeorcommon, not incacheorgossip(which are leaf crates per CLAUDE.md dependency rules).Add this agentic workflows to your repo
To install this agentic workflow, run
chore(node): sort_unstable_by for region snapshot; drop spec/plan docs (
refactor(node): address PR review — regions serde(default) + idle hea…
feat: per-region bandwidth accounting (#750) (#816)
fix(node): feed RegionAccountant on delivered node→node pulls (#858) (#…