Skip to content

Commit

Permalink
feat: perf
Browse files Browse the repository at this point in the history
  • Loading branch information
shahargl committed Sep 25, 2024
1 parent d21a688 commit 0ee4975
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions keep/searchengine/searchengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,18 +169,12 @@ def search_preset_alerts(
if self.search_mode == SearchMode.INTERNAL:
# get the alerts
alerts_dto = self._get_last_alerts()
# performance optimization: get the alerts activation once
alerts_activation = self.rule_engine.get_alerts_activation(alerts_dto)
for preset in presets:
import time

p = time.time()
filtered_alerts = self.rule_engine.filter_alerts(
alerts_dto, preset.cel_query, alerts_activation
)
p2 = time.time()
self.logger.info(
f"Filtering alerts for preset {preset.id} took {p2-p} seconds"
)
preset.alerts_count = len(filtered_alerts)
# update noisy
if preset.is_noisy:
Expand Down

0 comments on commit 0ee4975

Please sign in to comment.