Apply downsampling only to numeric data, fixes #325
This commit is contained in:
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
- Item name expanding when key contains commas in quoted params, like my_key["a=1,b=2",c,d]
|
- Item name expanding when key contains commas in quoted params, like my_key["a=1,b=2",c,d]
|
||||||
- Incorrect points order when trends are used [#202](https://github.com/alexanderzobnin/grafana-zabbix/issues/202)
|
- Incorrect points order when trends are used [#202](https://github.com/alexanderzobnin/grafana-zabbix/issues/202)
|
||||||
- Triggers panel styles for light theme
|
- Triggers panel styles for light theme
|
||||||
|
- Bug with text metrics when singlestat or table shows NaN, [#325](https://github.com/alexanderzobnin/grafana-zabbix/issues/325)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Template query format. New format is `{group}{host}{app}{item}`. It allows to use names with dot. Updated
|
- Template query format. New format is `{group}{host}{app}{item}`. It allows to use names with dot. Updated
|
||||||
|
|||||||
20
dist/datasource-zabbix/datasource.js
vendored
20
dist/datasource-zabbix/datasource.js
vendored
@@ -286,7 +286,7 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!target.mode || target.mode === c.MODE_METRICS) {
|
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) {
|
} else if (target.mode === c.MODE_TEXT) {
|
||||||
return _this.queryTextData(target, timeRange);
|
return _this.queryTextData(target, timeRange);
|
||||||
}
|
}
|
||||||
@@ -306,25 +306,23 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Data for panel (all targets)
|
// Data for panel (all targets)
|
||||||
return Promise.all(_.flatten(promises)).then(_.flatten).then(function (timeseries_data) {
|
return Promise.all(_.flatten(promises)).then(_.flatten).then(function (data) {
|
||||||
return downsampleSeries(timeseries_data, options);
|
|
||||||
}).then(function (data) {
|
|
||||||
return { data: data };
|
return { data: data };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
key: 'queryNumericData',
|
key: 'queryNumericData',
|
||||||
value: function queryNumericData(target, timeRange, useTrends) {
|
value: function queryNumericData(target, timeRange, useTrends, options) {
|
||||||
var _this2 = this;
|
var _this2 = this;
|
||||||
|
|
||||||
var _timeRange = _slicedToArray(timeRange, 2),
|
var _timeRange = _slicedToArray(timeRange, 2),
|
||||||
timeFrom = _timeRange[0],
|
timeFrom = _timeRange[0],
|
||||||
timeTo = _timeRange[1];
|
timeTo = _timeRange[1];
|
||||||
|
|
||||||
var options = {
|
var getItemOptions = {
|
||||||
itemtype: 'num'
|
itemtype: 'num'
|
||||||
};
|
};
|
||||||
return this.zabbix.getItemsFromTarget(target, options).then(function (items) {
|
return this.zabbix.getItemsFromTarget(target, getItemOptions).then(function (items) {
|
||||||
var getHistoryPromise = void 0;
|
var getHistoryPromise = void 0;
|
||||||
|
|
||||||
if (useTrends) {
|
if (useTrends) {
|
||||||
@@ -348,9 +346,11 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return getHistoryPromise.then(function (timeseries_data) {
|
return getHistoryPromise;
|
||||||
return _this2.applyDataProcessingFunctions(timeseries_data, target);
|
}).then(function (timeseries) {
|
||||||
});
|
return _this2.applyDataProcessingFunctions(timeseries, target);
|
||||||
|
}).then(function (timeseries) {
|
||||||
|
return downsampleSeries(timeseries, options);
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return [];
|
return [];
|
||||||
|
|||||||
2
dist/datasource-zabbix/datasource.js.map
vendored
2
dist/datasource-zabbix/datasource.js.map
vendored
File diff suppressed because one or more lines are too long
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) {
|
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) {
|
} else if (target.mode === c.MODE_TEXT) {
|
||||||
return _this.queryTextData(target, timeRange);
|
return _this.queryTextData(target, timeRange);
|
||||||
}
|
}
|
||||||
@@ -179,25 +179,23 @@ var ZabbixAPIDatasource = function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Data for panel (all targets)
|
// Data for panel (all targets)
|
||||||
return Promise.all(_lodash2.default.flatten(promises)).then(_lodash2.default.flatten).then(function (timeseries_data) {
|
return Promise.all(_lodash2.default.flatten(promises)).then(_lodash2.default.flatten).then(function (data) {
|
||||||
return downsampleSeries(timeseries_data, options);
|
|
||||||
}).then(function (data) {
|
|
||||||
return { data: data };
|
return { data: data };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
key: 'queryNumericData',
|
key: 'queryNumericData',
|
||||||
value: function queryNumericData(target, timeRange, useTrends) {
|
value: function queryNumericData(target, timeRange, useTrends, options) {
|
||||||
var _this2 = this;
|
var _this2 = this;
|
||||||
|
|
||||||
var _timeRange = _slicedToArray(timeRange, 2),
|
var _timeRange = _slicedToArray(timeRange, 2),
|
||||||
timeFrom = _timeRange[0],
|
timeFrom = _timeRange[0],
|
||||||
timeTo = _timeRange[1];
|
timeTo = _timeRange[1];
|
||||||
|
|
||||||
var options = {
|
var getItemOptions = {
|
||||||
itemtype: 'num'
|
itemtype: 'num'
|
||||||
};
|
};
|
||||||
return this.zabbix.getItemsFromTarget(target, options).then(function (items) {
|
return this.zabbix.getItemsFromTarget(target, getItemOptions).then(function (items) {
|
||||||
var getHistoryPromise = void 0;
|
var getHistoryPromise = void 0;
|
||||||
|
|
||||||
if (useTrends) {
|
if (useTrends) {
|
||||||
@@ -221,9 +219,11 @@ var ZabbixAPIDatasource = function () {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return getHistoryPromise.then(function (timeseries_data) {
|
return getHistoryPromise;
|
||||||
return _this2.applyDataProcessingFunctions(timeseries_data, target);
|
}).then(function (timeseries) {
|
||||||
});
|
return _this2.applyDataProcessingFunctions(timeseries, target);
|
||||||
|
}).then(function (timeseries) {
|
||||||
|
return downsampleSeries(timeseries, options);
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return [];
|
return [];
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ class ZabbixAPIDatasource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!target.mode || target.mode === c.MODE_METRICS) {
|
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) {
|
} else if (target.mode === c.MODE_TEXT) {
|
||||||
return this.queryTextData(target, timeRange);
|
return this.queryTextData(target, timeRange);
|
||||||
}
|
}
|
||||||
@@ -127,20 +127,17 @@ class ZabbixAPIDatasource {
|
|||||||
// Data for panel (all targets)
|
// Data for panel (all targets)
|
||||||
return Promise.all(_.flatten(promises))
|
return Promise.all(_.flatten(promises))
|
||||||
.then(_.flatten)
|
.then(_.flatten)
|
||||||
.then(timeseries_data => {
|
|
||||||
return downsampleSeries(timeseries_data, options);
|
|
||||||
})
|
|
||||||
.then(data => {
|
.then(data => {
|
||||||
return { data: data };
|
return { data: data };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
queryNumericData(target, timeRange, useTrends) {
|
queryNumericData(target, timeRange, useTrends, options) {
|
||||||
let [timeFrom, timeTo] = timeRange;
|
let [timeFrom, timeTo] = timeRange;
|
||||||
let options = {
|
let getItemOptions = {
|
||||||
itemtype: 'num'
|
itemtype: 'num'
|
||||||
};
|
};
|
||||||
return this.zabbix.getItemsFromTarget(target, options)
|
return this.zabbix.getItemsFromTarget(target, getItemOptions)
|
||||||
.then(items => {
|
.then(items => {
|
||||||
let getHistoryPromise;
|
let getHistoryPromise;
|
||||||
|
|
||||||
@@ -166,10 +163,10 @@ class ZabbixAPIDatasource {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return getHistoryPromise.then(timeseries_data => {
|
return getHistoryPromise;
|
||||||
return this.applyDataProcessingFunctions(timeseries_data, target);
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
|
.then(timeseries => this.applyDataProcessingFunctions(timeseries, target))
|
||||||
|
.then(timeseries => downsampleSeries(timeseries, options))
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
return [];
|
return [];
|
||||||
|
|||||||
Reference in New Issue
Block a user