mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Add warning log for same labelset after relabeling
Signed-off-by: darshanime <deathbullet@gmail.com>
This commit is contained in:
parent
a441ad771e
commit
ad69899407
|
@ -20,7 +20,7 @@ import (
|
||||||
"github.com/prometheus/common/model"
|
"github.com/prometheus/common/model"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Group is a set of targets with a common label set(production , test, staging etc.).
|
// Group is a set of targets with a common label set(production, test, staging etc).
|
||||||
type Group struct {
|
type Group struct {
|
||||||
// Targets is a list of targets identified by a label set. Each target is
|
// Targets is a list of targets identified by a label set. Each target is
|
||||||
// uniquely identifiable in the group by its address label.
|
// uniquely identifiable in the group by its address label.
|
||||||
|
|
|
@ -197,6 +197,7 @@ func (m *Manager) reload() {
|
||||||
}
|
}
|
||||||
|
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
|
||||||
// Run the sync in parallel as these take a while and at high load can't catch up.
|
// Run the sync in parallel as these take a while and at high load can't catch up.
|
||||||
go func(sp *scrapePool, groups []*targetgroup.Group) {
|
go func(sp *scrapePool, groups []*targetgroup.Group) {
|
||||||
sp.Sync(groups)
|
sp.Sync(groups)
|
||||||
|
@ -205,6 +206,21 @@ func (m *Manager) reload() {
|
||||||
}
|
}
|
||||||
m.mtxScrape.Unlock()
|
m.mtxScrape.Unlock()
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
|
activeTargets := make(map[uint64]*Target)
|
||||||
|
for _, scrapePool := range m.scrapePools {
|
||||||
|
for _, target := range scrapePool.activeTargets {
|
||||||
|
if t, ok := activeTargets[target.labels.Hash()]; ok {
|
||||||
|
level.Warn(m.logger).Log(
|
||||||
|
"msg", "Found targets with same labels after relabelling",
|
||||||
|
"target", t.URL().String(),
|
||||||
|
"target", target.URL().String(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
activeTargets[target.labels.Hash()] = target
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// setOffsetSeed calculates a global offsetSeed per server relying on extra label set.
|
// setOffsetSeed calculates a global offsetSeed per server relying on extra label set.
|
||||||
|
|
Loading…
Reference in a new issue