Skip to content
This repository was archived by the owner on Sep 12, 2024. It is now read-only.

Alerts revamp #974

Merged
merged 38 commits into from
Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
0f0404c
added disclaimer for consolidated alerts reports
May 30, 2022
3ef7b25
Merge pull request #971 from chaos-genius/feature/alerts-revamp-FE
ChartistDev May 30, 2022
85dbcaa
feat(alerts): no subdims, better reports query, split TriggeredAlerts
Samyak2 May 30, 2022
7b5ba38
chore(alert-digest): add log stmt for time range
Samyak2 May 31, 2022
a3a247b
fix(alerts): use days offset when running for first time
Samyak2 May 31, 2022
13a24d4
fix(alerts): split anomalies by date earlier in check_and_send_alert
Samyak2 May 31, 2022
b943069
fix(alerts): change previous_point calculation logic
Samyak2 Jun 1, 2022
843006f
feat(alerts): store previous point in TriggeredAlerts data
Samyak2 Jun 1, 2022
4dcb3da
feat(alerts): change dashboard columns and remove subdims button
Samyak2 Jun 1, 2022
52a6712
feat(alert): add date filter in alerts dashboard, minor refactor
Samyak2 Jun 1, 2022
e0b1bd6
feat(alerts): implement dashboard date filter in frontend
Samyak2 Jun 1, 2022
d830402
fix(alerts): only send alert for latest day
Samyak2 Jun 1, 2022
0a9ce87
fix(alerts): allow overrding last_anomaly_timestamp for testing
Samyak2 Jun 1, 2022
648af34
fix(alerts): previous point calculation was wrong
Samyak2 Jun 1, 2022
9bd4e63
feat(alert): simplify+modify email alert format
Samyak2 Jun 1, 2022
983807e
fix(alerts): enable subdims selectively
Samyak2 Jun 2, 2022
8b25343
fix(alerts): show subdims button in alerts dashboard
Samyak2 Jun 2, 2022
5e3fada
fix(alerts): use "-" in dashboard when previous_value is not available
Samyak2 Jun 2, 2022
6ccc798
feat(alert): simply+modify alert report email format
Samyak2 Jun 2, 2022
9aed68d
refactor(alerts): modularize email formats and make indiv consistent
Samyak2 Jun 3, 2022
92462da
feat(alert): simplify+modify slack daily digest format
Amatullah Jun 3, 2022
cd1200f
Merge branch 'feature/alerts-revamp' of github.com:chaos-genius/chaos…
Amatullah Jun 3, 2022
00da6c9
fix(alerts): use correct date in subject for individual email
Samyak2 Jun 3, 2022
6aebdfd
fix(alerts): percent change formatting for +/-inf
Samyak2 Jun 3, 2022
10b6765
fix(alerts): change email anomaly format according to feedback
Samyak2 Jun 3, 2022
aae5cc9
fix(alerts): make KPI name and date bold instead of titles
Samyak2 Jun 3, 2022
6001d04
fix(alerts): update slack format
Amatullah Jun 3, 2022
a6cbf0e
fix(alerts): slack individual
Amatullah Jun 6, 2022
b09cd39
fix(alerts): yesterday -> previous day, omit extra "from"
Samyak2 Jun 4, 2022
2eea472
feat(alerts): updated email individual format to be leaner
Samyak2 Jun 6, 2022
0c7880a
fix(alerts): bug in previous point time format
Samyak2 Jun 6, 2022
8ccc2da
fix: slack (yesterday -> previous day)
Amatullah Jun 6, 2022
674de98
fix: format slack logic
Amatullah Jun 6, 2022
0daf6af
fix(alerts): update email anomaly format from feedback
Samyak2 Jun 6, 2022
17d0d33
style(alerts): fix formatting and rename some vars
Samyak2 Jun 6, 2022
e76ebc2
fix: optimize function
Amatullah Jun 6, 2022
0193b22
refactor(alerts): only query 11PM data for hourly KPIs
Samyak2 Jun 6, 2022
4fb3064
refactor(alerts): always consider days offset during first time run
Samyak2 Jun 6, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions chaos_genius/alerts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
VS Code extension (or the Pyright equivalent in other editors) along with flake8 when
developing.
"""
import datetime
import logging
from typing import List, Optional, Tuple

Expand All @@ -17,7 +18,9 @@
logger = logging.getLogger()


def check_and_trigger_alert(alert_id: int):
def check_and_trigger_alert(
alert_id: int, last_anomaly_timestamp: Optional[datetime.datetime] = None
):
"""Check the alert and trigger the notification if found.

Args:
Expand Down Expand Up @@ -50,7 +53,7 @@ def check_and_trigger_alert(alert_id: int):
elif (
alert_info.alert_type == "KPI Alert" and alert_info.kpi_alert_type == "Anomaly"
):
anomaly_obj = AnomalyAlertController(alert_info)
anomaly_obj = AnomalyAlertController(alert_info, last_anomaly_timestamp)
return anomaly_obj.check_and_send_alert()
elif alert_info.alert_type == "KPI Alert" and alert_info.kpi_alert_type == "Static":
# TODO: is this still needed?
Expand Down
Loading