Skip to content

Commit

Permalink
collectors: disable the HTLC monitor collector
Browse files Browse the repository at this point in the history
multi: add a toggle to disable the HTLC monitor collector
  • Loading branch information
reynico committed Apr 17, 2023
1 parent 10b9b44 commit 875de5e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
8 changes: 7 additions & 1 deletion collectors/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ type MonitoringConfig struct {

// DisableGraph disables collection of graph metrics
DisableGraph bool

// DisableHtlc disables collection of HTLCs metrics
DisableHtlc bool
}

func DefaultConfig() *PrometheusConfig {
Expand Down Expand Up @@ -101,9 +104,12 @@ func NewPrometheusExporter(cfg *PrometheusConfig, lnd *lndclient.LndServices,
NewPeerCollector(lnd.Client, errChan),
NewInfoCollector(lnd.Client, errChan),
},
htlcMonitor.collectors()...,
)

if !monitoringCfg.DisableHtlc {
collectors = append(collectors, htlcMonitor.collectors()...)
}

if !monitoringCfg.DisableGraph {
collectors = append(collectors, NewGraphCollector(lnd.Client, errChan))
}
Expand Down
5 changes: 4 additions & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ type config struct {
// PrimaryNode is the pubkey of the primary node in primary-gateway setups.
PrimaryNode string `long:"primarynode" description:"Public key of the primary node in a primary-gateway setup"`

// DisableGraph disables collection of graph metrics
// DisableGraph disables collection of graph metrics.
DisableGraph bool `long:"disablegraph" description:"Do not collect graph metrics"`

// DisableHtlc disables the collection of HTLCs metrics.
DisableHtlc bool `long:"disablehtlc" description:"Do not collect HTLCs metrics"`
}

var defaultConfig = config{
Expand Down
1 change: 1 addition & 0 deletions lndmon.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func start() error {

monitoringCfg := collectors.MonitoringConfig{
DisableGraph: cfg.DisableGraph,
DisableHtlc: cfg.DisableHtlc,
}
if cfg.PrimaryNode != "" {
primaryNode, err := route.NewVertexFromStr(cfg.PrimaryNode)
Expand Down

0 comments on commit 875de5e

Please sign in to comment.