fix(metrics): differentiate points in different minutes to be more accurate (#2770)

This commit is contained in:
Rogger Valverde
2024-09-10 07:09:00 -06:00
committed by GitHub
parent f59473b26e
commit fbf2fa397c
2 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ local function collectMetrics(metaKey, dataPointsList, maxDataPoints, timestamp)
return
end
local N = math.min(math.floor((timestamp - prevTS) / 60000), tonumber(maxDataPoints))
local N = math.min(math.floor(timestamp / 60000) - math.floor(prevTS / 60000), tonumber(maxDataPoints))
if N > 0 then
local delta = count - rcall("HGET", metaKey, "prevCount")
+4
View File
@@ -34,6 +34,8 @@ describe('metrics', () => {
ONE_MINUTE,
ONE_MINUTE,
ONE_MINUTE * 3,
ONE_SECOND * 70,
ONE_SECOND * 50,
ONE_HOUR,
ONE_MINUTE
];
@@ -100,6 +102,8 @@ describe('metrics', () => {
'0',
'0',
'1',
'1',
'1',
'0',
'0',
'1',