Module: check_mk
Branch: master
Commit: 78b732305460c31fb21c972f8d41da20199da4cd
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=78b732305460c3…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Jun 15 14:39:19 2016 +0200
3546 Drastically sped up response time on querying single aggregations
Querying a single aggregation (e.g. through <i>Filter: Aggregation name (exact
match)</i>) took
considerably longer than it should. The query time was proportional to the number of
available aggregations. This has been fixed.
The main beneficiary of this fix is the active check "Check State of BI
Aggregation".
---
.werks/3546 | 13 +++++++++++++
ChangeLog | 1 +
web/htdocs/bi.py | 9 ++++++++-
3 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/.werks/3546 b/.werks/3546
new file mode 100644
index 0000000..a4e202b
--- /dev/null
+++ b/.werks/3546
@@ -0,0 +1,13 @@
+Title: Drastically sped up response time on querying single aggregations
+Level: 1
+Component: bi
+Compatible: compat
+Version: 1.4.0i1
+Date: 1465993843
+Class: feature
+
+Querying a single aggregation (e.g. through <i>Filter: Aggregation name (exact
match)</i>) took
+considerably longer than it should. The query time was proportional to the number of
+available aggregations. This has been fixed.
+
+The main beneficiary of this fix is the active check "Check State of BI
Aggregation".
diff --git a/ChangeLog b/ChangeLog
index dde3338..b2b92fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -455,6 +455,7 @@
* 3271 New option in aggregation for tuning aggregation of downtimes...
* 3396 Change default setting of Precompile aggregations on demand to ON now...
* 3449 The host alias can now be used in BI aggregates...
+ * 3546 Drastically sped up response time on querying single aggregations...
* 3247 FIX: Do not allow multiple BI aggregates with the same title...
* 3232 FIX: BI: Only querying site of host for specific host status info...
* 3291 FIX: Improved error handling when searching for BI aggregations with invalid
regex
diff --git a/web/htdocs/bi.py b/web/htdocs/bi.py
index 9bcb290..0f85da5 100644
--- a/web/htdocs/bi.py
+++ b/web/htdocs/bi.py
@@ -1872,6 +1872,7 @@ def table(columns, add_headers, only_sites, limit, filters):
# later out again.
only_group = None
only_service = None
+ only_aggr_name = None
for filter in filters:
if filter.name == "aggr_group":
@@ -1880,6 +1881,10 @@ def table(columns, add_headers, only_sites, limit, filters):
only_group = val
elif filter.name == "aggr_service":
only_service = filter.service_spec()
+ elif filter.name == "aggr_name":
+ only_aggr_name = filter.value().get("aggr_name")
+ # TODO: can be further improved by filtering aggr_name_regex
+ # See BITextFilter(Filter): filter_table(self, rows)
if config.bi_precompile_on_demand and only_group:
# optimized mode: if aggregation group known only precompile this one
@@ -1901,7 +1906,6 @@ def table(columns, add_headers, only_sites, limit, filters):
entries.append(aggr)
by_groups[group] = entries
items = by_groups.items()
-
else:
items = g_user_cache["forest"].items()
@@ -1910,6 +1914,9 @@ def table(columns, add_headers, only_sites, limit, filters):
continue
for tree in trees:
+ if only_aggr_name and only_aggr_name != tree.get("title"):
+ continue
+
row = create_aggregation_row(tree)
row["aggr_group"] = group
rows.append(row)