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

Add debouncing mechanism and before-capture callbacks for screenshots/vh #2773

Merged
merged 9 commits into from
Jun 19, 2023

Conversation

markushi
Copy link
Member

@markushi markushi commented Jun 6, 2023

📜 Description

As discussed we want to debounce the capturing of screenshots / view hierarchies. As of now I hard-coded the debouncing time to 2 seconds, thus in worst case capturing is happening every 2 seconds.

On top of that a new beforeCapture callback is introduced, to allow even more customization and eventually overrule the debouncing mechanism. This callback can also be used to prevent capturing for non-fatal events.

💡 Motivation and Context

Fixes #2713 and #2665

💚 How did you test it?

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

@github-actions
Copy link
Contributor

github-actions bot commented Jun 6, 2023

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against ebb2ccc

@github-actions
Copy link
Contributor

github-actions bot commented Jun 6, 2023

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 387.45 ms 407.08 ms 19.63 ms
Size 1.72 MiB 2.28 MiB 572.22 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
8820c5c 330.60 ms 416.86 ms 86.26 ms
496bdfd 301.22 ms 343.96 ms 42.73 ms
496bdfd 272.86 ms 407.33 ms 134.48 ms

App size

Revision Plain With Sentry Diff
8820c5c 1.72 MiB 2.28 MiB 571.82 KiB
496bdfd 1.72 MiB 2.28 MiB 571.82 KiB
496bdfd 1.72 MiB 2.28 MiB 571.82 KiB

Previous results on branch: feat/debounce-screenshots-vh

Startup times

Revision Plain With Sentry Diff
d3eea7e 300.30 ms 357.16 ms 56.86 ms
d54ccce 274.06 ms 313.64 ms 39.58 ms
14a2eda 309.83 ms 421.20 ms 111.37 ms
40f6a9d 281.74 ms 355.69 ms 73.95 ms
eff78ed 306.31 ms 380.76 ms 74.45 ms

App size

Revision Plain With Sentry Diff
d3eea7e 1.72 MiB 2.28 MiB 572.01 KiB
d54ccce 1.72 MiB 2.28 MiB 572.01 KiB
14a2eda 1.72 MiB 2.28 MiB 571.93 KiB
40f6a9d 1.72 MiB 2.28 MiB 571.93 KiB
eff78ed 1.72 MiB 2.28 MiB 571.93 KiB

@codecov
Copy link

codecov bot commented Jun 6, 2023

Codecov Report

Patch coverage: 82.42% and project coverage change: +0.03 🎉

Comparison is base (afecabf) 81.10% compared to head (ebb2ccc) 81.14%.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2773      +/-   ##
============================================
+ Coverage     81.10%   81.14%   +0.03%     
- Complexity     4476     4497      +21     
============================================
  Files           347      348       +1     
  Lines         16499    16677     +178     
  Branches       2236     2267      +31     
============================================
+ Hits          13381    13532     +151     
- Misses         2183     2198      +15     
- Partials        935      947      +12     
Impacted Files Coverage Δ
...java/io/sentry/apollo3/SentryApollo3Interceptor.kt 61.53% <ø> (-2.75%) ⬇️
...racing/SentrySpanClientHttpRequestInterceptor.java 0.00% <0.00%> (ø)
...racing/SentrySpanClientHttpRequestInterceptor.java 0.00% <0.00%> (ø)
sentry/src/main/java/io/sentry/SentryOptions.java 79.95% <50.00%> (ø)
...io/sentry/apollo3/SentryApolloBuilderExtensions.kt 60.00% <55.55%> (+10.00%) ⬆️
...n/java/io/sentry/apollo/SentryApolloInterceptor.kt 81.31% <77.77%> (-1.04%) ⬇️
.../io/sentry/apollo3/SentryApollo3HttpInterceptor.kt 84.38% <83.83%> (+3.20%) ⬆️
.../io/sentry/apollo3/SentryApollo3ClientException.kt 100.00% <100.00%> (ø)
...in/java/io/sentry/openfeign/SentryFeignClient.java 94.44% <100.00%> (+0.07%) ⬆️
...arta/tracing/SentrySpanClientWebRequestFilter.java 72.34% <100.00%> (+0.60%) ⬆️
... and 8 more

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

@stefanosiano
Copy link
Member

just a couple tests and comments, but looks good!

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.

Improve Screenshots/ViewHierarchy mechanism
4 participants