prometheus: give short channel id for scid fiels, not long one

Also, if the channel isn't confirmed yet (no short_channel_id field),
    give the long channel id.

Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
This commit is contained in:
Antoine Poinsot
2020-05-31 19:14:58 +02:00
committed by Christian Decker
parent a155107857
commit 2d2fa72ce6

View File

@@ -162,7 +162,7 @@ class ChannelsCollector(BaseLnCollector):
peers = self.rpc.listpeers()['peers']
for p in peers:
for c in p['channels']:
labels = [p['id'], c['channel_id']]
labels = [p['id'], c.get('short_channel_id', c.get('channel_id'))]
balance_gauge.add_metric(labels, c['to_us_msat'].to_satoshi())
spendable_gauge.add_metric(labels,
c['spendable_msat'].to_satoshi())