浏览代码

(prometheus) check time range (#6137)

Mitsuhiro Tanda 9 年之前
父节点
当前提交
593863fb9e
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      public/app/plugins/datasource/prometheus/datasource.ts

+ 4 - 0
public/app/plugins/datasource/prometheus/datasource.ts

@@ -123,6 +123,10 @@ export function PrometheusDatasource(instanceSettings, $q, backendSrv, templateS
   };
   };
 
 
   this.performTimeSeriesQuery = function(query, start, end) {
   this.performTimeSeriesQuery = function(query, start, end) {
+    if (start > end) {
+      throw { message: 'Invalid time range' };
+    }
+
     var url = '/api/v1/query_range?query=' + encodeURIComponent(query.expr) + '&start=' + start + '&end=' + end + '&step=' + query.step;
     var url = '/api/v1/query_range?query=' + encodeURIComponent(query.expr) + '&start=' + start + '&end=' + end + '&step=' + query.step;
     return this._request('GET', url, query.requestId);
     return this._request('GET', url, query.requestId);
   };
   };