mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
parent
f689476b33
commit
08a012ccd7
|
@ -40,6 +40,7 @@ type TargetManager struct {
|
||||||
// Set of unqiue targets by scrape configuration.
|
// Set of unqiue targets by scrape configuration.
|
||||||
targetSets map[string]*targetSet
|
targetSets map[string]*targetSet
|
||||||
logger log.Logger
|
logger log.Logger
|
||||||
|
starting chan struct{}
|
||||||
}
|
}
|
||||||
|
|
||||||
type targetSet struct {
|
type targetSet struct {
|
||||||
|
@ -61,6 +62,7 @@ func NewTargetManager(app Appendable, logger log.Logger) *TargetManager {
|
||||||
append: app,
|
append: app,
|
||||||
targetSets: map[string]*targetSet{},
|
targetSets: map[string]*targetSet{},
|
||||||
logger: logger,
|
logger: logger,
|
||||||
|
starting: make(chan struct{}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,12 +76,14 @@ func (tm *TargetManager) Run() {
|
||||||
tm.reload()
|
tm.reload()
|
||||||
|
|
||||||
tm.mtx.Unlock()
|
tm.mtx.Unlock()
|
||||||
|
close(tm.starting)
|
||||||
|
|
||||||
tm.wg.Wait()
|
tm.wg.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop all background processing.
|
// Stop all background processing.
|
||||||
func (tm *TargetManager) Stop() {
|
func (tm *TargetManager) Stop() {
|
||||||
|
<-tm.starting
|
||||||
level.Info(tm.logger).Log("msg", "Stopping target manager...")
|
level.Info(tm.logger).Log("msg", "Stopping target manager...")
|
||||||
|
|
||||||
tm.mtx.Lock()
|
tm.mtx.Lock()
|
||||||
|
|
Loading…
Reference in a new issue