From 9dd457e0ec50b0f3c8e457d98b9aa0cc8d4bf55a Mon Sep 17 00:00:00 2001 From: Bryan Davis Date: Fri, 2 Oct 2015 10:07:36 -0600 Subject: [PATCH] Backport: series ref (#A-Z) and referenced series is hidden Manual backport of upstream fb9f9548829f2d4cecf35cda933700e5c2fa1bd6 which fixes bug #2484 "Hiding a metric influences dependent metrics". --- src/app/features/graphite/datasource.js | 6 ++++-- src/test/specs/graphiteDatasource-specs.js | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/app/features/graphite/datasource.js b/src/app/features/graphite/datasource.js index 1b6c500..0114147 100644 --- a/src/app/features/graphite/datasource.js +++ b/src/app/features/graphite/datasource.js @@ -269,7 +269,7 @@ function (angular, _, $, config, kbn, moment) { for (i = 0; i < options.targets.length; i++) { target = options.targets[i]; - if (!target.target || target.hide) { + if (!target.target) { continue; } @@ -277,7 +277,9 @@ function (angular, _, $, config, kbn, moment) { targetValue = targetValue.replace(regex, nestedSeriesRegexReplacer); targets[this._seriesRefLetters[i]] = targetValue; - clean_options.push("target=" + encodeURIComponent(targetValue)); + if (!target.hide) { + clean_options.push("target=" + encodeURIComponent(targetValue)); + } } _.each(options, function (value, key) { diff --git a/src/test/specs/graphiteDatasource-specs.js b/src/test/specs/graphiteDatasource-specs.js index 58bc62b..5b9ba1c 100644 --- a/src/test/specs/graphiteDatasource-specs.js +++ b/src/test/specs/graphiteDatasource-specs.js @@ -81,6 +81,13 @@ define([ expect(results[2]).to.be('target=' + encodeURIComponent("asPercent(series1,sumSeries(series1))")); }); + it('should replace target placeholder for hidden series', function() { + var results = ctx.ds.buildGraphiteParams({ + targets: [{target: 'series1', hide: true}, {target: 'sumSeries(#A)', hide: true}, {target: 'asPercent(#A,#B)'}] + }); + expect(results[0]).to.be('target=' + encodeURIComponent('asPercent(series1,sumSeries(series1))')); + }); + it('should fix wrong minute interval parameters', function() { var results = ctx.ds.buildGraphiteParams({ targets: [{target: "summarize(prod.25m.count, '25m', 'sum')" }] -- 2.4.2