fix: fixed prometheus step issue that caused browser crash, fixes #9575
(cherry picked from commit 8d68bd6bb9)
This commit is contained in:
@@ -168,7 +168,7 @@ export class PrometheusDatasource {
|
|||||||
if (interval !== 0 && range / intervalFactor / interval > 11000) {
|
if (interval !== 0 && range / intervalFactor / interval > 11000) {
|
||||||
interval = Math.ceil(range / intervalFactor / 11000);
|
interval = Math.ceil(range / intervalFactor / 11000);
|
||||||
}
|
}
|
||||||
return Math.max(interval * intervalFactor, minInterval);
|
return Math.max(interval * intervalFactor, minInterval, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
performTimeSeriesQuery(query, start, end) {
|
performTimeSeriesQuery(query, start, end) {
|
||||||
|
|||||||
@@ -294,6 +294,20 @@ describe('PrometheusDatasource', function() {
|
|||||||
ctx.ds.query(query);
|
ctx.ds.query(query);
|
||||||
ctx.$httpBackend.verifyNoOutstandingExpectation();
|
ctx.$httpBackend.verifyNoOutstandingExpectation();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('step should never go below 1', function() {
|
||||||
|
var query = {
|
||||||
|
// 6 hour range
|
||||||
|
range: { from: moment(1508318768202), to: moment(1508318770118) },
|
||||||
|
targets: [{expr: 'test'}],
|
||||||
|
interval: '100ms'
|
||||||
|
};
|
||||||
|
var urlExpected = 'proxied/api/v1/query_range?query=test&start=1508318769&end=1508318771&step=1';
|
||||||
|
ctx.$httpBackend.expect('GET', urlExpected).respond(response);
|
||||||
|
ctx.ds.query(query);
|
||||||
|
ctx.$httpBackend.verifyNoOutstandingExpectation();
|
||||||
|
});
|
||||||
|
|
||||||
it('should be auto interval when greater than min interval', function() {
|
it('should be auto interval when greater than min interval', function() {
|
||||||
var query = {
|
var query = {
|
||||||
// 6 hour range
|
// 6 hour range
|
||||||
|
|||||||
Reference in New Issue
Block a user