Commit 2bec41b8 by Torkel Ödegaard

Graphite: new option available in metrics view to set cacheTimeout, will…

Graphite: new option available in metrics view to set cacheTimeout, will override default memcache timeout, Closes #266
parent 38633b6d
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
- [Issue #394](https://github.com/grafana/grafana/issues/394). InfluxDB: Annotation support - [Issue #394](https://github.com/grafana/grafana/issues/394). InfluxDB: Annotation support
- [Issue #610](https://github.com/grafana/grafana/issues/610). InfluxDB: Support for InfluxdB v0.8 list series response schemea (series typeahead) - [Issue #610](https://github.com/grafana/grafana/issues/610). InfluxDB: Support for InfluxdB v0.8 list series response schemea (series typeahead)
- [Issue #604](https://github.com/grafana/grafana/issues/604). Chart: New axis format, 'bps' (SI unit in steps of 1000) useful for network gear metics - [Issue #604](https://github.com/grafana/grafana/issues/604). Chart: New axis format, 'bps' (SI unit in steps of 1000) useful for network gear metics
- [Issue #266](https://github.com/grafana/grafana/issues/266). Graphite: New option cacheTimeout to override graphite default memcache timeout
**Changes** **Changes**
- [Issue #536](https://github.com/grafana/grafana/issues/536). Graphite: Use unix epoch for Graphite from/to for absolute time ranges - [Issue #536](https://github.com/grafana/grafana/issues/536). Graphite: Use unix epoch for Graphite from/to for absolute time ranges
......
...@@ -268,6 +268,13 @@ function (angular, _, config, gfunc, Parser) { ...@@ -268,6 +268,13 @@ function (angular, _, config, gfunc, Parser) {
} }
}; };
$scope.toggleMetricOptions = function() {
$scope.panel.metricOptionsEnabled = !$scope.panel.metricOptionsEnabled;
if (!$scope.panel.metricOptionsEnabled) {
delete $scope.panel.cacheTimeout;
}
};
$scope.duplicate = function() { $scope.duplicate = function() {
var clone = angular.copy($scope.target); var clone = angular.copy($scope.target);
$scope.panel.targets.push(clone); $scope.panel.targets.push(clone);
......
...@@ -265,18 +265,19 @@ function (angular, app, $, _, kbn, moment, timeSeries) { ...@@ -265,18 +265,19 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
$scope.updateTimeRange(); $scope.updateTimeRange();
var graphiteQuery = { var metricsQuery = {
range: $scope.rangeUnparsed, range: $scope.rangeUnparsed,
interval: $scope.interval, interval: $scope.interval,
targets: $scope.panel.targets, targets: $scope.panel.targets,
format: $scope.panel.renderer === 'png' ? 'png' : 'json', format: $scope.panel.renderer === 'png' ? 'png' : 'json',
maxDataPoints: $scope.resolution, maxDataPoints: $scope.resolution,
datasource: $scope.panel.datasource, datasource: $scope.panel.datasource,
cacheTimeout: $scope.panel.cacheTimeout
}; };
$scope.annotationsPromise = annotationsSrv.getAnnotations($scope.filter, $scope.rangeUnparsed, $scope.dashboard); $scope.annotationsPromise = annotationsSrv.getAnnotations($scope.filter, $scope.rangeUnparsed, $scope.dashboard);
return $scope.datasource.query($scope.filter, graphiteQuery) return $scope.datasource.query($scope.filter, metricsQuery)
.then($scope.dataHandler) .then($scope.dataHandler)
.then(null, function(err) { .then(null, function(err) {
$scope.panelMeta.loading = false; $scope.panelMeta.loading = false;
......
...@@ -32,6 +32,12 @@ ...@@ -32,6 +32,12 @@
Duplicate Duplicate
</a> </a>
</li> </li>
<li role="menuitem">
<a tabindex="1"
ng-click="toggleMetricOptions()">
Toggle request options
</a>
</li>
</ul> </ul>
</li> </li>
<li> <li>
...@@ -77,29 +83,32 @@ ...@@ -77,29 +83,32 @@
<li ng-repeat="func in functions"> <li ng-repeat="func in functions">
<span graphite-func-editor class="grafana-target-segment grafana-target-function"> <span graphite-func-editor class="grafana-target-segment grafana-target-function">
</span> </span>
<!-- <a class="grafana-target-segment grafana-target-function dropdown-toggle"
bs-popover="'app/partials/graphite/funcEditor.html'"
data-placement="bottom">
{{func.def.name}}
</a> -->
<!-- <span class="grafana-target-segment grafana-target-function">
<span>{{func.def.name}}(</span><span ng-repeat="param in func.def.params">
<input type="text"
class="input-mini grafana-function-param-input"
dynamic-width
ng-model="func.params[$index]"></input>
</span><span>)</span>
</span> -->
</li> </li>
<li class="dropdown" graphite-add-func> <li class="dropdown" graphite-add-func>
</li> </li>
</ul> </ul>
<div class="clearfix"></div>
</div>
</div>
<div class="grafana-target grafana-metric-options" ng-if="panel.metricOptionsEnabled">
<div class="grafana-target-inner">
<ul class="grafana-segment-list">
<li class="grafana-target-segment">
cacheTimeout <tip>Graphite parameter to overwride memcache default timeout (unit is seconds)</tip>
</li>
<li>
<input type="text"
class="input-large grafana-target-segment-input"
ng-model="panel.cacheTimeout"
spellcheck='false'
placeholder="60">
</li>
</ul>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
</div> </div>
</div> </div>
...@@ -31,6 +31,7 @@ function (angular, _, $, config, kbn, moment) { ...@@ -31,6 +31,7 @@ function (angular, _, $, config, kbn, moment) {
until: this.translateTime(options.range.to, 'round-up'), until: this.translateTime(options.range.to, 'round-up'),
targets: options.targets, targets: options.targets,
format: options.format, format: options.format,
cacheTimeout: options.cacheTimeout,
maxDataPoints: options.maxDataPoints, maxDataPoints: options.maxDataPoints,
}; };
...@@ -205,7 +206,7 @@ function (angular, _, $, config, kbn, moment) { ...@@ -205,7 +206,7 @@ function (angular, _, $, config, kbn, moment) {
GraphiteDatasource.prototype.buildGraphiteParams = function(filterSrv, options) { GraphiteDatasource.prototype.buildGraphiteParams = function(filterSrv, options) {
var clean_options = []; var clean_options = [];
var graphite_options = ['target', 'targets', 'from', 'until', 'rawData', 'format', 'maxDataPoints']; var graphite_options = ['target', 'targets', 'from', 'until', 'rawData', 'format', 'maxDataPoints', 'cacheTimeout'];
if (options.format !== 'png') { if (options.format !== 'png') {
options['format'] = 'json'; options['format'] = 'json';
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -213,6 +213,13 @@ ...@@ -213,6 +213,13 @@
} }
} }
.grafana-metric-options {
margin-top: 35px;
.grafana-segment-list {
margin-left: 0;
}
}
// fix for fixed positioned panel & scrolling // fix for fixed positioned panel & scrolling
.grafana-segment-dropdown-menu { .grafana-segment-dropdown-menu {
margin-bottom: 70px; margin-bottom: 70px;
......
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