mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-10 15:14:09 +00:00
lib/promscrape: access Config entries by reference, so they can be compared by addresses
This commit is contained in:
parent
a5ad19e836
commit
83e4c8427e
1 changed files with 13 additions and 8 deletions
|
@ -155,12 +155,13 @@ func (cfg *Config) fileSDConfigsCount() int {
|
|||
return n
|
||||
}
|
||||
|
||||
// getKubernetesSDcrapeWork returns `kubernetes_sd_configs` ScrapeWork from cfg.
|
||||
// getKubernetesSDScrapeWork returns `kubernetes_sd_configs` ScrapeWork from cfg.
|
||||
func (cfg *Config) getKubernetesSDScrapeWork() []ScrapeWork {
|
||||
var dst []ScrapeWork
|
||||
for _, sc := range cfg.ScrapeConfigs {
|
||||
for i := range sc.KubernetesSDConfigs {
|
||||
sdc := &sc.KubernetesSDConfigs[i]
|
||||
for i := range cfg.ScrapeConfigs {
|
||||
sc := &cfg.ScrapeConfigs[i]
|
||||
for j := range sc.KubernetesSDConfigs {
|
||||
sdc := &sc.KubernetesSDConfigs[j]
|
||||
dst = appendKubernetesScrapeWork(dst, sdc, cfg.baseDir, sc.swc)
|
||||
}
|
||||
}
|
||||
|
@ -181,8 +182,10 @@ func (cfg *Config) getFileSDScrapeWork(prev []ScrapeWork) []ScrapeWork {
|
|||
}
|
||||
}
|
||||
var dst []ScrapeWork
|
||||
for _, sc := range cfg.ScrapeConfigs {
|
||||
for _, sdc := range sc.FileSDConfigs {
|
||||
for i := range cfg.ScrapeConfigs {
|
||||
sc := &cfg.ScrapeConfigs[i]
|
||||
for j := range sc.FileSDConfigs {
|
||||
sdc := &sc.FileSDConfigs[j]
|
||||
dst = sdc.appendScrapeWork(dst, swPrev, cfg.baseDir, sc.swc)
|
||||
}
|
||||
}
|
||||
|
@ -192,8 +195,10 @@ func (cfg *Config) getFileSDScrapeWork(prev []ScrapeWork) []ScrapeWork {
|
|||
// getStaticScrapeWork returns `static_configs` ScrapeWork from from cfg.
|
||||
func (cfg *Config) getStaticScrapeWork() []ScrapeWork {
|
||||
var dst []ScrapeWork
|
||||
for _, sc := range cfg.ScrapeConfigs {
|
||||
for _, stc := range sc.StaticConfigs {
|
||||
for i := range cfg.ScrapeConfigs {
|
||||
sc := &cfg.ScrapeConfigs[i]
|
||||
for j := range sc.StaticConfigs {
|
||||
stc := &sc.StaticConfigs[j]
|
||||
dst = stc.appendScrapeWork(dst, sc.swc, nil)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue