Skip to content

Commit 549fae8

Browse files
committed
getting the full stacktrace
1 parent aaa78c4 commit 549fae8

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

sentry_sdk/integrations/dedupe.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,20 @@ def _get_exception_hash(exc):
3232
exc_type = type(exc).__name__
3333
exc_message = str(exc)
3434

35-
# Get the first frame of the traceback if it exists
35+
# Get the full stacktrace
36+
stacktrace = []
3637
if hasattr(exc, "__traceback__") and exc.__traceback__:
37-
frame = exc.__traceback__.tb_frame
38-
filename = frame.f_code.co_filename
39-
lineno = frame.f_lineno
40-
func_name = frame.f_code.co_name
41-
location = f"{filename}:{lineno}:{func_name}" # noqa: E231
42-
else:
43-
location = None
38+
tb = exc.__traceback__
39+
while tb:
40+
frame = tb.tb_frame
41+
filename = frame.f_code.co_filename
42+
lineno = tb.tb_lineno
43+
func_name = frame.f_code.co_name
44+
stacktrace.append((filename, lineno, func_name))
45+
tb = tb.tb_next
4446

4547
# Create a tuple of the essential information and hash it
46-
return hash((exc_type, exc_message, location))
48+
return hash((exc_type, exc_message, tuple(stacktrace)))
4749

4850
@staticmethod
4951
def setup_once():

0 commit comments

Comments
 (0)