Apply downsampling only to numeric data, fixes #325
This commit is contained in:
20
dist/test/datasource-zabbix/datasource.js
vendored
20
dist/test/datasource-zabbix/datasource.js
vendored
@@ -159,7 +159,7 @@ var ZabbixAPIDatasource = function () {
|
||||
}
|
||||
|
||||
if (!target.mode || target.mode === c.MODE_METRICS) {
|
||||
return _this.queryNumericData(target, timeRange, useTrends);
|
||||
return _this.queryNumericData(target, timeRange, useTrends, options);
|
||||
} else if (target.mode === c.MODE_TEXT) {
|
||||
return _this.queryTextData(target, timeRange);
|
||||
}
|
||||
@@ -179,25 +179,23 @@ var ZabbixAPIDatasource = function () {
|
||||
});
|
||||
|
||||
// Data for panel (all targets)
|
||||
return Promise.all(_lodash2.default.flatten(promises)).then(_lodash2.default.flatten).then(function (timeseries_data) {
|
||||
return downsampleSeries(timeseries_data, options);
|
||||
}).then(function (data) {
|
||||
return Promise.all(_lodash2.default.flatten(promises)).then(_lodash2.default.flatten).then(function (data) {
|
||||
return { data: data };
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'queryNumericData',
|
||||
value: function queryNumericData(target, timeRange, useTrends) {
|
||||
value: function queryNumericData(target, timeRange, useTrends, options) {
|
||||
var _this2 = this;
|
||||
|
||||
var _timeRange = _slicedToArray(timeRange, 2),
|
||||
timeFrom = _timeRange[0],
|
||||
timeTo = _timeRange[1];
|
||||
|
||||
var options = {
|
||||
var getItemOptions = {
|
||||
itemtype: 'num'
|
||||
};
|
||||
return this.zabbix.getItemsFromTarget(target, options).then(function (items) {
|
||||
return this.zabbix.getItemsFromTarget(target, getItemOptions).then(function (items) {
|
||||
var getHistoryPromise = void 0;
|
||||
|
||||
if (useTrends) {
|
||||
@@ -221,9 +219,11 @@ var ZabbixAPIDatasource = function () {
|
||||
});
|
||||
}
|
||||
|
||||
return getHistoryPromise.then(function (timeseries_data) {
|
||||
return _this2.applyDataProcessingFunctions(timeseries_data, target);
|
||||
});
|
||||
return getHistoryPromise;
|
||||
}).then(function (timeseries) {
|
||||
return _this2.applyDataProcessingFunctions(timeseries, target);
|
||||
}).then(function (timeseries) {
|
||||
return downsampleSeries(timeseries, options);
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user