Skip to content
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

fix: event as list[AlertDTO] not included in the condition #2966

Merged
merged 2 commits into from
Jan 3, 2025
Merged
Changes from all commits
Commits
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
26 changes: 20 additions & 6 deletions keep/api/tasks/process_event_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,12 +597,26 @@ def process_event(
except Exception:
provider_class = ProvidersFactory.get_provider_class("keep")

event = provider_class.format_alert(
tenant_id=tenant_id,
event=event,
provider_id=provider_id,
provider_type=provider_type,
)
if isinstance(event, list):
event_list = []
for event_item in event:
if not isinstance(event_item, AlertDto):
event_list.append(provider_class.format_alert(
tenant_id=tenant_id,
event=event_item,
provider_id=provider_id,
provider_type=provider_type,
))
else:
event_list.append(event_item)
event = event_list
else:
event = provider_class.format_alert(
tenant_id=tenant_id,
event=event,
provider_id=provider_id,
provider_type=provider_type,
)
# SHAHAR: for aws cloudwatch, we get a subscription notification message that we should skip
# todo: move it to be generic
if event is None and provider_type == "cloudwatch":
Expand Down
Loading