Browse Source

comment to rethink the map reference for the notifier discovery

pull/3638/head
Krasi Georgiev 7 years ago
parent
commit
8369826808
  1. 1
      cmd/prometheus/main.go
  2. 1
      notifier/notifier.go

1
cmd/prometheus/main.go

@ -296,6 +296,7 @@ func main() {
c := make(map[string]sd_config.ServiceDiscoveryConfig) c := make(map[string]sd_config.ServiceDiscoveryConfig)
for _, v := range cfg.AlertingConfig.AlertmanagerConfigs { for _, v := range cfg.AlertingConfig.AlertmanagerConfigs {
// AlertmanagerConfigs doesn't hold an unique identifier so we use the config pointer as the identifier. // AlertmanagerConfigs doesn't hold an unique identifier so we use the config pointer as the identifier.
// TODO Krasi - Maybe use the slice index as the reference.
c[fmt.Sprintf("%p", v)] = v.ServiceDiscoveryConfig c[fmt.Sprintf("%p", v)] = v.ServiceDiscoveryConfig
} }
return discoveryManagerNotify.ApplyConfig(c) return discoveryManagerNotify.ApplyConfig(c)

1
notifier/notifier.go

@ -257,6 +257,7 @@ func (n *Notifier) ApplyConfig(conf *config.Config) error {
ams.metrics = n.metrics ams.metrics = n.metrics
// The config pointer is used for the map lookup identifier. // The config pointer is used for the map lookup identifier.
// TODO Krasi - Maybe use the slice index as the reference.
amSets[fmt.Sprintf("%p", cfg)] = ams amSets[fmt.Sprintf("%p", cfg)] = ams
} }

Loading…
Cancel
Save