mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-10 07:34:04 -08:00
retrieval: don't sync to uninitialized scrape pool
This change does just signal a scrape target update to the scraping loop once an initial target set is fetched. Before, the scrape pool was directly synced, causing a race against an uninitialized scrape pool. Fixes #1703
This commit is contained in:
parent
bc58d3dc50
commit
4c864c8a88
|
@ -331,7 +331,12 @@ func (ts *targetSet) runProviders(ctx context.Context, providers map[string]Targ
|
||||||
// We wait for a full initial set of target groups before releasing the mutex
|
// We wait for a full initial set of target groups before releasing the mutex
|
||||||
// to ensure the initial sync is complete and there are no races with subsequent updates.
|
// to ensure the initial sync is complete and there are no races with subsequent updates.
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
ts.sync()
|
// Just signal that there are initial sets to sync now. Actual syncing must only
|
||||||
|
// happen in the runScraping loop.
|
||||||
|
select {
|
||||||
|
case ts.syncCh <- struct{}{}:
|
||||||
|
default:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update handles a target group update from a target provider identified by the name.
|
// update handles a target group update from a target provider identified by the name.
|
||||||
|
|
Loading…
Reference in a new issue