-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ele 3682 alerts grouping #1716
Merged
Merged
Ele 3682 alerts grouping #1716
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
bd60db1
GroupedAlerts base class
MikaKerman be005e6
splitted the grouped alert types into multiple modules
MikaKerman a3fac51
created all in one grouped alert type
MikaKerman ac97fe6
added group_all_alerts_threshold config key
MikaKerman 1566dc0
moved data and unified_meta properties to the base grouped alert class
MikaKerman b8efe33
added abstract method for all-in-one alert template
MikaKerman cc5c8f1
Slack integration - added all in one alert template
MikaKerman de78be6
Teams integration - added all in one alert template
MikaKerman fd24e51
added a compact version of the all-in-one-alert, to avoid the slack m…
MikaKerman 818886b
using send_alerts method instead of send_alert
MikaKerman 0b012c2
supporting unified alert only in slack integration
MikaKerman 23f824a
moved the compact schema to class attribute
MikaKerman eaf4c4a
changed send_alerts to return a generator
MikaKerman 3b87737
refactored al-in-one alert templates
MikaKerman c3c2b5d
grouping alerts in the base integration
MikaKerman 020c2c0
changed config group alerts config key name
MikaKerman 164ac89
passing the threshold
MikaKerman d26d814
slack - reduced number of block to avoid the slack limit
MikaKerman 3071e16
teams - change \n to <br>
MikaKerman 6ec78e7
using GroupedAlert directly
MikaKerman d0e235d
Refactor grouped alerts to alerts groups
MikaKerman a624839
Move grouping_type module
MikaKerman a074335
Add const for default group alerts threshold
MikaKerman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from .alerts_group import AlertsGroup | ||
from .grouped_by_table import GroupedByTableAlerts | ||
|
||
__all__ = [ | ||
"AlertsGroup", | ||
"GroupedByTableAlerts", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
elementary/monitor/alerts/alerts_groups/grouped_by_table.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from typing import Optional | ||
|
||
from elementary.monitor.alerts.alerts_groups.alerts_group import AlertsGroup | ||
from elementary.monitor.data_monitoring.alerts.integrations.utils.report_link import ( | ||
ReportLinkData, | ||
get_model_test_runs_link, | ||
) | ||
from elementary.utils.models import get_shortened_model_name | ||
|
||
|
||
class GroupedByTableAlerts(AlertsGroup): | ||
@property | ||
def model_unique_id(self) -> Optional[str]: | ||
return self.alerts[0].model_unique_id | ||
|
||
@property | ||
def model(self) -> str: | ||
return get_shortened_model_name(self.model_unique_id) | ||
|
||
@property | ||
def report_url(self) -> Optional[str]: | ||
return self.alerts[0].report_url | ||
|
||
@property | ||
def summary(self) -> str: | ||
return f"{self.model}: {len(self.alerts)} issues detected" | ||
|
||
def get_report_link(self) -> Optional[ReportLinkData]: | ||
if not self.model_errors: | ||
return get_model_test_runs_link(self.report_url, self.model_unique_id) | ||
|
||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from enum import Enum | ||
|
||
|
||
class GroupingType(str, Enum): | ||
BY_ALERT = "alert" | ||
BY_TABLE = "table" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the alert is an AlertsGroup, the inner alerts will be generated. This changes the behavior of GroupedByTableAlerts, but I checked that the method's caller can handle it as well.
elementary/elementary/monitor/data_monitoring/alerts/data_monitoring_alerts.py
Line 259 in 161330d