8
8
"github.com/prometheus/client_golang/prometheus"
9
9
)
10
10
11
- // graphCollector is a collector that keeps track of graph information.
12
- type graphCollector struct {
11
+ // GraphCollector is a collector that keeps track of graph information.
12
+ type GraphCollector struct {
13
13
numEdgesDesc * prometheus.Desc
14
14
numNodesDesc * prometheus.Desc
15
15
@@ -22,11 +22,11 @@ type graphCollector struct {
22
22
lnd lnrpc.LightningClient
23
23
}
24
24
25
- // newGraphCollector returns a new instance of the graphCollector for the target
25
+ // NewGraphCollector returns a new instance of the GraphCollector for the target
26
26
// lnd client.
27
- func newGraphCollector (lnd lnrpc.LightningClient ) * graphCollector {
27
+ func NewGraphCollector (lnd lnrpc.LightningClient ) * GraphCollector {
28
28
labels := []string {"chan_id" , "pubkey" }
29
- return & graphCollector {
29
+ return & GraphCollector {
30
30
numEdgesDesc : prometheus .NewDesc (
31
31
"lnd_graph_edges_count" ,
32
32
"total number of edges in the graph" ,
@@ -73,7 +73,7 @@ func newGraphCollector(lnd lnrpc.LightningClient) *graphCollector {
73
73
// last descriptor has been sent.
74
74
//
75
75
// NOTE: Part of the prometheus.Collector interface.
76
- func (g * graphCollector ) Describe (ch chan <- * prometheus.Desc ) {
76
+ func (g * GraphCollector ) Describe (ch chan <- * prometheus.Desc ) {
77
77
ch <- g .numEdgesDesc
78
78
ch <- g .numNodesDesc
79
79
@@ -87,7 +87,7 @@ func (g *graphCollector) Describe(ch chan<- *prometheus.Desc) {
87
87
// Collect is called by the Prometheus registry when collecting metrics.
88
88
//
89
89
// NOTE: Part of the prometheus.Collector interface.
90
- func (g * graphCollector ) Collect (ch chan <- prometheus.Metric ) {
90
+ func (g * GraphCollector ) Collect (ch chan <- prometheus.Metric ) {
91
91
resp , err := g .lnd .DescribeGraph (
92
92
context .Background (), & lnrpc.ChannelGraphRequest {},
93
93
)
@@ -111,7 +111,7 @@ func (g *graphCollector) Collect(ch chan<- prometheus.Metric) {
111
111
}
112
112
}
113
113
114
- func (g * graphCollector ) collectRoutingPolicyMetrics (
114
+ func (g * GraphCollector ) collectRoutingPolicyMetrics (
115
115
ch chan <- prometheus.Metric , edge * lnrpc.ChannelEdge ) {
116
116
117
117
pubkeys := []string {edge .Node1Pub , edge .Node2Pub }
@@ -152,7 +152,7 @@ func (g *graphCollector) collectRoutingPolicyMetrics(
152
152
func init () {
153
153
metricsMtx .Lock ()
154
154
collectors ["graph" ] = func (lnd lnrpc.LightningClient ) prometheus.Collector {
155
- return newGraphCollector (lnd )
155
+ return NewGraphCollector (lnd )
156
156
}
157
157
metricsMtx .Unlock ()
158
158
}
0 commit comments