Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

fix: reverse our filled in stack trace order #1136

Merged
merged 1 commit into from
Feb 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions autopush/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,10 @@ def raven_log(self, event):
extra = dict()
tb = f.getTracebackObject()
if not tb:
# include the current stack for at least some context
stack = list(iter_stack_frames())[4:] # approx.
# include the current stack for at least some
# context. sentry's expecting that "Frames should be
# sorted from oldest to newest."
stack = reversed(list(iter_stack_frames())[5:]) # approx.
extra = dict(no_failure_tb=True)
extra.update(
log_format=event.get('log_format'),
Expand Down
11 changes: 6 additions & 5 deletions autopush/tests/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,12 @@ def check():
return

assert len(logged) == 1
# Ensure a top level stacktrace was included
stacktrace = logged[0]['stacktrace']
assert any(
filename == f['abs_path'] and testname == f['function']
for f in stacktrace['frames'])
# Ensure a stacktrace was included w/ the current frame as
# the last entry
frames = logged[0]['stacktrace']['frames']
last = frames[-1]
assert last['abs_path'] == filename
assert last['function'] == testname

self._port.stopListening()
pl.stop()
Expand Down