Add in-flight identifier for Prometheus requests

Repeat Prometheus requests with the same query
will cancel preceding requests.
This commit is contained in:
stuart nelson 2016-06-08 18:05:46 +02:00
parent 6da7ed9706
commit 18f9f6c159

View File

@ -21,10 +21,11 @@ export function PrometheusDatasource(instanceSettings, $q, backendSrv, templateS
this.withCredentials = instanceSettings.withCredentials;
this.lastErrors = {};
this._request = function(method, url) {
this._request = function(method, url, cacheKey) {
var options: any = {
url: this.url + url,
method: method
method: method,
cacheKey: cacheKey
};
if (this.basicAuth || this.withCredentials) {
@ -122,7 +123,7 @@ export function PrometheusDatasource(instanceSettings, $q, backendSrv, templateS
this.performTimeSeriesQuery = function(query, start, end) {
var url = '/api/v1/query_range?query=' + encodeURIComponent(query.expr) + '&start=' + start + '&end=' + end + '&step=' + query.step;
return this._request('GET', url);
return this._request('GET', url, query.expr.toString());
};
this.performSuggestQuery = function(query) {