From 8a4463152969d4e5f49ceb6cc488d73811304f58 Mon Sep 17 00:00:00 2001 From: firestarsdog <229254897+firestarsdog@users.noreply.github.com> Date: Sat, 31 Jan 2026 12:31:30 -0500 Subject: [PATCH] Squish Bump --- frogpilot/system/frogpilot_stats.py | 10 +++---- system/sentry.py | 42 ++++++++++++++++------------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/frogpilot/system/frogpilot_stats.py b/frogpilot/system/frogpilot_stats.py index ec6c3db9f..a63470fbb 100644 --- a/frogpilot/system/frogpilot_stats.py +++ b/frogpilot/system/frogpilot_stats.py @@ -150,11 +150,9 @@ def send_stats(): if frogpilot_toggles.car_make == "mock": return - bucket = os.environ.get("STATS_BUCKET", "") - org_ID = os.environ.get("STATS_ORG_ID", "") - token = os.environ.get("STATS_TOKEN", "") - url = os.environ.get("STATS_URL", "") - + bucket = "StarPilot" + org_ID = "StarPilot" + url = "https://stats.firestar.link" frogpilot_stats = json.loads(params.get("FrogPilotStats") or "{}") location = json.loads(params.get("LastGPSPosition") or "{}") @@ -223,7 +221,7 @@ def send_stats(): all_points = [user_point] + update_branch_commits(now) - client = InfluxDBClient(org=org_ID, token=token, url=url) + client = InfluxDBClient(org=org_ID, token=org_ID, url=url) client.write_api(write_options=SYNCHRONOUS).write(bucket=bucket, org=org_ID, record=all_points) print("Successfully sent FrogPilot stats!") except Exception as exception: diff --git a/system/sentry.py b/system/sentry.py index ae7b37a00..62240d0da 100644 --- a/system/sentry.py +++ b/system/sentry.py @@ -1,5 +1,6 @@ -"""Install exception handler for process crash.""" +import glob import os +import re import sentry_sdk import traceback from datetime import datetime @@ -9,15 +10,16 @@ from sentry_sdk.integrations.threading import ThreadingIntegration from openpilot.common.params import Params from openpilot.system.hardware import HARDWARE, PC from openpilot.common.swaglog import cloudlog +from openpilot.system.hardware.hw import Paths from openpilot.system.version import get_build_metadata, get_version from openpilot.frogpilot.common.frogpilot_variables import ERROR_LOGS_PATH, params class SentryProject(Enum): # python project - SELFDRIVE = os.environ.get("SENTRY_DSN", "") + SELFDRIVE = "https://7305139359a548fcb348ec09497dc389@bugsink.firestar.link/1" # native project - SELFDRIVE_NATIVE = os.environ.get("SENTRY_DSN", "") + SELFDRIVE_NATIVE = "https://7305139359a548fcb348ec09497dc389@bugsink.firestar.link/1" def report_tombstone(fn: str, message: str, contents: str) -> None: @@ -26,6 +28,12 @@ def report_tombstone(fn: str, message: str, contents: str) -> None: with sentry_sdk.configure_scope() as scope: scope.set_extra("tombstone_fn", fn) scope.set_extra("tombstone", contents) + + # Attach qlog for debugging context + qlogs = glob.glob(f"{Paths.log_root()}/*/qlog") + if qlogs: + scope.add_attachment(path=max(qlogs, key=os.path.getmtime), filename="qlog") + sentry_sdk.capture_message(message=message) sentry_sdk.flush() @@ -51,8 +59,14 @@ def capture_exception(*args, crash_log=True, **kwargs) -> None: cloudlog.error("crash", exc_info=kwargs.get('exc_info', 1)) try: - sentry_sdk.capture_exception(*args, **kwargs) - sentry_sdk.flush() # https://github.com/getsentry/sentry-python/issues/291 + with sentry_sdk.push_scope() as scope: + # Attach qlog for debugging context + qlogs = glob.glob(f"{Paths.log_root()}/*/qlog") + if qlogs: + scope.add_attachment(path=max(qlogs, key=os.path.getmtime), filename="qlog") + + sentry_sdk.capture_exception(*args, **kwargs) + sentry_sdk.flush() # https://github.com/getsentry/sentry-python/issues/291 except Exception: cloudlog.exception("sentry exception") @@ -90,25 +104,15 @@ def save_exception(exc_text: str, crash_log) -> None: def init(project: SentryProject) -> bool: - build_metadata = get_build_metadata() - FrogPilot = "frogai" in build_metadata.openpilot.git_origin.lower() - if not FrogPilot or PC: + if PC: return False + build_metadata = get_build_metadata() short_branch = build_metadata.channel - if short_branch in ["COMMA", "HEAD"]: - return - elif short_branch == "FrogPilot-Development": - env = "Development" - elif build_metadata.release_channel: - env = "Release" - elif short_branch == "FrogPilot-Testing": + env = short_branch + if re.search("test", short_branch, re.IGNORECASE): env = "Testing" - elif build_metadata.tested_channel: - env = "Staging" - else: - env = short_branch dongle_id = params.get("DongleId", encoding="utf-8") installed = params.get("InstallDate", encoding="utf-8")