Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions collectors/chain_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type ChainCollector struct {
bestBlockHeight *prometheus.Desc
bestBlockTimestamp *prometheus.Desc
syncedToChain *prometheus.Desc
syncedToGraph *prometheus.Desc

lnd lndclient.LightningClient

Expand Down Expand Up @@ -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,
}
Expand All @@ -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.
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions metrics.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down