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

Fix SentryFileWriter and SentryFileOutputStream append overwrites file contents #2304

Merged
merged 4 commits into from Oct 18, 2022

Conversation

romtsn
Copy link
Member

@romtsn romtsn commented Oct 17, 2022

📜 Description

A very nasty bug 🙈

💡 Motivation and Context

Closes getsentry/sentry-android-gradle-plugin#387

💚 How did you test it?

With a unit test case

📝 Checklist

  • I reviewed the submitted code
  • I added tests to verify the changes
  • I updated the docs if needed
  • No breaking changes

🔮 Next steps

@romtsn romtsn changed the title Fix SentryFileWriter and SentryFileOutputStream append does not work Fix SentryFileWriter and SentryFileOutputStream append overwrites file contents Oct 17, 2022
@getsentry getsentry deleted a comment from github-actions bot Oct 17, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Oct 17, 2022

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 343.88 ms 384.40 ms 40.52 ms
Size 1.73 MiB 2.29 MiB 581.39 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
2c5f172 310.20 ms 357.16 ms 46.96 ms
3d89dea 345.59 ms 364.06 ms 18.47 ms
4dd88fe 302.12 ms 331.17 ms 29.04 ms
2c5f172 351.18 ms 373.52 ms 22.34 ms
d4087ee 278.00 ms 313.86 ms 35.86 ms
7300956 337.57 ms 384.21 ms 46.64 ms
2f079a1 296.91 ms 337.43 ms 40.51 ms
3d89dea 322.38 ms 350.82 ms 28.45 ms
2c5f172 289.18 ms 307.56 ms 18.38 ms
4ca1d7b 328.46 ms 368.22 ms 39.76 ms

App size

Revision Plain With Sentry Diff
2c5f172 1.73 MiB 2.29 MiB 580.10 KiB
3d89dea 1.74 MiB 2.33 MiB 604.92 KiB
4dd88fe 1.73 MiB 2.29 MiB 579.50 KiB
2c5f172 1.73 MiB 2.29 MiB 580.10 KiB
d4087ee 1.73 MiB 2.29 MiB 579.50 KiB
7300956 1.73 MiB 2.29 MiB 578.69 KiB
2f079a1 1.74 MiB 2.33 MiB 605.56 KiB
3d89dea 1.74 MiB 2.33 MiB 604.92 KiB
2c5f172 1.73 MiB 2.29 MiB 580.10 KiB
4ca1d7b 1.73 MiB 2.29 MiB 579.88 KiB

Previous results on branch: fix/filewriter-append

Startup times

Revision Plain With Sentry Diff
0524f83 299.76 ms 358.94 ms 59.18 ms
8b85760 296.56 ms 330.12 ms 33.56 ms

App size

Revision Plain With Sentry Diff
0524f83 1.73 MiB 2.29 MiB 580.10 KiB
8b85760 1.73 MiB 2.29 MiB 581.39 KiB

@codecov-commenter
Copy link

codecov-commenter commented Oct 17, 2022

Codecov Report

Base: 80.11% // Head: 80.12% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (83737be) compared to base (afa17ae).
Patch coverage: 75.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #2304   +/-   ##
=========================================
  Coverage     80.11%   80.12%           
- Complexity     3433     3435    +2     
=========================================
  Files           242      242           
  Lines         12765    12769    +4     
  Branches       1703     1706    +3     
=========================================
+ Hits          10227    10231    +4     
  Misses         1889     1889           
  Partials        649      649           
Impacted Files Coverage Δ
sentry/src/main/java/io/sentry/SentryOptions.java 81.14% <ø> (ø)
...y/src/main/java/io/sentry/cache/EnvelopeCache.java 53.29% <0.00%> (ø)
...y/instrumentation/file/SentryFileOutputStream.java 45.45% <50.00%> (ø)
sentry/src/main/java/io/sentry/OutboxSender.java 66.16% <100.00%> (+0.51%) ⬆️
sentry/src/main/java/io/sentry/Sentry.java 53.71% <100.00%> (+0.53%) ⬆️
.../sentry/instrumentation/file/SentryFileWriter.java 16.66% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@markushi markushi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, LGTM!

@romtsn romtsn merged commit 221a5df into main Oct 18, 2022
@romtsn romtsn deleted the fix/filewriter-append branch October 18, 2022 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Appending text with the SentryFileWriter not possible
4 participants