From 159794ce72254a551327cfa68a5723c77816faab Mon Sep 17 00:00:00 2001 From: Taha Yassine Kraiem Date: Fri, 25 Nov 2022 17:26:41 +0100 Subject: [PATCH] feat(chalice): changed funnel limits --- api/chalicelib/core/significance.py | 9 ++++++--- ee/api/chalicelib/core/significance.py | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/api/chalicelib/core/significance.py b/api/chalicelib/core/significance.py index 52a22aee8..c3ac7077f 100644 --- a/api/chalicelib/core/significance.py +++ b/api/chalicelib/core/significance.py @@ -191,7 +191,7 @@ def get_stages_and_events(filter_d, project_id) -> List[RealDictRow]: GROUP BY main.session_id) AS T{i + 1} {"ON (TRUE)" if i > 0 else ""} """) - n_stages=len(n_stages_query) + n_stages = len(n_stages_query) if n_stages == 0: return [] n_stages_query = " LEFT JOIN LATERAL ".join(n_stages_query) @@ -215,7 +215,7 @@ def get_stages_and_events(filter_d, project_id) -> List[RealDictRow]: AND ISE.session_id = stages_t.session_id AND ISS.type!='custom' -- ignore custom issues because they are massive {"AND ISS.type IN %(issueTypes)s" if len(filter_issues) > 0 else ""} - LIMIT 50 -- remove the limit to get exact stats + LIMIT 10 -- remove the limit to get exact stats ) AS issues_t ON (TRUE) ) AS stages_and_issues_t INNER JOIN sessions USING(session_id); """ @@ -348,7 +348,7 @@ def get_transitions_and_issues_of_each_type(rows: List[RealDictRow], all_issues, if error_id not in errors: errors[error_id] = [] ic = 0 - row_issue_id=row['issue_id'] + row_issue_id = row['issue_id'] if row_issue_id is not None: if last_ts is None or (first_ts < row['issue_timestamp'] < last_ts): if error_id == row_issue_id: @@ -533,6 +533,9 @@ def get_issues(stages, rows, first_stage=None, last_stage=None, drop_only=False) if is_sign: n_critical_issues += n_issues_dict[issue_id] + # To limit the number of returned issues to the frontend + issues_dict["significant"] = issues_dict["significant"][:50] + issues_dict["insignificant"] = issues_dict["insignificant"][:50] return n_critical_issues, issues_dict, total_drop_due_to_issues diff --git a/ee/api/chalicelib/core/significance.py b/ee/api/chalicelib/core/significance.py index d2ad650b4..b46adb589 100644 --- a/ee/api/chalicelib/core/significance.py +++ b/ee/api/chalicelib/core/significance.py @@ -198,7 +198,7 @@ def get_stages_and_events(filter_d, project_id) -> List[RealDictRow]: GROUP BY main.session_id) AS T{i + 1} {"ON (TRUE)" if i > 0 else ""} """) - n_stages=len(n_stages_query) + n_stages = len(n_stages_query) if n_stages == 0: return [] n_stages_query = " LEFT JOIN LATERAL ".join(n_stages_query) @@ -222,7 +222,7 @@ def get_stages_and_events(filter_d, project_id) -> List[RealDictRow]: AND ISE.session_id = stages_t.session_id AND ISS.type!='custom' -- ignore custom issues because they are massive {"AND ISS.type IN %(issueTypes)s" if len(filter_issues) > 0 else ""} - LIMIT 50 -- remove the limit to get exact stats + LIMIT 10 -- remove the limit to get exact stats ) AS issues_t ON (TRUE) ) AS stages_and_issues_t INNER JOIN sessions USING(session_id); """ @@ -355,7 +355,7 @@ def get_transitions_and_issues_of_each_type(rows: List[RealDictRow], all_issues, if error_id not in errors: errors[error_id] = [] ic = 0 - row_issue_id=row['issue_id'] + row_issue_id = row['issue_id'] if row_issue_id is not None: if last_ts is None or (first_ts < row['issue_timestamp'] < last_ts): if error_id == row_issue_id: @@ -540,6 +540,9 @@ def get_issues(stages, rows, first_stage=None, last_stage=None, drop_only=False) if is_sign: n_critical_issues += n_issues_dict[issue_id] + # To limit the number of returned issues to the frontend + issues_dict["significant"] = issues_dict["significant"][:50] + issues_dict["insignificant"] = issues_dict["insignificant"][:50] return n_critical_issues, issues_dict, total_drop_due_to_issues