Skip to content

Commit

Permalink
Changed the arguments of collector.InitModuleMetrics
Browse files Browse the repository at this point in the history
Signed-off-by: Kakuya Ando <[email protected]>
  • Loading branch information
servak committed Aug 18, 2023
1 parent 0bca9df commit 72b01c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 6 additions & 2 deletions collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,12 @@ func listToOid(l []int) string {
return strings.Join(result, ".")
}

func InitModuleMetrics(auth, module string) {
snmpDuration.WithLabelValues(auth, module)
func InitModuleMetrics(auths map[string]*config.Auth, modules map[string]*config.Module) {
for auth := range auths {
for module := range modules {
snmpDuration.WithLabelValues(auth, module)
}
}
}

type ScrapeResults struct {
Expand Down
6 changes: 1 addition & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,7 @@ func (sc *SafeConfig) ReloadConfig(configFile string) (err error) {
sc.Lock()
sc.C = conf
// Initialize metrics.
for auth := range sc.C.Auths {
for module := range sc.C.Modules {
collector.InitModuleMetrics(auth, module)
}
}
collector.InitModuleMetrics(sc.C.Auths, sc.C.Modules)
sc.Unlock()
return nil
}
Expand Down

0 comments on commit 72b01c2

Please sign in to comment.