Skip to content

Commit

Permalink
fix: event as list[AlertDTO] not included in the condition (#2966)
Browse files Browse the repository at this point in the history
Co-authored-by: Tal <[email protected]>
  • Loading branch information
00041275 and talboren authored Jan 3, 2025
1 parent 3db4fed commit 0b5e146
Showing 1 changed file with 20 additions and 6 deletions.
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

0 comments on commit 0b5e146

Please sign in to comment.