-
-
Notifications
You must be signed in to change notification settings - Fork 342
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: Attach screenshots for errors #1751
Conversation
|
Codecov Report
@@ Coverage Diff @@
## master #1751 +/- ##
==========================================
- Coverage 91.82% 91.66% -0.16%
==========================================
Files 195 198 +3
Lines 8914 9001 +87
==========================================
+ Hits 8185 8251 +66
- Misses 729 750 +21
Continue to review full report at Codecov.
|
|
Does it work even if the event isn't called by the main thread? |
Yes |
Should all events, other then transactions, have a screenshot? I thought only errors and exceptions. Crash events cannot be created by the user, so I also chose not to include a screenshot. |
Every event that has an exception should attach the screenshot, an Event created by the user might have an exception, e.g. a synthetic exception, See https://github.com/getsentry/sentry-java/blob/main/sentry/src/main/java/io/sentry/SentryEvent.java#L242-L249= |
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 know it's a draft, but we are still missing tests. I'm surprised by how simple the solution is. I like it 👏
|
||
@implementation SentryScreenshot | ||
|
||
- (NSArray<NSData *> *)appScreenshots |
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.
m
: How much overhead is it to take a screenshot? If it's expensive, I think we should add it to the docs and the code docs of SentryOptions
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 is a little expensive.
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 don't think we should point this out on documentation. Developers should have a little notion on how expensive is to draw the entire screen.
And anyway, this captures are only done on-demand, is not like this would be harmful to the app execution.
Writing these kind of comments can drive users away from the feature.
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.
Writing these kind of comments can drive users away from the feature.
💯
The thing is, using |
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 like the new proposal; it decouples the client from attaching screenshots. Good job. We are only missing tests, I guess.
Well, it works, but gives a lot of warnings, which are annoying. |
…sentry-cocoa into feat/crash-screenshot
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 like the solution. We have to update the docs after releasing this PR, which should be easy as Android already has them https://docs.sentry.io/platforms/android/configuration/options/#attach-screenshot
Running the SentryScreenShotTests
on an iPhone 7 simulator fails with
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil
I think https://github.com/getsentry/sentry-cocoa/runs/6092111176?check_suite_focus=true fails for the same reason.
I think we should add a UI test that clicks the error
button for the UI tests of the iOS-Swift sample app, just to be safe we are not crashing.
Tests/SentryTests/Integrations/Screenshot/SentryScreenshotIntegrationTests.swift
Show resolved
Hide resolved
Co-authored-by: Philipp Hofmann <[email protected]>
…sentry-cocoa into feat/crash-screenshot
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.
We are only missing the UITest. Thanks.
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.
LGTM 🚀
📜 Description
Feat: screenshots
https://develop.sentry.dev/sdk/features/#screenshots=
💡 Motivation and Context
Users may want to see what's in the screen when there's an error or crash.
close #1721
💚 How did you test it?
Unit Tests and Samples
📝 Checklist
🔮 Next steps