Quellcode durchsuchen

Add in-flight identifier for Prometheus requests

Repeat Prometheus requests with the same query
will cancel preceding requests.
stuart nelson vor 9 Jahren
Ursprung
Commit
18f9f6c159
1 geänderte Dateien mit 4 neuen und 3 gelöschten Zeilen
  1. 4 3
      public/app/plugins/datasource/prometheus/datasource.ts

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

@@ -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) {