Skip to content

Resource usage meter is never fed data in production #3453

Description

@sanity

Problem

TopologyManager::report_resource_usage() is marked #[allow(dead_code)] // fixme: use this and is only called from test code within the topology module. No production code feeds resource usage data into the Meter.

This means calculate_usage_proportion() always returns ~0% usage, so adjust_topology() always takes the "usage below 50% → add connections" branch. The resource-usage-based decision logic (add when <50%, hold at 50-90%, remove when >90%) effectively never gates connection changes based on actual load.

Affected code

  • crates/core/src/topology/mod.rsreport_resource_usage() (line ~237), report_split_resource_usage() (line ~220)
  • crates/core/src/topology/meter.rsMeter struct and all its attribution tracking
  • crates/core/src/topology/mod.rscalculate_usage_proportion(), extrapolated_usage()

Impact

  • The topology manager cannot make load-aware decisions about adding/removing connections
  • The "remove worst-value peer when overloaded" path (select_connections_to_remove) is unreachable in production
  • Tests pass because they call report_resource_usage directly, masking the production gap

What needs to happen

Wire up actual resource usage reporting from the node's event loop or transport layer into TopologyManager::report_resource_usage(). The meter infrastructure exists and is tested — it just needs a caller that feeds it real bandwidth/CPU data from production traffic.

[AI-assisted - Claude]

Metadata

Metadata

Assignees

Labels

A-networkingArea: Networking, ring protocol, peer discoveryE-mediumExperience needed to fix/implement: Medium / intermediateP-highHigh priorityT-bugType: Something is broken

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions