Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def processing_crash_dump(self, crash_pk):
try:
crash = Crash.objects.get(pk=crash_pk)
# assemble crash_dump_path
url = furl(crash.upload_file_minidump.url)
path = url.pathstr
crash_dump_path = os.path.join(S3_MOUNT_PATH, *path.split('/'))
# Set various values in the crash object.
stacktrace = get_stacktrace(crash_dump_path)
crash.stacktrace = stacktrace
crash.stacktrace_json = parse_stacktrace(stacktrace)
crash.signature = get_signature(crash.stacktrace_json)
_os = get_os(crash.stacktrace_json)
meta = crash.meta or {}
build_number = meta.get('ver', '')
channel = meta.get('channel', '') or get_channel(build_number, _os)
crash.os = _os
def get_sentry_link(self, crash_pk, event_id):
try:
if SENTRY_DOMAIN and SENTRY_ORG_SLUG and SENTRY_PROJ_SLUG and SENTRY_API_KEY:
crash = Crash.objects.get(pk=crash_pk)
resp = requests.get(
'http://%s/api/0/projects/%s/%s/events/%s/' % (SENTRY_DOMAIN, SENTRY_ORG_SLUG, SENTRY_PROJ_SLUG, event_id,),
auth=(SENTRY_API_KEY, '')
).json()
crash.groupid = resp['groupID']
crash.eventid = resp['id']
crash.save()
else:
logging.warning("Sentry is not congured")
except KeyError as exc:
logging.error("Sentry event not found")
raise self.retry(exc=exc, countdown=2 ** get_sentry_link.request.retries)