From 9e7f751df68cc3d775ca089d1f5c2c6e84937d01 Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Thu, 13 Mar 2025 13:58:05 +0100 Subject: [PATCH] fix(chalice): fixed EE error-details undefined status --- .../core/errors/errors_details_exp.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ee/api/chalicelib/core/errors/errors_details_exp.py b/ee/api/chalicelib/core/errors/errors_details_exp.py index 7f7d5feb2..bbf69f15f 100644 --- a/ee/api/chalicelib/core/errors/errors_details_exp.py +++ b/ee/api/chalicelib/core/errors/errors_details_exp.py @@ -1,9 +1,13 @@ +import logging + from chalicelib.core.errors.modules import errors_helper from chalicelib.utils import ch_client, exp_ch_helper from chalicelib.utils import helper from chalicelib.utils.TimeUTC import TimeUTC from chalicelib.utils.metrics_helper import get_step_size +logger = logging.getLogger(__name__) + def __transform_map_to_tag(data, key1, key2, requested_key): result = [] @@ -200,9 +204,9 @@ def get_details(project_id, error_id, user_id, **data): ORDER BY timestamp) AS chart_details ) AS chart_details30 ON TRUE;""" - # print("--------------------") - # print(ch.format(main_ch_query, params)) - # print("--------------------") + logger.debug("--------------------") + logging.debug(ch.format(query=main_ch_query, parameters=params)) + logger.debug("--------------------") row = ch.execute(query=main_ch_query, parameters=params) if len(row) == 0: return {"errors": ["error not found"]} @@ -219,12 +223,12 @@ def get_details(project_id, error_id, user_id, **data): ORDER BY datetime DESC LIMIT 1;""" params = {"project_id": project_id, "session_id": row["last_session_id"], "userId": user_id} - # print("--------------------") - # print(ch.format(query, params)) - # print("--------------------") + logger.debug("--------------------") + logging.debug(ch.format(query=query, parameters=params)) + logger.debug("--------------------") status = ch.execute(query=query, parameters=params) - if status is not None: + if status is not None and len(status) > 0: status = status[0] row["favorite"] = status.pop("favorite") row["viewed"] = status.pop("viewed")