mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/promscrape: create a single swosFunc
per scrape_config
This commit is contained in:
parent
3eadee6cb7
commit
3f0bcbe067
1 changed files with 9 additions and 9 deletions
|
@ -130,16 +130,16 @@ type ScrapeConfig struct {
|
|||
}
|
||||
|
||||
func (sc *ScrapeConfig) mustStart(baseDir string) {
|
||||
for i := range sc.KubernetesSDConfigs {
|
||||
swosFunc := func(metaLabels map[string]string) interface{} {
|
||||
target := metaLabels["__address__"]
|
||||
sw, err := sc.swc.getScrapeWork(target, nil, metaLabels)
|
||||
if err != nil {
|
||||
logger.Errorf("cannot create kubernetes_sd_config target %q for job_name %q: %s", target, sc.swc.jobName, err)
|
||||
return nil
|
||||
}
|
||||
return sw
|
||||
swosFunc := func(metaLabels map[string]string) interface{} {
|
||||
target := metaLabels["__address__"]
|
||||
sw, err := sc.swc.getScrapeWork(target, nil, metaLabels)
|
||||
if err != nil {
|
||||
logger.Errorf("cannot create kubernetes_sd_config target %q for job_name %q: %s", target, sc.swc.jobName, err)
|
||||
return nil
|
||||
}
|
||||
return sw
|
||||
}
|
||||
for i := range sc.KubernetesSDConfigs {
|
||||
sc.KubernetesSDConfigs[i].MustStart(baseDir, swosFunc)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue