From 43ba563a1c409402ba9ac0afbe68d227341b37a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 23 May 2016 07:55:55 +0200 Subject: [PATCH 1/2] fix(logging): change log level to trace for plugin proxy logging call, fixes #5126 --- pkg/api/pluginproxy/pluginproxy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/api/pluginproxy/pluginproxy.go b/pkg/api/pluginproxy/pluginproxy.go index 92d07988b64..21d40ecb948 100644 --- a/pkg/api/pluginproxy/pluginproxy.go +++ b/pkg/api/pluginproxy/pluginproxy.go @@ -88,7 +88,7 @@ func NewApiPluginProxy(ctx *middleware.Context, proxyPath string, route *plugins } for key, value := range headers { - log.Info("setting key %v value %v", key, value[0]) + log.Trace("setting key %v value %v", key, value[0]) req.Header.Set(key, value[0]) } } From 1da149d9e1c179c2b0d139474ad750f0c6fdc9ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 23 May 2016 09:28:14 +0200 Subject: [PATCH 2/2] feat(annotations): annotations can now use a template variable as data source, closes #5054 --- package.json | 2 +- public/app/core/services/datasource_srv.js | 51 +++++++++++-------- .../app/features/annotations/editor_ctrl.js | 2 +- 3 files changed, 31 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index b9b87ab6e75..b110d6107c8 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "company": "Coding Instinct AB" }, "name": "grafana", - "version": "3.0.2", + "version": "3.0.3", "repository": { "type": "git", "url": "http://github.com/grafana/grafana.git" diff --git a/public/app/core/services/datasource_srv.js b/public/app/core/services/datasource_srv.js index 32bc9a39725..378cfa2d9d5 100644 --- a/public/app/core/services/datasource_srv.js +++ b/public/app/core/services/datasource_srv.js @@ -66,14 +66,17 @@ function (angular, _, coreModule, config) { }; this.getAnnotationSources = function() { - return _.reduce(config.datasources, function(memo, value) { + var sources = []; + this.addDataSourceVariables(sources); + + _.each(config.datasources, function(value) { if (value.meta && value.meta.annotations) { - memo.push(value); + sources.push(value); } + }); - return memo; - }, []); + return sources; }; this.getMetricSources = function(options) { @@ -90,24 +93,7 @@ function (angular, _, coreModule, config) { }); if (!options || !options.skipVariables) { - // look for data source variables - for (var i = 0; i < templateSrv.variables.length; i++) { - var variable = templateSrv.variables[i]; - if (variable.type !== 'datasource') { - continue; - } - - var first = variable.current.value; - var ds = config.datasources[first]; - - if (ds) { - metricSources.push({ - name: '$' + variable.name, - value: '$' + variable.name, - meta: ds.meta, - }); - } - } + this.addDataSourceVariables(metricSources); } metricSources.sort(function(a, b) { @@ -123,6 +109,27 @@ function (angular, _, coreModule, config) { return metricSources; }; + this.addDataSourceVariables = function(list) { + // look for data source variables + for (var i = 0; i < templateSrv.variables.length; i++) { + var variable = templateSrv.variables[i]; + if (variable.type !== 'datasource') { + continue; + } + + var first = variable.current.value; + var ds = config.datasources[first]; + + if (ds) { + list.push({ + name: '$' + variable.name, + value: '$' + variable.name, + meta: ds.meta, + }); + } + } + }; + this.init(); }); }); diff --git a/public/app/features/annotations/editor_ctrl.js b/public/app/features/annotations/editor_ctrl.js index ca754b094a8..c37592cc905 100644 --- a/public/app/features/annotations/editor_ctrl.js +++ b/public/app/features/annotations/editor_ctrl.js @@ -30,7 +30,7 @@ function (angular, _, $) { $scope.datasourceChanged = function() { return datasourceSrv.get($scope.currentAnnotation.datasource).then(function(ds) { $scope.currentDatasource = ds; - $scope.currentAnnotation.datasource = ds.name; + $scope.currentAnnotation.datasource = $scope.currentAnnotation.datasource; }); };