Skip to content

Commit

Permalink
feat: add supervisor id to DAQJobAlertSlack
Browse files Browse the repository at this point in the history
  • Loading branch information
furkan-bilgin committed Nov 15, 2024
1 parent 7fe318b commit e6d31b1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/daq/alert/alert_slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ def send_webhook(self, alert: DAQJobMessageAlert):
"author_name": alert.daq_job_info.daq_job_class_name,
"title": "Alert!",
"fields": [
{
"title": "Supervisor ID",
"value": alert.daq_job_info.supervisor_config.supervisor_id
if alert.daq_job_info.supervisor_config
else "-",
"short": True,
},
{
"title": "Severity",
"value": alert.alert_info.severity,
Expand Down
6 changes: 6 additions & 0 deletions src/tests/test_slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def test_send_alert(self):
date=datetime(2023, 10, 1, 12, 0, 0),
)
self.daq_job.send_webhook(alert)
assert alert.daq_job_info is not None
self.mock_slack.post.assert_called_once_with(
attachments=[
{
Expand All @@ -39,6 +40,11 @@ def test_send_alert(self):
"author_name": alert.daq_job_info.daq_job_class_name,
"title": "Alert!",
"fields": [
{
"title": "Supervisor ID",
"value": "mock",
"short": True,
},
{
"title": "Severity",
"value": DAQAlertSeverity.ERROR,
Expand Down

0 comments on commit e6d31b1

Please sign in to comment.