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 a03710f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
28 changes: 16 additions & 12 deletions 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 All @@ -91,18 +94,19 @@ func NewPrometheusExporter(cfg *PrometheusConfig, lnd *lndclient.LndServices,

htlcMonitor := newHtlcMonitor(lnd.Router, errChan)

collectors := append(
[]prometheus.Collector{
NewChainCollector(lnd.Client, errChan),
NewChannelsCollector(
lnd.Client, errChan, monitoringCfg,
),
NewWalletCollector(lnd, errChan),
NewPeerCollector(lnd.Client, errChan),
NewInfoCollector(lnd.Client, errChan),
},
htlcMonitor.collectors()...,
)
collectors := []prometheus.Collector{
NewChainCollector(lnd.Client, errChan),
NewChannelsCollector(
lnd.Client, errChan, monitoringCfg,
),
NewWalletCollector(lnd, errChan),
NewPeerCollector(lnd.Client, errChan),
NewInfoCollector(lnd.Client, errChan),
}

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 a03710f

Please sign in to comment.