From 327a5d426b73b715c1e06ec2dfb64b68e30de213 Mon Sep 17 00:00:00 2001 From: Rick Lan Date: Thu, 27 Jun 2019 11:36:32 +1000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20sentry.io=20=E7=9B=B8?= =?UTF-8?q?=E9=97=9C=E7=A8=8B=E5=BC=8F=E7=A2=BC=20*=20=E6=8F=90=E4=BE=9B?= =?UTF-8?q?=E6=9B=B4=E5=A4=9A=E7=9A=84=E8=B3=87=E8=A8=8A=20*=20=E5=B0=87?= =?UTF-8?q?=E9=8C=AF=E8=AA=A4=E8=BD=89=E7=99=BC=E8=87=B3=20dragonpilot=20?= =?UTF-8?q?=E5=B8=B3=E8=99=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- selfdrive/crash.py | 27 +++++++++++++++++++++++++-- selfdrive/tombstoned.py | 2 +- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/selfdrive/crash.py b/selfdrive/crash.py index 94bdfd125..5034ffc3a 100644 --- a/selfdrive/crash.py +++ b/selfdrive/crash.py @@ -18,8 +18,31 @@ if os.getenv("NOLOG") or os.getenv("NOCRASH"): else: from raven import Client from raven.transport.http import HTTPTransport - client = Client('https://1994756b5e6f41cf939a4c65de45f4f2:cefebaf3a8aa40d182609785f7189bd7@app.getsentry.com/77924', - install_sys_hook=False, transport=HTTPTransport, release=version, tags={'dirty': dirty}) + + with open("/data/openpilot/.git/HEAD", "r") as f: + content = f.read().split(' ') + branch = content[1] + error_tags = {'dirty': dirty, 'branch': branch} + try: + with open("/data/data/ai.comma.plus.offroad/files/persistStore/persist-auth", "r") as f: + auth = json.loads(f.read()) + auth = json.loads(auth['commaUser']) + error_tags['username'] = auth['username'] + error_tags['email'] = auth['email'] + except: + pass + client = Client('https://980a0cba712a4c3593c33c78a12446e1:fecab286bcaf4dba8b04f7cff0188e2d@sentry.io/1488600', + install_sys_hook=False, transport=HTTPTransport, release=version, tags=error_tags) + try: + client.user_context(error_tags['username']) + except: + pass + + def capture_warning(warning_string): + client.captureMessage(warning_string, level='warning') + + def capture_info(info_string): + client.captureMessage(info_string, level='info') def capture_exception(*args, **kwargs): client.captureException(*args, **kwargs) diff --git a/selfdrive/tombstoned.py b/selfdrive/tombstoned.py index 3d7061c6a..1c22727d9 100644 --- a/selfdrive/tombstoned.py +++ b/selfdrive/tombstoned.py @@ -104,7 +104,7 @@ def report_tombstone(fn, client): def main(gctx): initial_tombstones = set(get_tombstones()) - client = Client('https://d3b175702f62402c91ade04d1c547e68:b20d68c813c74f63a7cdf9c4039d8f56@sentry.io/157615', + client = Client('https://980a0cba712a4c3593c33c78a12446e1:fecab286bcaf4dba8b04f7cff0188e2d@sentry.io/1488600', install_sys_hook=False, transport=HTTPTransport, release=version, tags={'dirty': dirty}, string_max_length=10000) client.user_context({'id': os.environ.get('DONGLE_ID')})