Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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