Skip to content

Conversation

@sneaxhuh
Copy link

Implements TODO to report system limits to Prometheus metrics. Previously, only resource usage was tracked in metrics, but the configured limits were not exposed, making it difficult to understand when resources were approaching their limits.

Changes:

  • Add 'libp2p_rcmgr_limit' gauge metric with scope and resource labels
  • Implement StatsTraceReporter.ReportSystemLimits() to export limits
  • Report system and transient scope limits during initialization
  • Export limits for memory, connections, streams, and file descriptors
  • Add comprehensive tests for limits metrics

The new metric allows monitoring:

  • Configured resource limits vs current usage
  • Resource utilization percentages in dashboards
  • Alert thresholds based on limit proximity

Example metrics exposed:

  • libp2p_rcmgr_limit{scope="system",resource="memory"}
  • libp2p_rcmgr_limit{scope="system",resource="conns"}
  • libp2p_rcmgr_limit{scope="transient",resource="streams"}

Implements TODO to report system limits to Prometheus metrics.
Previously, only resource usage was tracked in metrics, but the
configured limits were not exposed, making it difficult to understand
when resources were approaching their limits.

Changes:
- Add 'libp2p_rcmgr_limit' gauge metric with scope and resource labels
- Implement StatsTraceReporter.ReportSystemLimits() to export limits
- Report system and transient scope limits during initialization
- Export limits for memory, connections, streams, and file descriptors
- Add comprehensive tests for limits metrics

The new metric allows monitoring:
- Configured resource limits vs current usage
- Resource utilization percentages in dashboards
- Alert thresholds based on limit proximity

Example metrics exposed:
- libp2p_rcmgr_limit{scope="system",resource="memory"}
- libp2p_rcmgr_limit{scope="system",resource="conns"}
- libp2p_rcmgr_limit{scope="transient",resource="streams"}

Signed-off-by: sneax <[email protected]>
@MarcoPolo MarcoPolo self-requested a review December 2, 2025 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant