|
|
@ -314,6 +314,7 @@ func (sp *scrapePool) reload(cfg *config.ScrapeConfig) error {
|
|
|
|
for fp, oldLoop := range sp.loops {
|
|
|
|
for fp, oldLoop := range sp.loops {
|
|
|
|
var cache *scrapeCache
|
|
|
|
var cache *scrapeCache
|
|
|
|
if oc := oldLoop.getCache(); reuseCache && oc != nil {
|
|
|
|
if oc := oldLoop.getCache(); reuseCache && oc != nil {
|
|
|
|
|
|
|
|
oldLoop.disableEndOfRunStalenessMarkers()
|
|
|
|
cache = oc
|
|
|
|
cache = oc
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
cache = newScrapeCache()
|
|
|
|
cache = newScrapeCache()
|
|
|
@ -593,6 +594,7 @@ type loop interface {
|
|
|
|
run(interval, timeout time.Duration, errc chan<- error)
|
|
|
|
run(interval, timeout time.Duration, errc chan<- error)
|
|
|
|
stop()
|
|
|
|
stop()
|
|
|
|
getCache() *scrapeCache
|
|
|
|
getCache() *scrapeCache
|
|
|
|
|
|
|
|
disableEndOfRunStalenessMarkers()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type cacheEntry struct {
|
|
|
|
type cacheEntry struct {
|
|
|
@ -619,6 +621,8 @@ type scrapeLoop struct {
|
|
|
|
ctx context.Context
|
|
|
|
ctx context.Context
|
|
|
|
cancel func()
|
|
|
|
cancel func()
|
|
|
|
stopped chan struct{}
|
|
|
|
stopped chan struct{}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
disabledEndOfRunStalenessMarkers bool
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// scrapeCache tracks mappings of exposed metric strings to label sets and
|
|
|
|
// scrapeCache tracks mappings of exposed metric strings to label sets and
|
|
|
@ -996,7 +1000,9 @@ mainLoop:
|
|
|
|
|
|
|
|
|
|
|
|
close(sl.stopped)
|
|
|
|
close(sl.stopped)
|
|
|
|
|
|
|
|
|
|
|
|
sl.endOfRunStaleness(last, ticker, interval)
|
|
|
|
if !sl.disabledEndOfRunStalenessMarkers {
|
|
|
|
|
|
|
|
sl.endOfRunStaleness(last, ticker, interval)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (sl *scrapeLoop) endOfRunStaleness(last time.Time, ticker *time.Ticker, interval time.Duration) {
|
|
|
|
func (sl *scrapeLoop) endOfRunStaleness(last time.Time, ticker *time.Ticker, interval time.Duration) {
|
|
|
@ -1054,6 +1060,10 @@ func (sl *scrapeLoop) stop() {
|
|
|
|
<-sl.stopped
|
|
|
|
<-sl.stopped
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (sl *scrapeLoop) disableEndOfRunStalenessMarkers() {
|
|
|
|
|
|
|
|
sl.disabledEndOfRunStalenessMarkers = true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (sl *scrapeLoop) getCache() *scrapeCache {
|
|
|
|
func (sl *scrapeLoop) getCache() *scrapeCache {
|
|
|
|
return sl.cache
|
|
|
|
return sl.cache
|
|
|
|
}
|
|
|
|
}
|
|
|
|