From 8b9d3e7547c4832f4506251c56e70b650611b7bb Mon Sep 17 00:00:00 2001 From: Brian Brazil Date: Tue, 16 May 2017 13:12:21 +0100 Subject: [PATCH] Put end of run staleness handler in seperate function. Improve log message. --- retrieval/scrape.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/retrieval/scrape.go b/retrieval/scrape.go index 3e5e41db3..d04d07313 100644 --- a/retrieval/scrape.go +++ b/retrieval/scrape.go @@ -505,7 +505,7 @@ mainLoop: // The append failed, probably due to a parse error. // Call sl.append again with an empty scrape to trigger stale markers. if _, _, err = sl.append([]byte{}, start); err != nil { - log.With("err", err).Error("failure append failed") + log.With("err", err).Error("append failed") } } @@ -524,6 +524,10 @@ mainLoop: close(sl.stopped) + sl.endOfRunStaleness(last, ticker, interval) +} + +func (sl *scrapeLoop) endOfRunStaleness(last time.Time, ticker *time.Ticker, interval time.Duration) { // Scraping has stopped. We want to write stale markers but // the target may be recreated, so we wait just over 2 scrape intervals // before creating them.