From f70777f53d997885400209c0ac909988badf0835 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Mon, 2 Oct 2023 22:24:33 +0100 Subject: [PATCH] chore: capture more to sentry (#17723) * chore: capture more to sentry when image export fails * and the url --- posthog/tasks/exports/image_exporter.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/posthog/tasks/exports/image_exporter.py b/posthog/tasks/exports/image_exporter.py index bad4bea95658a..4efe88907adc3 100644 --- a/posthog/tasks/exports/image_exporter.py +++ b/posthog/tasks/exports/image_exporter.py @@ -141,10 +141,11 @@ def _screenshot_asset( driver.set_window_size(screenshot_width, height) driver.save_screenshot(image_path) except Exception as e: - if driver: - # To help with debugging, add a screenshot and any chrome logs - with configure_scope() as scope: - # If we encounter issues getting extra info we should silenty fail rather than creating a new exception + # To help with debugging, add a screenshot and any chrome logs + with configure_scope() as scope: + scope.set_extra("url_to_render", url_to_render) + if driver: + # If we encounter issues getting extra info we should silently fail rather than creating a new exception try: all_logs = [x for x in driver.get_log("browser")] scope.add_attachment(json.dumps(all_logs).encode("utf-8"), "logs.txt") @@ -155,7 +156,7 @@ def _screenshot_asset( scope.add_attachment(None, None, image_path) except Exception: pass - capture_exception(e) + capture_exception(e) raise e finally: