From eb35f8cb8900a6ef0c25c497423fcf4c2b23c81c Mon Sep 17 00:00:00 2001 From: stuart nelson Date: Thu, 30 Jun 2016 11:29:02 +0200 Subject: [PATCH] [prometheus] Use `panelId` and `target.refId` for requestId Using these two values ties requests to a particular query position within a panel, ensuring that requests are canceled if: - Duplicate requests with the same query are sent - Requests from the same query position (but a different query) are sent The last point is important as it identifies queries by a physical location in the dashboard instead of with the query expression. If a different query from the same position in a panel is sent, the previous request should be canceled. --- public/app/plugins/datasource/prometheus/datasource.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/prometheus/datasource.ts b/public/app/plugins/datasource/prometheus/datasource.ts index 4284ce78e8f..cbde594b6b1 100644 --- a/public/app/plugins/datasource/prometheus/datasource.ts +++ b/public/app/plugins/datasource/prometheus/datasource.ts @@ -77,7 +77,7 @@ export function PrometheusDatasource(instanceSettings, $q, backendSrv, templateS var query: any = {}; query.expr = templateSrv.replace(target.expr, options.scopedVars, self.interpolateQueryExpr); - query.requestId = target.expr; + query.requestId = options.panelId + target.refId; var interval = target.interval || options.interval; var intervalFactor = target.intervalFactor || 1;