Skip to content

Commit 02ee7ca

Browse files
authored
Merge pull request #106 from LN-Zap/disable-htlc-stream
collectors: do not init htlc monitor when htlc monitoring is disabled
2 parents a849499 + 79f80d3 commit 02ee7ca

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

collectors/prometheus.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,10 @@ func (p *PrometheusExporter) Start() error {
150150

151151
// Start the htlc monitor goroutine. This will subscribe to htlcs and
152152
// update all of our routing-related metrics.
153-
if err := p.htlcMonitor.start(); err != nil {
154-
return err
153+
if !p.monitoringCfg.DisableHtlc {
154+
if err := p.htlcMonitor.start(); err != nil {
155+
return err
156+
}
155157
}
156158

157159
// Finally, we'll launch the HTTP server that Prometheus will use to
@@ -181,7 +183,9 @@ func (p *PrometheusExporter) Start() error {
181183
// before returning.
182184
func (p *PrometheusExporter) Stop() {
183185
log.Println("Stopping Prometheus Exporter")
184-
p.htlcMonitor.stop()
186+
if !p.monitoringCfg.DisableHtlc {
187+
p.htlcMonitor.stop()
188+
}
185189
}
186190

187191
// Errors returns an error channel that any failures experienced by its

0 commit comments

Comments
 (0)