Commit 9e4656e4 by Torkel Ödegaard

New config setting for graphite datasource to control if json render request is…

New config setting for graphite datasource to control if json render request is POST or GET (Closes #345)
parent 827e1846
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
for very short absolute ranges (Issue #320) for very short absolute ranges (Issue #320)
- Increased resolution for graphite datapoints (maxDataPoints), now equal to panel pixel width. (Closes #5) - Increased resolution for graphite datapoints (maxDataPoints), now equal to panel pixel width. (Closes #5)
- Improvement to influxdb query editor, can now add where clause and alias (Issue #331, thanks @mavimo) - Improvement to influxdb query editor, can now add where clause and alias (Issue #331, thanks @mavimo)
- New config setting for graphite datasource to control if json render request is POST or GET (Issue #345)
# 1.5.3 (2014-04-17) # 1.5.3 (2014-04-17)
- Add support for async scripted dashboards (Issue #274) - Add support for async scripted dashboards (Issue #274)
......
...@@ -19,6 +19,7 @@ function (angular, _, $, config, kbn, moment) { ...@@ -19,6 +19,7 @@ function (angular, _, $, config, kbn, moment) {
this.url = datasource.url; this.url = datasource.url;
this.editorSrc = 'app/partials/graphite/editor.html'; this.editorSrc = 'app/partials/graphite/editor.html';
this.name = datasource.name; this.name = datasource.name;
this.render_method = datasource.render_method || 'POST';
} }
GraphiteDatasource.prototype.query = function(options) { GraphiteDatasource.prototype.query = function(options) {
...@@ -37,14 +38,17 @@ function (angular, _, $, config, kbn, moment) { ...@@ -37,14 +38,17 @@ function (angular, _, $, config, kbn, moment) {
return $q.when(this.url + '/render' + '?' + params.join('&')); return $q.when(this.url + '/render' + '?' + params.join('&'));
} }
return this.doGraphiteRequest({ var httpOptions = { method: this.render_method, url: '/render' };
method: 'POST',
url: '/render', if (httpOptions.method === 'GET') {
data: params.join('&'), httpOptions.url = httpOptions.url + '?' + params.join('&');
headers: { }
'Content-Type': 'application/x-www-form-urlencoded', else {
} httpOptions.data = params.join('&');
}); httpOptions.headers = { 'Content-Type': 'application/x-www-form-urlencoded' };
}
return this.doGraphiteRequest(httpOptions);
} }
catch(err) { catch(err) {
return $q.reject(err); return $q.reject(err);
......
...@@ -25,12 +25,21 @@ function (Settings) { ...@@ -25,12 +25,21 @@ function (Settings) {
graphiteUrl: "http://"+window.location.hostname+":8080", graphiteUrl: "http://"+window.location.hostname+":8080",
/** /**
* Multiple graphite servers? Comment out graphiteUrl and replace with * Multiple graphite servers? Comment out graphiteUrl and replace with something like this:
*
* datasources: { datasources: {
* data_center_us: { type: 'graphite', url: 'http://<graphite_url>', default: true }, data_center_us: {
* data_center_eu: { type: 'graphite', url: 'http://<graphite_url>' } type: 'graphite',
* } url: 'http://<graphite_url>',
default: true
},
data_center_eu: {
type: 'graphite',
url: 'http://<graphite_url>',
render_method: 'GET' // optional, use this to change render calls from POST to GET
}
},
*/ */
default_route: '/dashboard/file/default.json', default_route: '/dashboard/file/default.json',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment