mysql-connector: use db queries only for numeric history requests
This commit is contained in:
4
dist/datasource-zabbix/datasource.js
vendored
4
dist/datasource-zabbix/datasource.js
vendored
@@ -356,7 +356,7 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
|
|||||||
|
|
||||||
if (useTrends) {
|
if (useTrends) {
|
||||||
if (_this2.enableDirectDBConnection) {
|
if (_this2.enableDirectDBConnection) {
|
||||||
getHistoryPromise = _this2.zabbix.getTrend(items, timeFrom, timeTo, options).then(function (history) {
|
getHistoryPromise = _this2.zabbix.getTrendsDB(items, timeFrom, timeTo, options).then(function (history) {
|
||||||
return _this2.zabbix.dbConnector.handleGrafanaTSResponse(history, items);
|
return _this2.zabbix.dbConnector.handleGrafanaTSResponse(history, items);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -376,7 +376,7 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
|
|||||||
} else {
|
} else {
|
||||||
// Use history
|
// Use history
|
||||||
if (_this2.enableDirectDBConnection) {
|
if (_this2.enableDirectDBConnection) {
|
||||||
getHistoryPromise = _this2.zabbix.getHistory(items, timeFrom, timeTo, options).then(function (history) {
|
getHistoryPromise = _this2.zabbix.getHistoryDB(items, timeFrom, timeTo, options).then(function (history) {
|
||||||
return _this2.zabbix.dbConnector.handleGrafanaTSResponse(history, items);
|
return _this2.zabbix.dbConnector.handleGrafanaTSResponse(history, items);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
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
4
dist/datasource-zabbix/zabbix.js
vendored
4
dist/datasource-zabbix/zabbix.js
vendored
@@ -67,8 +67,8 @@ System.register(['angular', 'lodash', './utils', './zabbixAPI.service.js', './za
|
|||||||
|
|
||||||
if (enableDirectDBConnection) {
|
if (enableDirectDBConnection) {
|
||||||
this.dbConnector = new ZabbixDBConnector(sqlDatasourceId);
|
this.dbConnector = new ZabbixDBConnector(sqlDatasourceId);
|
||||||
this.getHistory = this.dbConnector.getHistory.bind(this.dbConnector);
|
this.getHistoryDB = this.dbConnector.getHistory.bind(this.dbConnector);
|
||||||
this.getTrend = this.dbConnector.getTrends.bind(this.dbConnector);
|
this.getTrendsDB = this.dbConnector.getTrends.bind(this.dbConnector);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
dist/datasource-zabbix/zabbix.js.map
vendored
2
dist/datasource-zabbix/zabbix.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/test/datasource-zabbix/datasource.js
vendored
4
dist/test/datasource-zabbix/datasource.js
vendored
@@ -216,7 +216,7 @@ var ZabbixAPIDatasource = function () {
|
|||||||
|
|
||||||
if (useTrends) {
|
if (useTrends) {
|
||||||
if (_this2.enableDirectDBConnection) {
|
if (_this2.enableDirectDBConnection) {
|
||||||
getHistoryPromise = _this2.zabbix.getTrend(items, timeFrom, timeTo, options).then(function (history) {
|
getHistoryPromise = _this2.zabbix.getTrendsDB(items, timeFrom, timeTo, options).then(function (history) {
|
||||||
return _this2.zabbix.dbConnector.handleGrafanaTSResponse(history, items);
|
return _this2.zabbix.dbConnector.handleGrafanaTSResponse(history, items);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -236,7 +236,7 @@ var ZabbixAPIDatasource = function () {
|
|||||||
} else {
|
} else {
|
||||||
// Use history
|
// Use history
|
||||||
if (_this2.enableDirectDBConnection) {
|
if (_this2.enableDirectDBConnection) {
|
||||||
getHistoryPromise = _this2.zabbix.getHistory(items, timeFrom, timeTo, options).then(function (history) {
|
getHistoryPromise = _this2.zabbix.getHistoryDB(items, timeFrom, timeTo, options).then(function (history) {
|
||||||
return _this2.zabbix.dbConnector.handleGrafanaTSResponse(history, items);
|
return _this2.zabbix.dbConnector.handleGrafanaTSResponse(history, items);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
4
dist/test/datasource-zabbix/zabbix.js
vendored
4
dist/test/datasource-zabbix/zabbix.js
vendored
@@ -72,8 +72,8 @@ function ZabbixFactory(zabbixAPIService, ZabbixCachingProxy, ZabbixDBConnector)
|
|||||||
|
|
||||||
if (enableDirectDBConnection) {
|
if (enableDirectDBConnection) {
|
||||||
this.dbConnector = new ZabbixDBConnector(sqlDatasourceId);
|
this.dbConnector = new ZabbixDBConnector(sqlDatasourceId);
|
||||||
this.getHistory = this.dbConnector.getHistory.bind(this.dbConnector);
|
this.getHistoryDB = this.dbConnector.getHistory.bind(this.dbConnector);
|
||||||
this.getTrend = this.dbConnector.getTrends.bind(this.dbConnector);
|
this.getTrendsDB = this.dbConnector.getTrends.bind(this.dbConnector);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ class ZabbixAPIDatasource {
|
|||||||
|
|
||||||
if (useTrends) {
|
if (useTrends) {
|
||||||
if (this.enableDirectDBConnection) {
|
if (this.enableDirectDBConnection) {
|
||||||
getHistoryPromise = this.zabbix.getTrend(items, timeFrom, timeTo, options)
|
getHistoryPromise = this.zabbix.getTrendsDB(items, timeFrom, timeTo, options)
|
||||||
.then(history => this.zabbix.dbConnector.handleGrafanaTSResponse(history, items));
|
.then(history => this.zabbix.dbConnector.handleGrafanaTSResponse(history, items));
|
||||||
} else {
|
} else {
|
||||||
let valueType = this.getTrendValueType(target);
|
let valueType = this.getTrendValueType(target);
|
||||||
@@ -176,7 +176,7 @@ class ZabbixAPIDatasource {
|
|||||||
} else {
|
} else {
|
||||||
// Use history
|
// Use history
|
||||||
if (this.enableDirectDBConnection) {
|
if (this.enableDirectDBConnection) {
|
||||||
getHistoryPromise = this.zabbix.getHistory(items, timeFrom, timeTo, options)
|
getHistoryPromise = this.zabbix.getHistoryDB(items, timeFrom, timeTo, options)
|
||||||
.then(history => this.zabbix.dbConnector.handleGrafanaTSResponse(history, items));
|
.then(history => this.zabbix.dbConnector.handleGrafanaTSResponse(history, items));
|
||||||
} else {
|
} else {
|
||||||
getHistoryPromise = this.zabbix.getHistory(items, timeFrom, timeTo)
|
getHistoryPromise = this.zabbix.getHistory(items, timeFrom, timeTo)
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ function ZabbixFactory(zabbixAPIService, ZabbixCachingProxy, ZabbixDBConnector)
|
|||||||
|
|
||||||
if (enableDirectDBConnection) {
|
if (enableDirectDBConnection) {
|
||||||
this.dbConnector = new ZabbixDBConnector(sqlDatasourceId);
|
this.dbConnector = new ZabbixDBConnector(sqlDatasourceId);
|
||||||
this.getHistory = this.dbConnector.getHistory.bind(this.dbConnector);
|
this.getHistoryDB = this.dbConnector.getHistory.bind(this.dbConnector);
|
||||||
this.getTrend = this.dbConnector.getTrends.bind(this.dbConnector);
|
this.getTrendsDB = this.dbConnector.getTrends.bind(this.dbConnector);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user