mysql-connector: use db queries only for numeric history requests

This commit is contained in:
Alexander Zobnin
2017-07-23 09:26:08 +03:00
parent 32466302a5
commit fb145575ec
8 changed files with 14 additions and 14 deletions

View File

@@ -356,7 +356,7 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
if (useTrends) {
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);
});
} else {
@@ -376,7 +376,7 @@ System.register(['lodash', 'app/core/utils/datemath', './utils', './migrations',
} else {
// Use history
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);
});
} else {

File diff suppressed because one or more lines are too long

View File

@@ -67,8 +67,8 @@ System.register(['angular', 'lodash', './utils', './zabbixAPI.service.js', './za
if (enableDirectDBConnection) {
this.dbConnector = new ZabbixDBConnector(sqlDatasourceId);
this.getHistory = this.dbConnector.getHistory.bind(this.dbConnector);
this.getTrend = this.dbConnector.getTrends.bind(this.dbConnector);
this.getHistoryDB = this.dbConnector.getHistory.bind(this.dbConnector);
this.getTrendsDB = this.dbConnector.getTrends.bind(this.dbConnector);
}
}

File diff suppressed because one or more lines are too long

View File

@@ -216,7 +216,7 @@ var ZabbixAPIDatasource = function () {
if (useTrends) {
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);
});
} else {
@@ -236,7 +236,7 @@ var ZabbixAPIDatasource = function () {
} else {
// Use history
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);
});
} else {

View File

@@ -72,8 +72,8 @@ function ZabbixFactory(zabbixAPIService, ZabbixCachingProxy, ZabbixDBConnector)
if (enableDirectDBConnection) {
this.dbConnector = new ZabbixDBConnector(sqlDatasourceId);
this.getHistory = this.dbConnector.getHistory.bind(this.dbConnector);
this.getTrend = this.dbConnector.getTrends.bind(this.dbConnector);
this.getHistoryDB = this.dbConnector.getHistory.bind(this.dbConnector);
this.getTrendsDB = this.dbConnector.getTrends.bind(this.dbConnector);
}
}

View File

@@ -159,7 +159,7 @@ class ZabbixAPIDatasource {
if (useTrends) {
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));
} else {
let valueType = this.getTrendValueType(target);
@@ -176,7 +176,7 @@ class ZabbixAPIDatasource {
} else {
// Use history
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));
} else {
getHistoryPromise = this.zabbix.getHistory(items, timeFrom, timeTo)

View File

@@ -44,8 +44,8 @@ function ZabbixFactory(zabbixAPIService, ZabbixCachingProxy, ZabbixDBConnector)
if (enableDirectDBConnection) {
this.dbConnector = new ZabbixDBConnector(sqlDatasourceId);
this.getHistory = this.dbConnector.getHistory.bind(this.dbConnector);
this.getTrend = this.dbConnector.getTrends.bind(this.dbConnector);
this.getHistoryDB = this.dbConnector.getHistory.bind(this.dbConnector);
this.getTrendsDB = this.dbConnector.getTrends.bind(this.dbConnector);
}
}