diff --git a/scrape/manager.go b/scrape/manager.go index 1af9141077..163d7ed14d 100644 --- a/scrape/manager.go +++ b/scrape/manager.go @@ -241,7 +241,7 @@ func (m *Manager) TargetsDropped() map[string][]*Target { return targets } -// getFqdn returns a fqdn if it's possible, otherwise falls back a hostname. +// getFqdn returns a FQDN if it's possible, otherwise falls back to hostname. func getFqdn() (string, error) { hostname, err := os.Hostname() if err != nil { @@ -250,7 +250,8 @@ func getFqdn() (string, error) { ips, err := net.LookupIP(hostname) if err != nil { - return hostname, err + // Return the system hostname if we can't look up the IP address. + return hostname, nil } lookup := func(ipStr encoding.TextMarshaler) (string, error) {