From 31e8444683ed39b186ecc2518bbea67be7240701 Mon Sep 17 00:00:00 2001 From: Tal Borenstein Date: Thu, 28 Nov 2024 12:35:28 +0200 Subject: [PATCH] fix: log str process events --- keep/api/tasks/process_event_task.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/keep/api/tasks/process_event_task.py b/keep/api/tasks/process_event_task.py index 9404083c2..e07017950 100644 --- a/keep/api/tasks/process_event_task.py +++ b/keep/api/tasks/process_event_task.py @@ -529,6 +529,7 @@ def process_event( ), # Let's log the events if we store it for debugging } logger.info("Processing event", extra=extra_dict) + raw_event = copy.deepcopy(event) try: session = get_session_sync() @@ -568,6 +569,14 @@ def process_event( ) return + if isinstance(event, str): + extra_dict["raw_event"] = event + logger.error( + "Event is a string (malformed json?), skipping processing", + extra=extra_dict, + ) + return None + # In case when provider_type is not set if isinstance(event, dict): event = [AlertDto(**event)]