mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/promscrape/discovery/kubernetes: pre-populate labelsByKey in reloadObject()
This commit is contained in:
parent
d9c7c71abc
commit
82441537ff
1 changed files with 5 additions and 0 deletions
|
@ -305,8 +305,13 @@ func (uw *urlWatcher) reloadObjects() string {
|
|||
logger.Errorf("cannot parse response from %q: %s", requestURL, err)
|
||||
return ""
|
||||
}
|
||||
labelsByKey := make(map[string][]map[string]string, len(objectsByKey))
|
||||
for k, o := range objectsByKey {
|
||||
labelsByKey[k] = o.getTargetLabels(uw)
|
||||
}
|
||||
uw.mu.Lock()
|
||||
uw.objectsByKey = objectsByKey
|
||||
uw.labelsByKey = labelsByKey
|
||||
uw.mu.Unlock()
|
||||
return metadata.ResourceVersion
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue