-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
Toast rather than crash when sharing giant traces #31
Conversation
Hi @stkent, sorry for the late response. I think this implementation good but we should not show an error to the user if the trace is too long. We should measure the max trace size taking a look at the original implementation and don't try to send more traces than the one we can share depending on the OS version. What do you think? Can we update this PR implementing this change? |
I'm not sure there's a known per- |
After researching this issue seems that there is a limit depending on the Android SDK being used and device close to 1 MB of bytes being sent using a Here you have some references:
Based on this information, I'd catch the exception and if the limit is exceeded we should try to share just the last 100kb of traces. Even when the limit seems to be 1MB there is a blog post saying that it could be closer to 500kb so I think the last 100kb should be enough information. What do you think @stkent? Can we update this PR implementing this behavior? |
Awesome, yes, I think that behavior should be possible! I'll try today and let you know how it goes :) |
Great! Let me know once the code is ready and I'll take a look again 😃 |
@pedrovgs let me know what you think of the updated suggestion! |
/* | ||
* Limit trace size to between 100kB and 400kB, since Unicode characters can be 1-4 bytes each. | ||
*/ | ||
String truncatedTraces = fullTraces.substring(0, Math.min(100000, fullTraces.length())); |
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.
Using this substring
call you are going to take the first part of the traces but the most relevant one is the last part of the traces content. Am I wrong?
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.
Good catch, fixed!
Great @stkent! Thank you so much for your time and patience 😃 I'm merging this PR and releasing a new version! |
No problem, thanks for maintaining a great library! |
I've just released the new version! |
Fixes #25.
@pedrovgs unlike #30, there are several fairly different ways this issue could be addressed. I've included one in this PR, but am more than happy to discuss and make changes if you'd prefer a different solution. (For example, we could build an automatic retry with truncated traces into the
shareTraces
method.)