From bf5e0e9ebf5639ef4226d2ed6917f2729025c25a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=CC=81=20A=2EP?= Date: Tue, 31 Jan 2023 20:07:07 +0100 Subject: [PATCH] Added synced_to_graph metric, modified metrics.md to also added synced_to_chain documentation --- collectors/chain_collector.go | 12 ++++++++++++ metrics.md | 2 ++ 2 files changed, 14 insertions(+) diff --git a/collectors/chain_collector.go b/collectors/chain_collector.go index fa6ce32..8093207 100644 --- a/collectors/chain_collector.go +++ b/collectors/chain_collector.go @@ -13,6 +13,7 @@ type ChainCollector struct { bestBlockHeight *prometheus.Desc bestBlockTimestamp *prometheus.Desc syncedToChain *prometheus.Desc + syncedToGraph *prometheus.Desc lnd lndclient.LightningClient @@ -41,6 +42,11 @@ func NewChainCollector(lnd lndclient.LightningClient, "lnd is synced to the chain", nil, nil, ), + syncedToGraph: prometheus.NewDesc( + "lnd_graph_synced", + "lnd is synced to the graph", + nil, nil, + ), lnd: lnd, errChan: errChan, } @@ -55,6 +61,7 @@ func (c *ChainCollector) Describe(ch chan<- *prometheus.Desc) { ch <- c.bestBlockHeight ch <- c.bestBlockTimestamp ch <- c.syncedToChain + ch <- c.syncedToGraph } // Collect is called by the Prometheus registry when collecting metrics. @@ -82,6 +89,11 @@ func (c *ChainCollector) Collect(ch chan<- prometheus.Metric) { c.syncedToChain, prometheus.GaugeValue, float64(boolToInt(resp.SyncedToChain)), ) + + ch <- prometheus.MustNewConstMetric( + c.syncedToGraph, prometheus.GaugeValue, + float64(boolToInt(resp.SyncedToGraph)), + ) } func boolToInt(arg bool) uint8 { diff --git a/metrics.md b/metrics.md index 85b0107..d4fb628 100644 --- a/metrics.md +++ b/metrics.md @@ -1,6 +1,8 @@ ## Chain Metrics * `lnd_chain_block_height`: best block height from lnd * `lnd_chain_block_timestamp`: best block timestamp from lnd +* `lnd_synced_to_chain`: whether lnd is synced to chain +* `lnd_synced_to_graph`: whether lnd is synced to graph ## Channel Metrics * `lnd_channels_open_balance_sat`: total balance of channels in satoshis