From 82bd4f9dada58e04e68d683b2d362deaeeb0bec2 Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Fri, 3 May 2024 17:52:56 +0200 Subject: [PATCH] fix(chalice): fixed table of error with platform filter for EE-PG --- ee/api/chalicelib/core/errors.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ee/api/chalicelib/core/errors.py b/ee/api/chalicelib/core/errors.py index affe053ca..ec4962345 100644 --- a/ee/api/chalicelib/core/errors.py +++ b/ee/api/chalicelib/core/errors.py @@ -458,7 +458,8 @@ def search(data: schemas.SearchErrorsSchema, project_id, user_id): # To ignore Script error pg_sub_query.append("pe.message!='Script error.'") pg_sub_query_chart = __get_basic_constraints(platform, time_constraint=False, chart=True, project_key=None) - # pg_sub_query_chart.append("source ='js_exception'") + if platform: + pg_sub_query_chart += ["start_ts>=%(startDate)s", "start_ts<%(endDate)s", "project_id=%(project_id)s"] pg_sub_query_chart.append("errors.error_id =details.error_id") statuses = [] error_ids = None @@ -545,7 +546,8 @@ def search(data: schemas.SearchErrorsSchema, project_id, user_id): COUNT(session_id) AS count FROM generate_series(%(startDate)s, %(endDate)s, %(step_size)s) AS generated_timestamp LEFT JOIN LATERAL (SELECT DISTINCT session_id - FROM events.errors + FROM events.errors + {"INNER JOIN public.sessions USING(session_id)" if platform else ""} WHERE {" AND ".join(pg_sub_query_chart)} ) AS sessions ON (TRUE) GROUP BY timestamp