Skip to content

fix(span): Skip idle span creation when app is in background #4995

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

Merged
merged 2 commits into from
Jul 17, 2025

Conversation

antonis
Copy link
Collaborator

@antonis antonis commented Jul 16, 2025

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Skip idle span creation when app is in background.

This is a follow up to #3307

💡 Motivation and Context

Client reports of transactions starting in the background resulting in (a small number of) unexplainable long transactions skewing the app statistics.

💚 How did you test it?

Manual, CI tests

📝 Checklist

  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing
  • No breaking changes

🔮 Next steps

@antonis antonis marked this pull request as ready for review July 16, 2025 12:39
@antonis antonis requested a review from lucas-zimerman as a code owner July 16, 2025 12:39
Copy link
Contributor

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 418.34 ms 431.96 ms 13.62 ms
Size 17.75 MiB 20.15 MiB 2.41 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
a3aad2b 453.57 ms 463.62 ms 10.05 ms
c352c30 331.98 ms 321.78 ms -10.20 ms
e12044e 453.78 ms 437.58 ms -16.20 ms
531450c 426.69 ms 427.31 ms 0.62 ms
26286ef 371.31 ms 355.34 ms -15.97 ms
ab18954 433.46 ms 436.84 ms 3.38 ms
b13b9dd 465.46 ms 470.83 ms 5.37 ms
f2c6fa5 445.15 ms 449.13 ms 3.98 ms
7d3c3cb 444.85 ms 456.65 ms 11.81 ms
071ae5c 393.64 ms 406.60 ms 12.96 ms

App size

Revision Plain With Sentry Diff
a3aad2b 17.75 MiB 20.15 MiB 2.40 MiB
c352c30 17.75 MiB 20.15 MiB 2.40 MiB
e12044e 17.75 MiB 20.15 MiB 2.40 MiB
531450c 17.75 MiB 20.15 MiB 2.40 MiB
26286ef 17.75 MiB 20.15 MiB 2.40 MiB
ab18954 17.75 MiB 20.15 MiB 2.40 MiB
b13b9dd 17.75 MiB 20.15 MiB 2.41 MiB
f2c6fa5 17.75 MiB 20.15 MiB 2.40 MiB
7d3c3cb 17.75 MiB 20.15 MiB 2.40 MiB
071ae5c 17.75 MiB 20.15 MiB 2.41 MiB

Copy link
Contributor

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 387.48 ms 418.96 ms 31.48 ms
Size 7.15 MiB 8.42 MiB 1.27 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
a3aad2b+dirty 389.53 ms 436.76 ms 47.23 ms
940bd65+dirty 408.45 ms 419.75 ms 11.30 ms
f25ae46+dirty 366.14 ms 367.96 ms 1.82 ms
531450c+dirty 337.17 ms 362.67 ms 25.50 ms
ab18954+dirty 376.65 ms 376.82 ms 0.17 ms
38a1af2+dirty 421.38 ms 431.35 ms 9.97 ms
f76175c+dirty 354.23 ms 378.20 ms 23.97 ms
6715c24+dirty 378.57 ms 417.54 ms 38.97 ms
ba41c2a+dirty 376.50 ms 388.62 ms 12.12 ms
6e8a851+dirty 403.44 ms 430.87 ms 27.43 ms

App size

Revision Plain With Sentry Diff
a3aad2b+dirty 7.15 MiB 8.42 MiB 1.26 MiB
940bd65+dirty 7.15 MiB 8.42 MiB 1.26 MiB
f25ae46+dirty 7.15 MiB 8.42 MiB 1.26 MiB
531450c+dirty 7.15 MiB 8.42 MiB 1.26 MiB
ab18954+dirty 7.15 MiB 8.42 MiB 1.26 MiB
38a1af2+dirty 7.15 MiB 8.42 MiB 1.26 MiB
f76175c+dirty 7.15 MiB 8.42 MiB 1.26 MiB
6715c24+dirty 7.15 MiB 8.42 MiB 1.27 MiB
ba41c2a+dirty 7.15 MiB 8.42 MiB 1.26 MiB
6e8a851+dirty 7.15 MiB 8.42 MiB 1.26 MiB

Copy link
Collaborator

@lucas-zimerman lucas-zimerman left a comment

Choose a reason for hiding this comment

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

Looking good, LGTM!

@antonis antonis merged commit 8f9b963 into main Jul 17, 2025
109 of 114 checks passed
@antonis antonis deleted the antonis/skip-recording-on-background-span branch July 17, 2025 04:48
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.

2 participants