mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user