From b757b59f9fa6ee47f5cc8dcf991c137de37afbef Mon Sep 17 00:00:00 2001 From: Robert Jacob Date: Sun, 21 Jun 2020 18:04:42 +0200 Subject: [PATCH] Fix stale threshold --- collector.go | 2 +- main.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/collector.go b/collector.go index f86581d..78fd4d9 100644 --- a/collector.go +++ b/collector.go @@ -138,7 +138,7 @@ func (c *netatmoCollector) collectData(ch chan<- prometheus.Metric, device *neta date := time.Unix(*data.LastMeasure, 0) if time.Since(date) > c.staleThreshold { - c.log.Warnf("Data is stale: %s > %s", time.Since(date), c.staleThreshold) + c.log.Warnf("Data is stale for %s: %s > %s", moduleName, time.Since(date), c.staleThreshold) return } diff --git a/main.go b/main.go index 6ee90b7..629cdc3 100644 --- a/main.go +++ b/main.go @@ -36,8 +36,9 @@ func main() { } metrics := &netatmoCollector{ - log: log, - client: client, + log: log, + client: client, + staleThreshold: cfg.StaleDuration, } prometheus.MustRegister(metrics)