From a34bef186d25d3d69eea331fa7a384a514ed54ce Mon Sep 17 00:00:00 2001 From: GeorgiyGorelik <117376407+GeorgiyGorelik@users.noreply.github.com> Date: Wed, 18 Feb 2026 17:59:54 +0300 Subject: [PATCH 1/2] Add status --- loop_processing.py | 15 +++++++++++++++ post_processing.py | 5 +++++ util.py | 3 ++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/loop_processing.py b/loop_processing.py index e7ac590..e7c9838 100644 --- a/loop_processing.py +++ b/loop_processing.py @@ -227,6 +227,20 @@ logger.debug("INSIDE ACTION TYPE") logger.debug(step["name"]) all_results[metric].append(result.get(metric, 0)) + + # Check next step for status (SUCCESS/FAILED) + status = "undefined" + if index + 1 < len(json_data["steps"]): + next_step = json_data["steps"][index + 1] + if "lhr" in next_step and "gatherMode" in next_step["lhr"]: + if next_step["lhr"]["gatherMode"] == "snapshot": + next_name = next_step.get("name", "") + if next_name.endswith("_SUCCESS"): + status = "SUCCESS" + logger.info(f"Status detected: SUCCESS for {step['name']}") + elif next_name.endswith("_FAILED"): + status = "FAILED" + logger.info(f"Status detected: FAILED for {step['name']}") if 'requestedUrl' in step["lhr"]: logger.debug("STEP requestedUrl") @@ -247,6 +261,7 @@ "file_name": f"{file_name.replace('.json', '.html')}#index={index}", "resolution": "auto", "browser_version": browser_version, + "status": status, "thresholds_total": 0, "thresholds_failed": 0, "locators": [], diff --git a/post_processing.py b/post_processing.py index 8a54f48..8ea3726 100644 --- a/post_processing.py +++ b/post_processing.py @@ -160,6 +160,11 @@ summary_results = {} for each in results: + # Skip rows with FAILED status + if each.get("status") == "FAILED": + logger.info(f"Skipping FAILED row: {each.get('identifier', 'unknown')}") + continue + if each["identifier"] not in summary_results.keys(): summary_results[each["identifier"]] = {"load_time": [], "dom_processing": [], "time_to_interactive": [], "first_contentful_paint": [], "largest_contentful_paint": [], diff --git a/util.py b/util.py index 4cdf6e9..253fa3e 100644 --- a/util.py +++ b/util.py @@ -60,13 +60,14 @@ def upload_file(file_name, file_path, galloper_url, project_id, token, s3_config def update_summary_file(report_id, records, browser_version="not_set"): file_exists = os.path.exists(f"/tmp/{report_id}.csv") - header = "timestamp,name,identifier,type,loop,load_time,dom,tti,fcp,lcp,cls,tbt,fvc,lvc,inp,ttfb,file_name,browser_version\n".encode('utf-8') + header = "timestamp,name,identifier,type,loop,status,load_time,dom,tti,fcp,lcp,cls,tbt,fvc,lvc,inp,ttfb,file_name,browser_version\n".encode('utf-8') with open(f"/tmp/{report_id}.csv", 'ab+') as f: if not file_exists: f.write(header) for each in records: f.write( f"{each['metrics']['timestamps']},{each['name']},{each['identifier']},{each['type']},{each['loop']}," + f"{each.get('status', 'undefined')}," f"{each['metrics']['load_time']},{each['metrics']['dom_processing']}," f"{each['metrics']['time_to_interactive']},{each['metrics']['first_contentful_paint']}," f"{each['metrics']['largest_contentful_paint']}," From 70aefed589bfe159882df63860b06e30ed11b4c1 Mon Sep 17 00:00:00 2001 From: GeorgiyGorelik <117376407+GeorgiyGorelik@users.noreply.github.com> Date: Fri, 20 Feb 2026 15:03:29 +0300 Subject: [PATCH 2/2] Add upper case for status check --- loop_processing.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/loop_processing.py b/loop_processing.py index e7c9838..d119f0c 100644 --- a/loop_processing.py +++ b/loop_processing.py @@ -235,10 +235,11 @@ if "lhr" in next_step and "gatherMode" in next_step["lhr"]: if next_step["lhr"]["gatherMode"] == "snapshot": next_name = next_step.get("name", "") - if next_name.endswith("_SUCCESS"): + next_name_upper = next_name.upper() + if next_name_upper.endswith("_SUCCESS"): status = "SUCCESS" logger.info(f"Status detected: SUCCESS for {step['name']}") - elif next_name.endswith("_FAILED"): + elif next_name_upper.endswith("_FAILED"): status = "FAILED" logger.info(f"Status detected: FAILED for {step['name']}")