Skip to content
Merged
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
15 changes: 13 additions & 2 deletions collectors/graph_collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import (

// GraphCollector is a collector that keeps track of graph information.
type GraphCollector struct {
numEdgesDesc *prometheus.Desc
numNodesDesc *prometheus.Desc
numEdgesDesc *prometheus.Desc
numNodesDesc *prometheus.Desc
numZombiesDesc *prometheus.Desc

avgOutDegreeDesc *prometheus.Desc
maxOutDegreeDesc *prometheus.Desc
Expand Down Expand Up @@ -66,6 +67,11 @@ func NewGraphCollector(lnd lnrpc.LightningClient) *GraphCollector {
"total number of nodes in the graph",
nil, nil,
),
numZombiesDesc: prometheus.NewDesc(
"lnd_graph_zombies_count",
"total number of zombies in the graph",
nil, nil,
),

avgOutDegreeDesc: prometheus.NewDesc(
"lnd_graph_outdegree_avg",
Expand Down Expand Up @@ -227,6 +233,7 @@ func NewGraphCollector(lnd lnrpc.LightningClient) *GraphCollector {
func (g *GraphCollector) Describe(ch chan<- *prometheus.Desc) {
ch <- g.numEdgesDesc
ch <- g.numNodesDesc
ch <- g.numZombiesDesc

ch <- g.avgOutDegreeDesc
ch <- g.maxOutDegreeDesc
Expand Down Expand Up @@ -285,6 +292,10 @@ func (g *GraphCollector) Collect(ch chan<- prometheus.Metric) {
g.numNodesDesc, prometheus.GaugeValue,
float64(len(resp.Nodes)),
)
ch <- prometheus.MustNewConstMetric(
g.numZombiesDesc, prometheus.GaugeValue,
float64(resp.NumZombies),
)

g.collectRoutingPolicyMetrics(ch, resp.Edges)

Expand Down