Skip to content

Commit 16f6824

Browse files
s373nZcdecker
authored andcommitted
prometheus: Refactor PeerCollector to PeerChannelsCollector.
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`.
1 parent 96ac0d5 commit 16f6824

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

prometheus/prometheus.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,11 @@ def collect(self):
8181
)
8282

8383

84-
class PeerCollector(BaseLnCollector):
84+
class PeerChannelsCollector(BaseLnCollector):
8585
def collect(self):
86-
peers = self.rpc.listpeers()['peers']
87-
8886
connected = GaugeMetricFamily(
89-
'lightning_peer_connected',
90-
'Is the peer currently connected?',
87+
'lightning_peer_channel_connected',
88+
'Is the channel peer currently connected?',
9189
labels=['id'],
9290
)
9391
count = GaugeMetricFamily(
@@ -234,7 +232,7 @@ def init(options, configuration, plugin):
234232
start_http_server(addr=ip, port=port, registry=registry)
235233
registry.register(NodeCollector(plugin.rpc, registry))
236234
registry.register(FundsCollector(plugin.rpc, registry))
237-
registry.register(PeerCollector(plugin.rpc, registry))
235+
registry.register(PeerChannelsCollector(plugin.rpc, registry))
238236
registry.register(ChannelsCollector(plugin.rpc, registry))
239237

240238

0 commit comments

Comments
 (0)