diff --git a/lib/promscrape/discovery/kubernetes/api_watcher.go b/lib/promscrape/discovery/kubernetes/api_watcher.go index c78b334f8..d5def2f29 100644 --- a/lib/promscrape/discovery/kubernetes/api_watcher.go +++ b/lib/promscrape/discovery/kubernetes/api_watcher.go @@ -190,8 +190,12 @@ func newGroupWatcher(apiServer string, ac *promauth.Config, namespaces []string, } func getGroupWatcher(apiServer string, ac *promauth.Config, namespaces []string, selectors []Selector, proxyURL *url.URL) *groupWatcher { - key := fmt.Sprintf("apiServer=%s, namespaces=%s, selectors=%s, proxyURL=%v, authConfig=%s", - apiServer, namespaces, selectorsKey(selectors), proxyURL, ac.String()) + proxyURLStr := "" + if proxyURL != nil { + proxyURLStr = proxyURL.String() + } + key := fmt.Sprintf("apiServer=%s, namespaces=%s, selectors=%s, proxyURL=%s, authConfig=%s", + apiServer, namespaces, selectorsKey(selectors), proxyURLStr, ac.String()) groupWatchersLock.Lock() gw := groupWatchers[key] if gw == nil {