mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-11 13:57:36 -08:00
Merge pull request #1890 from prometheus/fix-applyconfig-error
Fix ApplyConfig() error handling
This commit is contained in:
commit
289e299eb5
|
@ -227,13 +227,15 @@ func reloadConfig(filename string, rls ...Reloadable) (err error) {
|
||||||
return fmt.Errorf("couldn't load configuration (-config.file=%s): %v", filename, err)
|
return fmt.Errorf("couldn't load configuration (-config.file=%s): %v", filename, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply all configs and return the first error if there were any.
|
failed := false
|
||||||
for _, rl := range rls {
|
for _, rl := range rls {
|
||||||
if err != nil {
|
if err := rl.ApplyConfig(conf); err != nil {
|
||||||
err = rl.ApplyConfig(conf)
|
log.Error("Failed to apply configuration: ", err)
|
||||||
} else {
|
failed = true
|
||||||
rl.ApplyConfig(conf)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return err
|
if failed {
|
||||||
|
return fmt.Errorf("one or more errors occured while applying the new configuration (-config.file=%s)", filename)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue