Skip to content

Commit bf5e0e9

Browse files
committed
Added synced_to_graph metric, modified metrics.md to also added synced_to_chain documentation
1 parent f36b0ca commit bf5e0e9

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

collectors/chain_collector.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ type ChainCollector struct {
1313
bestBlockHeight *prometheus.Desc
1414
bestBlockTimestamp *prometheus.Desc
1515
syncedToChain *prometheus.Desc
16+
syncedToGraph *prometheus.Desc
1617

1718
lnd lndclient.LightningClient
1819

@@ -41,6 +42,11 @@ func NewChainCollector(lnd lndclient.LightningClient,
4142
"lnd is synced to the chain",
4243
nil, nil,
4344
),
45+
syncedToGraph: prometheus.NewDesc(
46+
"lnd_graph_synced",
47+
"lnd is synced to the graph",
48+
nil, nil,
49+
),
4450
lnd: lnd,
4551
errChan: errChan,
4652
}
@@ -55,6 +61,7 @@ func (c *ChainCollector) Describe(ch chan<- *prometheus.Desc) {
5561
ch <- c.bestBlockHeight
5662
ch <- c.bestBlockTimestamp
5763
ch <- c.syncedToChain
64+
ch <- c.syncedToGraph
5865
}
5966

6067
// Collect is called by the Prometheus registry when collecting metrics.
@@ -82,6 +89,11 @@ func (c *ChainCollector) Collect(ch chan<- prometheus.Metric) {
8289
c.syncedToChain, prometheus.GaugeValue,
8390
float64(boolToInt(resp.SyncedToChain)),
8491
)
92+
93+
ch <- prometheus.MustNewConstMetric(
94+
c.syncedToGraph, prometheus.GaugeValue,
95+
float64(boolToInt(resp.SyncedToGraph)),
96+
)
8597
}
8698

8799
func boolToInt(arg bool) uint8 {

metrics.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
## Chain Metrics
22
* `lnd_chain_block_height`: best block height from lnd
33
* `lnd_chain_block_timestamp`: best block timestamp from lnd
4+
* `lnd_synced_to_chain`: whether lnd is synced to chain
5+
* `lnd_synced_to_graph`: whether lnd is synced to graph
46

57
## Channel Metrics
68
* `lnd_channels_open_balance_sat`: total balance of channels in satoshis

0 commit comments

Comments
 (0)