Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: add --disablegraph #67

Merged
merged 1 commit into from Mar 1, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 23 additions & 15 deletions collectors/prometheus.go
Expand Up @@ -64,6 +64,9 @@ type MonitoringConfig struct {
// PrimaryNode is the pubkey of the primary node in primary-gateway
// setups.
PrimaryNode *route.Vertex

// DisableGraph disables collection of graph metrics
DisableGraph bool
}

func DefaultConfig() *PrometheusConfig {
Expand All @@ -88,25 +91,30 @@ 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()...,
)

if !monitoringCfg.DisableGraph {
collectors = append(collectors, NewGraphCollector(lnd.Client, errChan))
}

return &PrometheusExporter{
cfg: cfg,
lnd: lnd,
monitoringCfg: monitoringCfg,
collectors: append(
[]prometheus.Collector{
NewChainCollector(lnd.Client, errChan),
NewChannelsCollector(
lnd.Client, errChan, monitoringCfg,
),
NewWalletCollector(lnd, errChan),
NewGraphCollector(lnd.Client, errChan),
NewPeerCollector(lnd.Client, errChan),
NewInfoCollector(lnd.Client, errChan),
},
htlcMonitor.collectors()...,
),
htlcMonitor: htlcMonitor,
errChan: errChan,
collectors: collectors,
htlcMonitor: htlcMonitor,
errChan: errChan,
}
}

Expand Down
3 changes: 3 additions & 0 deletions config.go
Expand Up @@ -43,6 +43,9 @@ 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 bool `long:"disablegraph" description:"Do not collect graph metrics"`
}

var defaultConfig = config{
Expand Down
4 changes: 3 additions & 1 deletion lndmon.go
Expand Up @@ -56,7 +56,9 @@ func start() error {
}
defer lnd.Close()

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