about summary refs log tree commit diff
path: root/pkgs/servers/monitoring
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2023-12-06 06:01:30 +0000
committerGitHub <noreply@github.com>2023-12-06 06:01:30 +0000
commit035a649a67c56b9d16be608e8bb87b9c215b33da (patch)
treecdb7f52fa90bd89fe14628303333ba524f1c49be /pkgs/servers/monitoring
parent2622221e95392f62f81ae60c35504e338e9ac2cf (diff)
parentbf78e6a54601fc74d8d27fb918a420c84fb6f5b3 (diff)
downloadnixlib-035a649a67c56b9d16be608e8bb87b9c215b33da.tar
nixlib-035a649a67c56b9d16be608e8bb87b9c215b33da.tar.gz
nixlib-035a649a67c56b9d16be608e8bb87b9c215b33da.tar.bz2
nixlib-035a649a67c56b9d16be608e8bb87b9c215b33da.tar.lz
nixlib-035a649a67c56b9d16be608e8bb87b9c215b33da.tar.xz
nixlib-035a649a67c56b9d16be608e8bb87b9c215b33da.tar.zst
nixlib-035a649a67c56b9d16be608e8bb87b9c215b33da.zip
Merge master into staging-next
Diffstat (limited to 'pkgs/servers/monitoring')
-rw-r--r--pkgs/servers/monitoring/prometheus/smartctl-exporter/0001-Return-the-cached-value-if-it-s-not-time-to-scan-aga.patch51
1 files changed, 0 insertions, 51 deletions
diff --git a/pkgs/servers/monitoring/prometheus/smartctl-exporter/0001-Return-the-cached-value-if-it-s-not-time-to-scan-aga.patch b/pkgs/servers/monitoring/prometheus/smartctl-exporter/0001-Return-the-cached-value-if-it-s-not-time-to-scan-aga.patch
deleted file mode 100644
index 28616251f37e..000000000000
--- a/pkgs/servers/monitoring/prometheus/smartctl-exporter/0001-Return-the-cached-value-if-it-s-not-time-to-scan-aga.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From e81b06df67b1d42ef915615fafa0b56ef956673b Mon Sep 17 00:00:00 2001
-From: Andreas Fuchs <asf@boinkor.net>
-Date: Thu, 11 Feb 2021 17:30:44 -0500
-Subject: [PATCH] Return the cached value if it's not time to scan again yet
-
-This should ensure that if we have a valid value cached (which ought
-to be every time after the first scan), we return it as metrics.
-
-This fixes the crashes that would happen if queries happened earlier
-than the re-scan interval allowed.
-
-Address review feedback: Shorten the time-to-scan logic
-
-We can express this in a single if statement, so it takes fewer lines
-to do the "should we check again" check.
----
- readjson.go | 11 ++---------
- 1 file changed, 2 insertions(+), 9 deletions(-)
-
-diff --git a/readjson.go b/readjson.go
-index da35448..c9996fd 100644
---- a/readjson.go
-+++ b/readjson.go
-@@ -78,14 +78,7 @@ func readData(device string) (gjson.Result, error) {
- 
- 	if _, err := os.Stat(device); err == nil {
- 		cacheValue, cacheOk := jsonCache[device]
--		timeToScan := false
--		if cacheOk {
--			timeToScan = time.Now().After(cacheValue.LastCollect.Add(options.SMARTctl.CollectPeriodDuration))
--		} else {
--			timeToScan = true
--		}
--
--		if timeToScan {
-+		if !cacheOk || time.Now().After(cacheValue.LastCollect.Add(options.SMARTctl.CollectPeriodDuration)) {
- 			json, ok := readSMARTctl(device)
- 			if ok {
- 				jsonCache[device] = JSONCache{JSON: json, LastCollect: time.Now()}
-@@ -93,7 +86,7 @@ func readData(device string) (gjson.Result, error) {
- 			}
- 			return gjson.Parse(DEFAULT_EMPTY_JSON), fmt.Errorf("smartctl returned bad data for device %s", device)
- 		}
--		return gjson.Parse(DEFAULT_EMPTY_JSON), fmt.Errorf("Too early collect called for device %s", device)
-+		return cacheValue.JSON, nil
- 	}
- 	return gjson.Parse(DEFAULT_EMPTY_JSON), fmt.Errorf("Device %s unavialable", device)
- }
--- 
-2.33.1
-