Browse Source

ref: Normalize more in Symbolicator Snapshots (#32871)

Arpad Borsos 2 years ago
parent
commit
0740cf637f

+ 31 - 1
tests/symbolicator/__init__.py

@@ -1,4 +1,5 @@
 import os
+import re
 
 from sentry.utils.safe import get_path
 
@@ -26,14 +27,43 @@ def strip_frame(frame):
     return frame
 
 
+NORMALIZED_REGISTERS = {}
+
+
+def normalize_register(name):
+    return NORMALIZED_REGISTERS.get(name, name)
+
+
 def strip_stacktrace(stacktrace):
     if stacktrace:
         stacktrace = dict(stacktrace)
         stacktrace["frames"] = [strip_frame(x) for x in stacktrace.get("frames") or ()]
+        try:
+            stacktrace["registers"] = {
+                normalize_register(k): v for k, v in stacktrace["registers"].items()
+            }
+        except KeyError:
+            pass
 
     return stacktrace
 
 
+STRIP_TRAILING_ADDR_RE = re.compile(" ?/ 0x[0-9a-fA-F]+$")
+
+
+def strip_trailing_addr(value):
+    return STRIP_TRAILING_ADDR_RE.sub("", value)
+
+
+def normalize_exception(exc):
+    if exc:
+        exc = dict(exc)
+        exc["type"] = strip_trailing_addr(exc["type"])
+        exc["value"] = strip_trailing_addr(exc["value"])
+
+    return exc
+
+
 def strip_stacktrace_container(container):
     if container:
         container = dict(container)
@@ -51,7 +81,7 @@ def insta_snapshot_stacktrace_data(self, event, **kwargs):
             "stacktrace": strip_stacktrace(event.get("stacktrace")),
             "exception": {
                 "values": [
-                    strip_stacktrace_container(x)
+                    normalize_exception(strip_stacktrace_container(x))
                     for x in get_path(event, "exception", "values") or ()
                 ]
             },

+ 1 - 1
tests/symbolicator/snapshots/SymbolicatorMinidumpIntegrationTest/test_full_minidump.pysnap

@@ -1,5 +1,5 @@
 ---
-created: '2020-11-17T16:59:10.116713Z'
+created: '2022-03-28T11:44:28.487657Z'
 creator: sentry
 source: tests/symbolicator/test_minidump_full.py
 ---

+ 1 - 1
tests/symbolicator/snapshots/SymbolicatorMinidumpIntegrationTest/test_missing_dsym.pysnap

@@ -1,5 +1,5 @@
 ---
-created: '2021-01-05T09:42:10.564022Z'
+created: '2022-03-28T11:44:46.522208Z'
 creator: sentry
 source: tests/symbolicator/test_minidump_full.py
 ---

+ 1 - 1
tests/symbolicator/snapshots/SymbolicatorMinidumpIntegrationTest/test_reprocessing_initial.pysnap

@@ -1,5 +1,5 @@
 ---
-created: '2021-01-05T09:42:17.220118Z'
+created: '2022-03-28T11:44:52.208370Z'
 creator: sentry
 source: tests/symbolicator/test_minidump_full.py
 ---

+ 1 - 1
tests/symbolicator/snapshots/SymbolicatorMinidumpIntegrationTest/test_reprocessing_reprocessed.pysnap

@@ -1,5 +1,5 @@
 ---
-created: '2021-01-05T10:23:58.428788Z'
+created: '2022-03-28T11:44:53.352546Z'
 creator: sentry
 source: tests/symbolicator/test_minidump_full.py
 ---

+ 1 - 1
tests/symbolicator/snapshots/SymbolicatorResolvingIntegrationTest/test_debug_id_resolving.pysnap

@@ -1,5 +1,5 @@
 ---
-created: '2020-07-23T19:33:18.859595Z'
+created: '2022-03-28T11:44:58.859263Z'
 creator: sentry
 source: tests/symbolicator/test_payload_full.py
 ---

+ 1 - 1
tests/symbolicator/snapshots/SymbolicatorResolvingIntegrationTest/test_missing_debug_images.pysnap

@@ -1,5 +1,5 @@
 ---
-created: '2020-07-23T19:33:26.234043Z'
+created: '2022-03-28T11:45:04.293878Z'
 creator: sentry
 source: tests/symbolicator/test_payload_full.py
 ---

+ 1 - 1
tests/symbolicator/snapshots/SymbolicatorResolvingIntegrationTest/test_missing_dsym.pysnap

@@ -1,5 +1,5 @@
 ---
-created: '2019-11-19T11:20:01.932672Z'
+created: '2022-03-28T11:45:09.928480Z'
 creator: sentry
 source: tests/symbolicator/test_payload_full.py
 ---

+ 1 - 1
tests/symbolicator/snapshots/SymbolicatorResolvingIntegrationTest/test_real_resolving.pysnap

@@ -1,5 +1,5 @@
 ---
-created: '2020-07-23T19:33:42.975020Z'
+created: '2022-03-28T11:45:15.556666Z'
 creator: sentry
 source: tests/symbolicator/test_payload_full.py
 ---

+ 1 - 1
tests/symbolicator/snapshots/SymbolicatorUnrealIntegrationTest/test_unreal_apple_crash_with_attachments.pysnap

@@ -1,5 +1,5 @@
 ---
-created: '2020-10-31T11:13:08.932876Z'
+created: '2022-03-28T12:03:04.745358Z'
 creator: sentry
 source: tests/symbolicator/test_unreal_full.py
 ---

Some files were not shown because too many files changed in this diff