From 2d988c1b98ba18f61d294fc1a7595ebf238cd140 Mon Sep 17 00:00:00 2001 From: lfblue Date: Mon, 8 Jan 2018 06:19:53 +0300 Subject: [PATCH] added possibility to skip empty buckets in timeseries query --- .gitignore | 1 + dist/datasource.js | 13 +++++++++++-- dist/partials/query.editor.html | 4 ++++ src/datasource.js | 13 +++++++++++-- src/partials/query.editor.html | 4 ++++ 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 93f13619..d73ef080 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules npm-debug.log +.idea \ No newline at end of file diff --git a/dist/datasource.js b/dist/datasource.js index 391064e6..f6cd53e5 100644 --- a/dist/datasource.js +++ b/dist/datasource.js @@ -157,6 +157,8 @@ function (angular, _, dateMath, moment) { var intervals = getQueryIntervals(from, to); var promise = null; + var skipEmptyBuckets = target.skipEmptyBuckets + var selectMetrics = target.selectMetrics; var selectDimensions = target.selectDimensions; var selectThreshold = target.selectThreshold; @@ -187,7 +189,8 @@ function (angular, _, dateMath, moment) { }); } else { - promise = this._timeSeriesQuery(datasource, intervals, granularity, filters, aggregators, postAggregators) + + promise = this._timeSeriesQuery(datasource, intervals, granularity, filters, aggregators, postAggregators,skipEmptyBuckets) .then(function(response) { return convertTimeSeriesData(response.data, metricNames); }); @@ -237,7 +240,7 @@ function (angular, _, dateMath, moment) { return this._druidQuery(query); }; - this._timeSeriesQuery = function (datasource, intervals, granularity, filters, aggregators, postAggregators) { + this._timeSeriesQuery = function (datasource, intervals, granularity, filters, aggregators, postAggregators, skipEmptyBuckets) { var query = { "queryType": "timeseries", "dataSource": datasource, @@ -247,6 +250,12 @@ function (angular, _, dateMath, moment) { "intervals": intervals }; + if(skipEmptyBuckets){ + query.context = { + "skipEmptyBuckets": "true" + } + } + if (filters && filters.length > 0) { query.filter = buildFilterTree(filters); } diff --git a/dist/partials/query.editor.html b/dist/partials/query.editor.html index f9eb9953..510d1001 100644 --- a/dist/partials/query.editor.html +++ b/dist/partials/query.editor.html @@ -22,9 +22,13 @@ + + + +
+ + + +