@@ -72,7 +72,8 @@ type MonitoringConfig struct {
72
72
// DisableHtlc disables collection of HTLCs metrics
73
73
DisableHtlc bool
74
74
75
- // ProgramStartTime stores a best-effort estimate of when lnd/lndmon was started.
75
+ // ProgramStartTime stores a best-effort estimate of when lnd/lndmon was
76
+ // started.
76
77
ProgramStartTime time.Time
77
78
}
78
79
@@ -88,13 +89,14 @@ func DefaultConfig() *PrometheusConfig {
88
89
// NewPrometheusExporter makes a new instance of the PrometheusExporter given
89
90
// the address to listen for Prometheus on and an lnd gRPC client.
90
91
func NewPrometheusExporter (cfg * PrometheusConfig , lnd * lndclient.LndServices ,
91
- monitoringCfg * MonitoringConfig , quitChan chan struct {}) * PrometheusExporter {
92
+ monitoringCfg * MonitoringConfig ,
93
+ quitChan chan struct {}) * PrometheusExporter {
92
94
93
95
// We have six collectors and a htlc monitor running, so we buffer our
94
- // error channel by 7 so that we do not need to consume all errors from
96
+ // error channel by 8 so that we do not need to consume all errors from
95
97
// this channel (on the first one, we'll start shutting down, but a few
96
98
// could arrive quickly in the case where lnd is shutting down).
97
- errChan := make (chan error , 7 )
99
+ errChan := make (chan error , 8 )
98
100
99
101
htlcMonitor := newHtlcMonitor (lnd .Router , errChan )
100
102
@@ -116,7 +118,9 @@ func NewPrometheusExporter(cfg *PrometheusConfig, lnd *lndclient.LndServices,
116
118
}
117
119
118
120
if ! monitoringCfg .DisableGraph {
119
- collectors = append (collectors , NewGraphCollector (lnd .Client , errChan ))
121
+ collectors = append (
122
+ collectors , NewGraphCollector (lnd .Client , errChan ),
123
+ )
120
124
}
121
125
122
126
return & PrometheusExporter {
@@ -165,15 +169,19 @@ func (p *PrometheusExporter) Start() error {
165
169
// scape our metrics.
166
170
go func () {
167
171
errorLogger := log .New (
168
- os .Stdout , "promhttp" , log .Ldate | log .Ltime | log .Lshortfile ,
172
+ os .Stdout , "promhttp" ,
173
+ log .Ldate | log .Ltime | log .Lshortfile ,
169
174
)
170
175
171
176
promHandler := promhttp .InstrumentMetricHandler (
172
177
prometheus .DefaultRegisterer ,
173
- promhttp .HandlerFor (prometheus .DefaultGatherer , promhttp.HandlerOpts {
174
- ErrorLog : errorLogger ,
175
- ErrorHandling : promhttp .ContinueOnError ,
176
- }),
178
+ promhttp .HandlerFor (
179
+ prometheus .DefaultGatherer ,
180
+ promhttp.HandlerOpts {
181
+ ErrorLog : errorLogger ,
182
+ ErrorHandling : promhttp .ContinueOnError ,
183
+ },
184
+ ),
177
185
)
178
186
http .Handle ("/metrics" , promHandler )
179
187
Logger .Info (http .ListenAndServe (p .cfg .ListenAddr , nil ))
0 commit comments