sentry improvements (#23627)
* sentry: filter out unregistered devices and PC * add daemon namepull/23634/head
parent
cf9eee4272
commit
8b5b0ae341
|
@ -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())
|
||||
|
|
|
@ -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')()
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue