Browse Source

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
Bryan Boreham 2 years ago
parent
commit
0c09c3feb0
  1. 2
      scrape/scrape.go

2
scrape/scrape.go

@ -505,7 +505,7 @@ func (sp *scrapePool) Sync(tgs []*targetgroup.Group) {
t.LabelsRange(func(l labels.Label) { nonEmpty = true })
if nonEmpty {
all = append(all, t)
} else if !t.DiscoveredLabels().IsEmpty() {
} else if !t.discoveredLabels.IsEmpty() {
sp.droppedTargets = append(sp.droppedTargets, t)
}
}

Loading…
Cancel
Save