From af5ced0e18f4f9948d68742725c821adf02b4b58 Mon Sep 17 00:00:00 2001 From: Carl Bergquist Date: Thu, 30 Nov 2017 15:06:02 +0100 Subject: [PATCH] Revert "prometheus nested query support" --- .../plugins/datasource/prometheus/datasource.ts | 8 -------- .../prometheus/specs/datasource_specs.ts | 15 --------------- 2 files changed, 23 deletions(-) diff --git a/public/app/plugins/datasource/prometheus/datasource.ts b/public/app/plugins/datasource/prometheus/datasource.ts index 6f41833e22a..ec295760d49 100644 --- a/public/app/plugins/datasource/prometheus/datasource.ts +++ b/public/app/plugins/datasource/prometheus/datasource.ts @@ -157,7 +157,6 @@ export class PrometheusDatasource { // Only replace vars in expression after having (possibly) updated interval vars query.expr = this.templateSrv.replace(target.expr, scopedVars, this.interpolateQueryExpr); - query.expr = this.replaceNestedQuery(query.expr, options); query.requestId = options.panelId + target.refId; return query; } @@ -272,13 +271,6 @@ export class PrometheusDatasource { }); } - replaceNestedQuery(query, options) { - return query.replace(/\#([A-Z])/g, (match, g1) => { - let replaceTarget = options.targets.find((t) => { return t.refId === g1; }); - return replaceTarget ? replaceTarget.expr : match; - }); - } - transformMetricData(md, options, start, end, step) { var dps = [], metricLabel = null; diff --git a/public/app/plugins/datasource/prometheus/specs/datasource_specs.ts b/public/app/plugins/datasource/prometheus/specs/datasource_specs.ts index a507aa41545..a7d18f3f158 100644 --- a/public/app/plugins/datasource/prometheus/specs/datasource_specs.ts +++ b/public/app/plugins/datasource/prometheus/specs/datasource_specs.ts @@ -590,19 +590,4 @@ describe('PrometheusDatasource', function() { expect(query.scopedVars.__interval_ms.value).to.be(5 * 1000); }); }); - describe('The nested query', function() { - it('should generate correct query', function() { - let query = 'sum(rate(#A[1m]))'; - let options = { - targets: [ - { - refId: 'A', - expr: 'http_requests_total' - } - ] - }; - let result = ctx.ds.replaceNestedQuery(query, options); - expect(result).to.be('sum(rate(http_requests_total[1m]))'); - }); - }); });