mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix: fixed prometheus step issue that caused browser crash, fixes #9575
This commit is contained in:
parent
1797e2221a
commit
8d68bd6bb9
@ -168,7 +168,7 @@ export class PrometheusDatasource {
|
||||
if (interval !== 0 && range / intervalFactor / interval > 11000) {
|
||||
interval = Math.ceil(range / intervalFactor / 11000);
|
||||
}
|
||||
return Math.max(interval * intervalFactor, minInterval);
|
||||
return Math.max(interval * intervalFactor, minInterval, 1);
|
||||
}
|
||||
|
||||
performTimeSeriesQuery(query, start, end) {
|
||||
|
@ -294,6 +294,20 @@ describe('PrometheusDatasource', function() {
|
||||
ctx.ds.query(query);
|
||||
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() {
|
||||
var query = {
|
||||
// 6 hour range
|
||||
|
Loading…
Reference in New Issue
Block a user