Fix bar width issue in aligned prometheus queries (#12483)

* Fix bar width issue in aligned prometheus queries

This was broken because null values were filled in with unaligned times.

* use aligned times for result transformation
* add tests

An earlier version of this fix aligned the times again in the transformer, but
I think it's safe to only deal with aligned times in the response.

* Fixed prometheus heatmap tranformer test

The interval needs to be 1 to prevent step alignment.
This commit is contained in:
David
2018-07-02 11:04:36 -07:00
committed by Torkel Ödegaard
parent a89351e8e0
commit 0d1f7c8782
4 changed files with 95 additions and 3 deletions
+14
View File
@@ -119,6 +119,20 @@ describe('TimeSeries', function() {
series.getFlotPairs('null');
expect(series.stats.avg).toBe(null);
});
it('calculates timeStep', function() {
series = new TimeSeries({
datapoints: [[null, 1], [null, 2], [null, 3]],
});
series.getFlotPairs('null');
expect(series.stats.timeStep).toBe(1);
series = new TimeSeries({
datapoints: [[0, 1530529290], [0, 1530529305], [0, 1530529320]],
});
series.getFlotPairs('null');
expect(series.stats.timeStep).toBe(15);
});
});
describe('When checking if ms resolution is needed', function() {