prometheus: small fixups

Correct comment indentation and don't mix up scid with alias

Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
This commit is contained in:
Antoine Poinsot
2020-12-13 15:43:19 +01:00
committed by Christian Decker
parent 03e599678b
commit 8e7df25910

View File

@@ -162,12 +162,12 @@ class ChannelsCollector(BaseLnCollector):
peers = self.rpc.listpeers()['peers'] peers = self.rpc.listpeers()['peers']
for p in peers: for p in peers:
for c in p['channels']: for c in p['channels']:
# append alias for human readable labels, if no label is found fill with shortid. # append alias for human readable labels, if no label is found fill with shortid.
node = self.rpc.listnodes(p['id'])['nodes'] node = self.rpc.listnodes(p['id'])['nodes']
if len(node) != 0 and 'alias' in node[0]: if len(node) != 0 and 'alias' in node[0]:
alias = node[0]['alias'] alias = node[0]['alias']
else: else:
alias = c.get('short_channel_id', c.get('channel_id')) alias = 'unknown'
labels = [p['id'], c.get('short_channel_id', c.get('channel_id')), alias] labels = [p['id'], c.get('short_channel_id', c.get('channel_id')), alias]
balance_gauge.add_metric(labels, c['to_us_msat'].to_satoshi()) balance_gauge.add_metric(labels, c['to_us_msat'].to_satoshi())