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

Commit

Permalink
Merge pull request #1136 from mozilla-services/fix/1134
Browse files Browse the repository at this point in the history
fix: reverse our filled in stack trace order
  • Loading branch information
jrconlin authored Feb 14, 2018
2 parents a24d741 + 73338ac commit 12cba1a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
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

0 comments on commit 12cba1a

Please sign in to comment.