mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Add in-flight identifier for Prometheus requests
Repeat Prometheus requests with the same query will cancel preceding requests.
This commit is contained in:
parent
6da7ed9706
commit
18f9f6c159
@ -21,10 +21,11 @@ export function PrometheusDatasource(instanceSettings, $q, backendSrv, templateS
|
|||||||
this.withCredentials = instanceSettings.withCredentials;
|
this.withCredentials = instanceSettings.withCredentials;
|
||||||
this.lastErrors = {};
|
this.lastErrors = {};
|
||||||
|
|
||||||
this._request = function(method, url) {
|
this._request = function(method, url, cacheKey) {
|
||||||
var options: any = {
|
var options: any = {
|
||||||
url: this.url + url,
|
url: this.url + url,
|
||||||
method: method
|
method: method,
|
||||||
|
cacheKey: cacheKey
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.basicAuth || this.withCredentials) {
|
if (this.basicAuth || this.withCredentials) {
|
||||||
@ -122,7 +123,7 @@ export function PrometheusDatasource(instanceSettings, $q, backendSrv, templateS
|
|||||||
|
|
||||||
this.performTimeSeriesQuery = function(query, start, end) {
|
this.performTimeSeriesQuery = function(query, start, end) {
|
||||||
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);
|
return this._request('GET', url, query.expr.toString());
|
||||||
};
|
};
|
||||||
|
|
||||||
this.performSuggestQuery = function(query) {
|
this.performSuggestQuery = function(query) {
|
||||||
|
Loading…
Reference in New Issue
Block a user