mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 21:54:10 -08:00
code review
Signed-off-by: Marcin Skalski <skalskimarcin33@gmail.com>
This commit is contained in:
parent
48934aaef3
commit
e27232614a
|
@ -178,11 +178,14 @@ func kumaMadsV1ResourceParser(resources []*anypb.Any, typeURL string) ([]model.L
|
|||
|
||||
func NewKumaHTTPDiscovery(conf *KumaSDConfig, logger log.Logger) (discovery.Discoverer, error) {
|
||||
// Default to "prometheus" if hostname is unavailable.
|
||||
var clientID string
|
||||
if conf.ClientID == "" {
|
||||
clientID = defaultClientID(logger)
|
||||
} else {
|
||||
clientID = conf.ClientID
|
||||
clientID := conf.ClientID
|
||||
if clientID == "" {
|
||||
var err error
|
||||
clientID, err = osutil.GetFQDN()
|
||||
if err != nil {
|
||||
level.Debug(logger).Log("msg", "error getting FQDN", "err", err)
|
||||
clientID = "prometheus"
|
||||
}
|
||||
}
|
||||
|
||||
clientConfig := &HTTPResourceClientConfig{
|
||||
|
@ -216,12 +219,3 @@ func NewKumaHTTPDiscovery(conf *KumaSDConfig, logger log.Logger) (discovery.Disc
|
|||
|
||||
return d, nil
|
||||
}
|
||||
|
||||
func defaultClientID(logger log.Logger) string {
|
||||
clientID, err := osutil.GetFQDN()
|
||||
if err != nil {
|
||||
level.Debug(logger).Log("msg", "error getting FQDN", "err", err)
|
||||
clientID = "prometheus"
|
||||
}
|
||||
return clientID
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue