Files
bugsink/sentry/stacktraces/processing.py
Klaas van Schelven fc7e186918 getting hash for issue: use GlitchTip's approach as an early stand-in
af9a700a8706f20771b005804d8c92ca95c8b072 in GlitchTip
2023-11-04 22:14:39 +01:00

27 lines
782 B
Python

from sentry.utils.safe import get_path
def get_crash_frame_from_event_data(data, frame_filter=None):
frames = get_path(
data, "exception", "values", -1, "stacktrace", "frames"
) or get_path(data, "stacktrace", "frames")
if not frames:
threads = get_path(data, "threads", "values")
if threads and len(threads) == 1:
frames = get_path(threads, 0, "stacktrace", "frames")
default = None
for frame in reversed(frames or ()):
if frame is None:
continue
if frame_filter is not None:
if not frame_filter(frame):
continue
if frame.get("in_app"):
return frame
if default is None:
default = frame
if default:
return default