Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Commit

Permalink
enable Dyncfg only in debug mode (#1371)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyam8 authored Oct 13, 2023
1 parent 1cfccdc commit ef9e097
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,22 +177,26 @@ func (a *Agent) run(ctx context.Context) {

functionsManager := functions.NewManager()

dyncfgDiscovery, _ := dyncfg.NewDiscovery(dyncfg.Config{
Plugin: a.Name,
API: netdataapi.New(a.Out),
Modules: enabledModules,
ModuleConfigDefaults: discCfg.Registry,
Functions: functionsManager,
})

discoveryManager.Add(dyncfgDiscovery)

jobsManager := jobmgr.NewManager()
jobsManager.Dyncfg = dyncfgDiscovery
jobsManager.PluginName = a.Name
jobsManager.Out = a.Out
jobsManager.Modules = enabledModules

// TODO: rm 'if' after https://github.com/netdata/netdata/issues/16079
if logger.IsDebug() {
dyncfgDiscovery, _ := dyncfg.NewDiscovery(dyncfg.Config{
Plugin: a.Name,
API: netdataapi.New(a.Out),
Modules: enabledModules,
ModuleConfigDefaults: discCfg.Registry,
Functions: functionsManager,
})

discoveryManager.Add(dyncfgDiscovery)

jobsManager.Dyncfg = dyncfgDiscovery
}

if reg := a.setupVnodeRegistry(); reg == nil || reg.Len() == 0 {
vnodes.Disabled = true
} else {
Expand Down

0 comments on commit ef9e097

Please sign in to comment.