Add metrics limit per panel.
This commit is contained in:
@@ -19,6 +19,9 @@ function (angular, _, kbn) {
|
||||
this.username = datasource.meta.username;
|
||||
this.password = datasource.meta.password;
|
||||
|
||||
// Limit metrics per panel
|
||||
this.limitmetrics = datasource.meta.limitmetrics || 20;
|
||||
|
||||
// For testing
|
||||
this.ds = datasource;
|
||||
}
|
||||
@@ -55,6 +58,7 @@ function (angular, _, kbn) {
|
||||
var key_pattern = /([\w\.]+(?:\[[^\[]*\])|[\w\.]+)/g;
|
||||
var keys = item_key.match(key_pattern);
|
||||
|
||||
if (keys.length < this.limitmetrics) {
|
||||
// Find items by keys and perform queries
|
||||
var self = this;
|
||||
return $q.all(_.map(hosts, function (hostname) {
|
||||
@@ -66,6 +70,9 @@ function (angular, _, kbn) {
|
||||
return self.performTimeSeriesQuery(items, from, to)
|
||||
.then(_.partial(self.handleZabbixAPIResponse, items));
|
||||
});
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
|
||||
@@ -108,7 +115,7 @@ function (angular, _, kbn) {
|
||||
};
|
||||
|
||||
|
||||
// Request data from Zabbix API
|
||||
// Convert Zabbix API data to Grafana format
|
||||
ZabbixAPIDatasource.prototype.handleZabbixAPIResponse = function(items, response) {
|
||||
/**
|
||||
* Response should be in the format:
|
||||
|
||||
Reference in New Issue
Block a user