修改 sentry.io 相關程式碼

* 提供更多的資訊
* 將錯誤轉發至 dragonpilot 帳號
This commit is contained in:
Rick Lan
2019-06-27 11:36:32 +10:00
parent 402e07827c
commit 327a5d426b
2 changed files with 26 additions and 3 deletions

View File

@@ -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)

View File

@@ -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')})