mirror of
https://github.com/grafana/grafana.git
synced 2025-01-18 04:23:33 -06:00
enable sending calculated interval to opentsdb downsample
This commit is contained in:
parent
2cc9515fd6
commit
72f6dc1e0c
@ -24,7 +24,15 @@ function (angular, _, kbn) {
|
||||
OpenTSDBDatasource.prototype.query = function(options) {
|
||||
var start = convertToTSDBTime(options.range.from);
|
||||
var end = convertToTSDBTime(options.range.to);
|
||||
var queries = _.compact(_.map(options.targets, convertTargetToQuery));
|
||||
var qs = Array();
|
||||
if (options.interval.match(/\.[0-9]+s/)) {
|
||||
options.interval = parseFloat(options.interval)*1000 + "ms"
|
||||
}
|
||||
_.each(options.targets, function(target){
|
||||
qs.push(convertTargetToQuery(target, options.interval));
|
||||
}
|
||||
);
|
||||
var queries = _.compact(qs);
|
||||
|
||||
// No valid targets, return the empty result to save a round trip.
|
||||
if (_.isEmpty(queries)) {
|
||||
@ -119,7 +127,7 @@ function (angular, _, kbn) {
|
||||
return metric;
|
||||
}
|
||||
|
||||
function convertTargetToQuery(target) {
|
||||
function convertTargetToQuery(target, interval) {
|
||||
if (!target.metric) {
|
||||
return null;
|
||||
}
|
||||
@ -149,7 +157,7 @@ function (angular, _, kbn) {
|
||||
}
|
||||
|
||||
if (target.shouldDownsample) {
|
||||
query.downsample = templateSrv.replace(target.downsampleInterval) + "-" + target.downsampleAggregator;
|
||||
query.downsample = templateSrv.replace(target.downsampleInterval ? target.downsampleInterval : interval ) + "-" + target.downsampleAggregator;
|
||||
}
|
||||
|
||||
query.tags = angular.copy(target.tags);
|
||||
|
Loading…
Reference in New Issue
Block a user