diff --git a/collectors/graph_collector.go b/collectors/graph_collector.go index 29e5685..46864f5 100644 --- a/collectors/graph_collector.go +++ b/collectors/graph_collector.go @@ -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 @@ -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", @@ -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 @@ -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)