diff --git a/selfdrive/athena/registration.py b/selfdrive/athena/registration.py index f19540eb87..b0b9dd2e66 100755 --- a/selfdrive/athena/registration.py +++ b/selfdrive/athena/registration.py @@ -17,6 +17,11 @@ from selfdrive.swaglog import cloudlog UNREGISTERED_DONGLE_ID = "UnregisteredDevice" +def is_registered_device() -> bool: + dongle = Params().get("DongleId", encoding='utf-8') + return dongle not in (None, UNREGISTERED_DONGLE_ID) + + def register(show_spinner=False) -> str: params = Params() params.put("SubscriberInfo", HARDWARE.get_subscriber_info()) diff --git a/selfdrive/manager/process.py b/selfdrive/manager/process.py index 5165d6da78..ebdd2a90bf 100644 --- a/selfdrive/manager/process.py +++ b/selfdrive/manager/process.py @@ -34,8 +34,9 @@ def launcher(proc: str, name: str) -> None: # create new context since we forked messaging.context = messaging.Context() - # add daemon name to cloudlog ctx + # add daemon name tag to logs cloudlog.bind(daemon=name) + sentry.set_tag("daemon", name) # exec the process getattr(mod, 'main')() diff --git a/selfdrive/sentry.py b/selfdrive/sentry.py index db763bf16f..5f22bf18e0 100644 --- a/selfdrive/sentry.py +++ b/selfdrive/sentry.py @@ -4,7 +4,8 @@ from enum import Enum from sentry_sdk.integrations.threading import ThreadingIntegration from common.params import Params -from selfdrive.hardware import HARDWARE +from selfdrive.athena.registration import is_registered_device +from selfdrive.hardware import HARDWARE, PC from selfdrive.swaglog import cloudlog from selfdrive.version import get_branch, get_commit, get_origin, get_version, \ is_comma_remote, is_dirty, is_tested_branch @@ -37,9 +38,14 @@ def capture_exception(*args, **kwargs) -> None: cloudlog.exception("sentry exception") +def set_tag(key: str, value: str) -> None: + sentry_sdk.set_tag(key, value) + + def init(project: SentryProject) -> None: # forks like to mess with this, so double check - if not (is_comma_remote() and "commaai" in get_origin(default="")): + comma_remote = is_comma_remote() and "commaai" in get_origin(default="") + if not comma_remote or not is_registered_device() or PC: return env = "release" if is_tested_branch() else "master"