Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sdk-crashes): Filenames for system frames #59515

Merged
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
4 changes: 2 additions & 2 deletions src/sentry/utils/sdk_crashes/event_stripper.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def with_explanation(self, explanation: str) -> "Allow":
"values": {
"stacktrace": {
"frames": {
"filename": Allow.NEVER.with_explanation(
"The filename path could contain the app name."
"filename": Allow.SIMPLE_TYPE.with_explanation(
"We overwrite the filename for SDK frames and it's acceptable to keep it for system library frames."
),
"function": Allow.SIMPLE_TYPE,
"raw_function": Allow.SIMPLE_TYPE,
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/utils/sdk_crashes/sdk_crash_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(

@property
def fields_containing_paths(self) -> Set[str]:
return {"package", "module", "abs_path"}
return {"package", "module", "abs_path", "filename"}

def replace_sdk_frame_path(self, field: str) -> str:
for matcher, replacement_name in self.config.sdk_frame_path_replacement_names.items():
Expand Down
3 changes: 3 additions & 0 deletions tests/sentry/utils/sdk_crashes/test_event_stripper.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ def test_strip_event_data_keeps_exception_stacktrace(store_and_strip_event):
"raw_function": "raw_function",
"module": "module",
"abs_path": "abs_path",
"filename": "EventStripperTestFrame.swift",
"in_app": False,
"instruction_addr": "0x1a4e8f000",
"addr_mode": "0x1a4e8f000",
Expand Down Expand Up @@ -297,6 +298,7 @@ def test_strip_frames_sdk_frames(store_and_strip_event):
"package": "Sentry.framework",
"abs_path": "Sentry.framework",
"module": "Sentry.framework",
"filename": "Sentry.framework",
"in_app": True,
"image_addr": "0x100304000",
}
Expand Down Expand Up @@ -331,6 +333,7 @@ def test_strip_frames_sdk_frames_multiple_replacement_names(store_and_strip_even
"package": "SentryPackage",
"abs_path": "Sentry.framework",
"module": "SentryModule",
"filename": "Sentry.framework",
"in_app": True,
"image_addr": "0x100304000",
}
Expand Down
12 changes: 12 additions & 0 deletions tests/sentry/utils/sdk_crashes/test_sdk_crash_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,49 +311,57 @@ def test_metric_kit_crash_is_detected(self, mock_sdk_crash_reporter):
"raw_function": "closure #1 (MXDiagnosticPayload) in SentryMXManager.didReceive([MXDiagnosticPayload])",
"package": "Sentry.framework",
"abs_path": "Sentry.framework",
"filename": "Sentry.framework",
"in_app": True,
},
{
"function": "SentryMXManager.didReceive",
"raw_function": "closure #1 (SentryMXCallStackTree) in closure #3 (MXCPUExceptionDiagnostic) in closure #1 (MXDiagnosticPayload) in SentryMXManager.didReceive([MXDiagnosticPayload])",
"package": "Sentry.framework",
"abs_path": "Sentry.framework",
"filename": "Sentry.framework",
"in_app": True,
},
{
"function": "-[SentryMetricKitIntegration captureEventNotPerThread:params:]",
"package": "Sentry.framework",
"abs_path": "Sentry.framework",
"filename": "Sentry.framework",
"in_app": True,
},
{
"function": "+[SentrySDK captureEvent:]",
"package": "Sentry.framework",
"abs_path": "Sentry.framework",
"filename": "Sentry.framework",
"in_app": True,
},
{
"function": "-[SentryFileManager readAppStateFrom:]",
"package": "Sentry.framework",
"abs_path": "Sentry.framework",
"filename": "Sentry.framework",
"in_app": True,
},
{
"function": "+[SentrySerialization appStateWithData:]",
"package": "Sentry.framework",
"abs_path": "Sentry.framework",
"filename": "Sentry.framework",
"in_app": True,
},
{
"function": "-[SentryAppState initWithJSONObject:]",
"package": "Sentry.framework",
"abs_path": "Sentry.framework",
"filename": "Sentry.framework",
"in_app": True,
},
{
"function": "+[NSDate(SentryExtras) sentry_fromIso8601String:]",
"package": "Sentry.framework",
"abs_path": "Sentry.framework",
"filename": "Sentry.framework",
"in_app": True,
},
{
Expand Down Expand Up @@ -448,24 +456,28 @@ def test_thread_inspector_crash_is_detected(self, mock_sdk_crash_reporter):
"function": "-[SentryANRTracker detectANRs]",
"package": "Sentry.framework",
"abs_path": "Sentry.framework",
"filename": "Sentry.framework",
"in_app": True,
},
{
"function": "-[SentryANRTracker ANRDetected]",
"package": "Sentry.framework",
"abs_path": "Sentry.framework",
"filename": "Sentry.framework",
"in_app": True,
},
{
"function": "-[SentryANRTrackingIntegration anrDetected]",
"package": "Sentry.framework",
"abs_path": "Sentry.framework",
"filename": "Sentry.framework",
"in_app": True,
},
{
"function": "getStackEntriesFromThread",
"package": "Sentry.framework",
"abs_path": "Sentry.framework",
"filename": "Sentry.framework",
"in_app": True,
},
]
Expand Down