Skip to content

Conversation

s373nZ
Copy link
Contributor

@s373nZ s373nZ commented Oct 5, 2025

When experimenting with the metrics, it was very confusing to discover that lightning_peers_connected did not refer to the number of connected peers, but rather to the number of peers with channels.

A search through the commit log turned up ce078bb#diff-cfc589c146eeee8db6b2db1d8dc6e851722e6ea18a2d7d05ebc49b2851012de1R71-L91 which was supposed to be related to msat denominations, but seems to have overridden the listpeers metrics with listpeerchannels data.

This PR does the following:

  • Refactors the existing PeerCollector to PeerChannelsCollector
  • Implements a new PeerCollector to track raw peers and their connections, regardless of whether they have a channel, introducing a lightning_peers metric to track a count of each peer.
  • Quietly subverts the lightning_peer_connected with actual peer data instead of peer-channel data.
  • Renames the prior lightning_peer_connected metric data to a new, more clear, lightning_peer_channel_connected metric.

Of course, this change could cause unexpected data for users already tracking the lightning_peer_connected metric, but IMO the clarification is worth it.

s373nZ added 2 commits October 5, 2025 14:35
Metrics from this collector are operating exclusively on the
`listpeerchannels` RPC method, so naming it accordingly. Also,

- Removes obsolete call to `listpeers`.
- Renames the `lightning_peer_connected` metric to `lightning_peer_channel_connected`.
Tracks direct peer information about peers which don't necessarily
have a channel.

Generally reinstates changes from:
  lightningd@ce078bb#diff-cfc589c146eeee8db6b2db1d8dc6e851722e6ea18a2d7d05ebc49b2851012de1R71-L91
@s373nZ s373nZ requested a review from cdecker as a code owner October 5, 2025 13:55
@cdecker cdecker enabled auto-merge (rebase) October 5, 2025 14:19
@cdecker cdecker merged commit a6a4022 into lightningd:master Oct 5, 2025
6 of 7 checks passed
@s373nZ s373nZ deleted the prometheus-peers-connected branch October 5, 2025 15:12
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.

2 participants