mysql-connector: use db queries only for numeric history requests
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user