mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/promscrape/targetstatus: fix crash during droppedTarget registration (#3595)
* lib/promscrape/targetstatus: fix crash during droppedTarget registration in case original labels are not present Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com> * lib/promscrape/targetstatus: address review comment Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com> Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>
This commit is contained in:
parent
802febab74
commit
52226c392f
1 changed files with 6 additions and 2 deletions
|
@ -1186,7 +1186,9 @@ func (swc *scrapeWorkConfig) getScrapeWork(target string, extraLabels, metaLabel
|
|||
}
|
||||
if labels.Len() == 0 {
|
||||
// Drop target without labels.
|
||||
droppedTargetsMap.Register(originalLabels, swc.relabelConfigs)
|
||||
if !*dropOriginalLabels {
|
||||
droppedTargetsMap.Register(originalLabels, swc.relabelConfigs)
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
// See https://www.robustperception.io/life-of-a-label
|
||||
|
@ -1201,7 +1203,9 @@ func (swc *scrapeWorkConfig) getScrapeWork(target string, extraLabels, metaLabel
|
|||
address := labels.Get("__address__")
|
||||
if len(address) == 0 {
|
||||
// Drop target without scrape address.
|
||||
droppedTargetsMap.Register(originalLabels, swc.relabelConfigs)
|
||||
if !*dropOriginalLabels {
|
||||
droppedTargetsMap.Register(originalLabels, swc.relabelConfigs)
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
// Usability extension to Prometheus behavior: extract optional scheme and metricsPath from __address__.
|
||||
|
|
Loading…
Reference in a new issue