-
-
Notifications
You must be signed in to change notification settings - Fork 334
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: Swift error names #2960
feat: Swift error names #2960
Conversation
Call into Swift to get the error description for Swift errors to get meaningful error names instead of only the error enum code. To avoid sending PII the SDK strips parameter values and doesn't send the swift error name for struct based Swift errors. Fixes GH-2958
Instructions and example for changelogPlease add an entry to Example: ## Unreleased
- Swift error names ([#2960](https://github.com/getsentry/sentry-cocoa/pull/2960)) If none of the above apply, you can opt out of this check by adding |
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
e71cf92 | 1201.69 ms | 1226.52 ms | 24.83 ms |
1bd0055 | 1207.57 ms | 1223.10 ms | 15.53 ms |
56ec5d0 | 1194.39 ms | 1236.94 ms | 42.55 ms |
b6ba04e | 1230.48 ms | 1253.20 ms | 22.72 ms |
455619d | 1253.08 ms | 1265.06 ms | 11.98 ms |
efb2222 | 1256.44 ms | 1278.90 ms | 22.46 ms |
2cf1b84 | 6265.25 ms | 6277.98 ms | 12.73 ms |
6f4d20c | 1228.67 ms | 1238.88 ms | 10.21 ms |
90d17d3 | 1261.18 ms | 1278.18 ms | 17.00 ms |
228a909 | 1248.92 ms | 1267.42 ms | 18.50 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
e71cf92 | 20.76 KiB | 419.85 KiB | 399.10 KiB |
1bd0055 | 20.76 KiB | 420.22 KiB | 399.46 KiB |
56ec5d0 | 20.76 KiB | 414.44 KiB | 393.68 KiB |
b6ba04e | 20.76 KiB | 414.44 KiB | 393.68 KiB |
455619d | 20.76 KiB | 432.87 KiB | 412.11 KiB |
efb2222 | 20.76 KiB | 424.45 KiB | 403.69 KiB |
2cf1b84 | 20.76 KiB | 431.91 KiB | 411.15 KiB |
6f4d20c | 20.76 KiB | 431.71 KiB | 410.95 KiB |
90d17d3 | 20.76 KiB | 432.17 KiB | 411.41 KiB |
228a909 | 20.76 KiB | 425.71 KiB | 404.95 KiB |
Previous results on branch: feat/swift-errors
Startup times
Revision | Plain | With Sentry | Diff |
---|---|---|---|
51283b0 | 1247.96 ms | 1274.88 ms | 26.92 ms |
d617f71 | 1195.88 ms | 1217.94 ms | 22.06 ms |
eb467b7 | 1218.43 ms | 1240.43 ms | 22.00 ms |
9b6a939 | 1200.69 ms | 1223.62 ms | 22.93 ms |
60a6dd8 | 1233.35 ms | 1253.74 ms | 20.39 ms |
cca8c20 | 1229.80 ms | 1246.08 ms | 16.28 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
51283b0 | 20.76 KiB | 437.69 KiB | 416.93 KiB |
d617f71 | 20.76 KiB | 436.60 KiB | 415.84 KiB |
eb467b7 | 20.76 KiB | 436.26 KiB | 415.50 KiB |
9b6a939 | 20.76 KiB | 436.26 KiB | 415.50 KiB |
60a6dd8 | 20.76 KiB | 436.50 KiB | 415.74 KiB |
cca8c20 | 20.76 KiB | 436.50 KiB | 415.74 KiB |
Looks good, looking forward to this 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good, I have one question and one thing you should review.
Whats is preventing this from being ready for review?
What I mentioned above in the description:
|
public static func getSwiftErrorDescription(_ error: Error) -> String? { | ||
return String(describing: error) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
h: Why are we not concern with PII anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you missed my update in the description above #2960 (comment)
Update: No need to worry about PII in a major as we already would send PII of Errors with
sentry-cocoa/Sources/Sentry/SentryClient.m
Lines 265 to 267 in 9d61bea
// The description of the error can be especially useful for error from swift that | |
// use a simple enum. | |
mechanism.desc = error.description; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you missed my update in the description above
Yeap I did. I would like to suggest to only update description if something is wrong, change of direction in the PR should be describe in a new comment. Or both, since GH itself don't warn about description changing.
Thanks for clarifying!
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2960 +/- ##
=============================================
- Coverage 80.560% 80.555% -0.006%
=============================================
Files 265 265
Lines 24728 24706 -22
Branches 10968 10953 -15
=============================================
- Hits 19921 19902 -19
+ Misses 4190 4189 -1
+ Partials 617 615 -2
... and 3 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
📜 Description
Call into Swift to get the error description for Swift errors to get meaningful error names instead of only the error enum code. To avoid sending PII, the SDK strips parameter values and doesn't send the Swift error name for struct-based Swift errors.
This change has no impact on grouping.
I'm unsure about my data stripping approach in
SwiftDescriptor.getSwiftErrorDescription
to avoid sending PII. Maybe it's also OK to just attach the description. On the other hand, I feel safer changing that behavior in the next major.Update: No need to worry about PII in a major as we already would send PII of Errors with
sentry-cocoa/Sources/Sentry/SentryClient.m
Lines 265 to 267 in 9d61bea
Docs PR getsentry/sentry-docs#6805
💡 Motivation and Context
Fixes GH-2958
💚 How did you test it?
Unit tests.
📝 Checklist
You have to check all boxes before merging:
sendDefaultPII
is enabled.🔮 Next steps