prom: Rename metrics to be less confusing

The metrics should always have a name that uniquely identifies the monitored
system and the metric on that system. `node` just doesn't say much if
presented along with metrics from other systems.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker
2019-03-26 12:41:59 +01:00
parent a43ad38dee
commit 96f617da75

View File

@@ -18,7 +18,7 @@ class NodeCollector(BaseLnCollector):
info = self.rpc.getinfo() info = self.rpc.getinfo()
info_labels = {k: v for k, v in info.items() if isinstance(v, str)} info_labels = {k: v for k, v in info.items() if isinstance(v, str)}
node_info_fam = InfoMetricFamily( node_info_fam = InfoMetricFamily(
'node', 'lightning_node',
'Static node information', 'Static node information',
labels=info_labels.keys(), labels=info_labels.keys(),
) )
@@ -39,17 +39,17 @@ class FundsCollector(BaseLnCollector):
total = output_funds + channel_funds total = output_funds + channel_funds
yield GaugeMetricFamily( yield GaugeMetricFamily(
'total_funds', 'lightning_funds_total',
"Total satoshis we own on this node.", "Total satoshis we own on this node.",
value=total, value=total,
) )
yield GaugeMetricFamily( yield GaugeMetricFamily(
'output_funds', 'lightning_funds_output',
"On-chain satoshis at our disposal", "On-chain satoshis at our disposal",
value=output_funds, value=output_funds,
) )
yield GaugeMetricFamily( yield GaugeMetricFamily(
'channel_funds', 'lightning_funds_channel',
"Satoshis in channels.", "Satoshis in channels.",
value=channel_funds, value=channel_funds,
) )
@@ -60,12 +60,12 @@ class PeerCollector(BaseLnCollector):
peers = self.rpc.listpeers()['peers'] peers = self.rpc.listpeers()['peers']
connected = GaugeMetricFamily( connected = GaugeMetricFamily(
'connected', 'lightning_peer_connected',
'Is the peer currently connected?', 'Is the peer currently connected?',
labels=['id'], labels=['id'],
) )
count = GaugeMetricFamily( count = GaugeMetricFamily(
'num_channels', 'lightning_peer_channels',
"The number of channels with the peer", "The number of channels with the peer",
labels=['id'], labels=['id'],
) )
@@ -81,22 +81,22 @@ class PeerCollector(BaseLnCollector):
class ChannelsCollector(BaseLnCollector): class ChannelsCollector(BaseLnCollector):
def collect(self): def collect(self):
balance_gauge = GaugeMetricFamily( balance_gauge = GaugeMetricFamily(
'channel_balance', 'lightning_channel_balance',
'How many funds are at our disposal?', 'How many funds are at our disposal?',
labels=['id', 'scid'], labels=['id', 'scid'],
) )
spendable_gauge = GaugeMetricFamily( spendable_gauge = GaugeMetricFamily(
'channel_spendable', 'lightning_channel_spendable',
'How much can we currently send over this channel?', 'How much can we currently send over this channel?',
labels=['id', 'scid'] labels=['id', 'scid']
) )
total_gauge = GaugeMetricFamily( total_gauge = GaugeMetricFamily(
'channel_total', 'lightning_channel_capacity',
'How many funds are in this channel in total?', 'How many funds are in this channel in total?',
labels=['id', 'scid'], labels=['id', 'scid'],
) )
htlc_gauge = GaugeMetricFamily( htlc_gauge = GaugeMetricFamily(
'channel_htlcs', 'lightning_channel_htlcs',
'How many HTLCs are currently active on this channel?', 'How many HTLCs are currently active on this channel?',
labels=['id', 'scid'], labels=['id', 'scid'],
) )