mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
service discovery: add config name to log messages
This makes it easier to connect a log message with the config it relates to. Each SD config has a name, either the scrape job name or something like "config-0" for Alertmanager config. Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
parent
ccea61c7bf
commit
2f58be840d
|
@ -311,10 +311,10 @@ func (m *Manager) registerProviders(cfgs discovery.Configs, setName string) int
|
||||||
}
|
}
|
||||||
typ := cfg.Name()
|
typ := cfg.Name()
|
||||||
d, err := cfg.NewDiscoverer(discovery.DiscovererOptions{
|
d, err := cfg.NewDiscoverer(discovery.DiscovererOptions{
|
||||||
Logger: log.With(m.logger, "discovery", typ),
|
Logger: log.With(m.logger, "discovery", typ, "config", setName),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
level.Error(m.logger).Log("msg", "Cannot create service discovery", "err", err, "type", typ)
|
level.Error(m.logger).Log("msg", "Cannot create service discovery", "err", err, "type", typ, "config", setName)
|
||||||
failed++
|
failed++
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -428,11 +428,11 @@ func (m *Manager) registerProviders(cfgs Configs, setName string) int {
|
||||||
}
|
}
|
||||||
typ := cfg.Name()
|
typ := cfg.Name()
|
||||||
d, err := cfg.NewDiscoverer(DiscovererOptions{
|
d, err := cfg.NewDiscoverer(DiscovererOptions{
|
||||||
Logger: log.With(m.logger, "discovery", typ),
|
Logger: log.With(m.logger, "discovery", typ, "config", setName),
|
||||||
HTTPClientOptions: m.httpOpts,
|
HTTPClientOptions: m.httpOpts,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
level.Error(m.logger).Log("msg", "Cannot create service discovery", "err", err, "type", typ)
|
level.Error(m.logger).Log("msg", "Cannot create service discovery", "err", err, "type", typ, "config", setName)
|
||||||
failed++
|
failed++
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue