Blame SOURCES/002-redis-pass-correct-timespec.patch

8f9145
diff --git a/src/datasources/redis/datasource.ts b/src/datasources/redis/datasource.ts
8f9145
index 5980ffa..1d108a9 100644
8f9145
--- a/src/datasources/redis/datasource.ts
8f9145
+++ b/src/datasources/redis/datasource.ts
8f9145
@@ -170,15 +170,14 @@ export class PCPRedisDatasource {
8f9145
             }
8f9145
         }
8f9145
 
8f9145
-        const sampleIntervalSec = 60; // guessed sample interval
8f9145
+        const interval = query.intervalMs / 1000; // seconds
8f9145
         // request a bigger time frame to fill the chart (otherwise left and right border of chart is empty)
8f9145
         // because of the rate conversation of counters first datapoint is "lost" -> expand timeframe at the beginning
8f9145
-        const start = Math.round(query.range.from.valueOf() / 1000) - 2 * sampleIntervalSec;
8f9145
-        const finish = Math.round(query.range.to.valueOf() / 1000) + sampleIntervalSec;
8f9145
-        const samples = Math.round((query.range.to.valueOf() - query.range.from.valueOf()) / query.intervalMs);
8f9145
-        // const interval = query.interval;
8f9145
+        const additionalTimeRange = Math.max(interval, 60); // 60s is the default sample interval of pmlogger
8f9145
+        const start = Math.floor(query.range.from.valueOf() / 1000 - 2 * additionalTimeRange); // seconds
8f9145
+        const finish = Math.ceil(query.range.to.valueOf() / 1000 + additionalTimeRange); // seconds
8f9145
 
8f9145
-        const instances = await this.pmSeriesSrv.getValues(seriesList, { start, finish, samples });
8f9145
+        const instances = await this.pmSeriesSrv.getValues(seriesList, { start, finish, interval });
8f9145
         const descriptions = await this.pmSeriesSrv.getDescriptions(seriesList);
8f9145
         const metricNames = await this.pmSeriesSrv.getMetricNames(seriesList);
8f9145
         const instanceValuesGroupedBySeries = _.groupBy(instances, "series");
8f9145
-- 
8f9145
2.21.1
8f9145