mirror of https://github.com/prometheus/prometheus
scrape sync: avoid copy of labels for dropped targets
Since the Target object was just created in this function, nobody else has a reference to it and there are no concerns about it being modified concurrently so we don't need to copy the value. Signed-off-by: Bryan Boreham <bjboreham@gmail.com>pull/12084/head
parent
0dfa1e73f8
commit
0c09c3feb0
|
@ -505,7 +505,7 @@ func (sp *scrapePool) Sync(tgs []*targetgroup.Group) {
|
||||||
t.LabelsRange(func(l labels.Label) { nonEmpty = true })
|
t.LabelsRange(func(l labels.Label) { nonEmpty = true })
|
||||||
if nonEmpty {
|
if nonEmpty {
|
||||||
all = append(all, t)
|
all = append(all, t)
|
||||||
} else if !t.DiscoveredLabels().IsEmpty() {
|
} else if !t.discoveredLabels.IsEmpty() {
|
||||||
sp.droppedTargets = append(sp.droppedTargets, t)
|
sp.droppedTargets = append(sp.droppedTargets, t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue