Skip to content

Tag all spans with thread info #3101

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

denrase
Copy link
Collaborator

@denrase denrase commented Jul 22, 2025

📜 Description

Tag all spans with thread info

  • Moves the lifecycle registry from client to options
  • Dispatch new OnSpanStart lifecycle event for tracer span creation
  • Adds integration to add "thread" (isolate) info

💡 Motivation and Context

Closes #2505

💚 How did you test it?

📝 Checklist

  • I reviewed submitted code
  • 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
  • All tests passing
  • No breaking changes

🔮 Next steps

Copy link

codecov bot commented Jul 22, 2025

Codecov Report

❌ Patch coverage is 92.50000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.79%. Comparing base (32914d8) to head (4c94418).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
flutter/lib/src/isolate_helper.dart 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3101      +/-   ##
==========================================
+ Coverage   87.66%   87.79%   +0.12%     
==========================================
  Files         288      290       +2     
  Lines        9813     9825      +12     
==========================================
+ Hits         8603     8626      +23     
+ Misses       1210     1199      -11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

github-actions bot commented Jul 22, 2025

Android Performance metrics 🚀

  Plain With Sentry Diff
Startup time 471.52 ms 535.24 ms 63.72 ms
Size 6.54 MiB 7.70 MiB 1.17 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
e2d675d 457.92 ms 529.17 ms 71.25 ms
93b7728 475.28 ms 489.13 ms 13.86 ms
640ad0c 466.00 ms 552.67 ms 86.67 ms
79f6b41 469.66 ms 525.90 ms 56.24 ms
575ebaa 478.00 ms 585.76 ms 107.76 ms
dbd526b 504.88 ms 569.02 ms 64.15 ms
73a3c38 478.18 ms 526.62 ms 48.44 ms
aeb02f2 373.84 ms 437.00 ms 63.16 ms
0fb3800 465.64 ms 536.77 ms 71.13 ms
9b99523 456.91 ms 490.55 ms 33.64 ms

App size

Revision Plain With Sentry Diff
e2d675d 6.54 MiB 7.69 MiB 1.15 MiB
93b7728 6.54 MiB 7.69 MiB 1.15 MiB
640ad0c 6.54 MiB 7.69 MiB 1.15 MiB
79f6b41 6.54 MiB 7.69 MiB 1.15 MiB
575ebaa 6.54 MiB 7.69 MiB 1.15 MiB
dbd526b 6.54 MiB 7.69 MiB 1.15 MiB
73a3c38 6.54 MiB 7.69 MiB 1.15 MiB
aeb02f2 6.54 MiB 7.69 MiB 1.15 MiB
0fb3800 6.54 MiB 7.69 MiB 1.15 MiB
9b99523 6.54 MiB 7.69 MiB 1.15 MiB

Previous results on branch: enha/add-isolate-info-to-spans

Startup times

Revision Plain With Sentry Diff
882bc32 482.24 ms 560.18 ms 77.94 ms

App size

Revision Plain With Sentry Diff
882bc32 6.54 MiB 7.70 MiB 1.17 MiB

Copy link
Contributor

github-actions bot commented Jul 24, 2025

iOS Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1261.71 ms 1262.76 ms 1.05 ms
Size 7.86 MiB 9.44 MiB 1.58 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
dbd526b 1244.78 ms 1259.02 ms 14.24 ms
73dca78 1246.65 ms 1265.42 ms 18.76 ms
6ba4675 1223.12 ms 1238.17 ms 15.04 ms
ec78888 1251.37 ms 1269.40 ms 18.04 ms
0fb45d0 1273.24 ms 1286.44 ms 13.19 ms
2cf9161 1248.33 ms 1266.55 ms 18.22 ms
b6c8720 1252.65 ms 1266.61 ms 13.96 ms
93b7728 1247.23 ms 1264.87 ms 17.64 ms
2d34233 1258.19 ms 1268.92 ms 10.73 ms
6f47800 1247.52 ms 1259.37 ms 11.85 ms

App size

Revision Plain With Sentry Diff
dbd526b 7.86 MiB 9.44 MiB 1.58 MiB
73dca78 7.86 MiB 9.44 MiB 1.58 MiB
6ba4675 7.86 MiB 9.44 MiB 1.58 MiB
ec78888 7.86 MiB 9.44 MiB 1.58 MiB
0fb45d0 7.86 MiB 9.44 MiB 1.58 MiB
2cf9161 7.86 MiB 9.44 MiB 1.58 MiB
b6c8720 7.86 MiB 9.44 MiB 1.58 MiB
93b7728 7.86 MiB 9.44 MiB 1.58 MiB
2d34233 7.86 MiB 9.44 MiB 1.58 MiB
6f47800 7.86 MiB 9.44 MiB 1.58 MiB

Previous results on branch: enha/add-isolate-info-to-spans

Startup times

Revision Plain With Sentry Diff
882bc32 1247.79 ms 1270.38 ms 22.59 ms

App size

Revision Plain With Sentry Diff
882bc32 7.86 MiB 9.44 MiB 1.58 MiB

@denrase denrase marked this pull request as ready for review July 28, 2025 15:04
@denrase denrase requested a review from stefanosiano as a code owner July 28, 2025 15:04
@denrase denrase requested a review from buenaflor July 28, 2025 15:04
Copy link
Contributor

@buenaflor buenaflor left a comment

Choose a reason for hiding this comment

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

nice 👍

tbh I don't like it so much that we are using the options for storing everything but I guess it's a convention now in this codebase

Comment on lines +441 to +443
Future<void> _dispatchOnSpanStart(ISentrySpan span) async {
await _hub.options.lifecycleRegistry.dispatchCallback(OnSpanStart(span));
}
Copy link
Contributor

@buenaflor buenaflor Jul 28, 2025

Choose a reason for hiding this comment

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

can we return void and remove the async? we are awaiting here but call unawaited when calling _dispatchOnSpanStart so we could just remove async altogether

Comment on lines +75 to +80
@internal
class OnSpanStart extends SdkLifecycleEvent {
OnSpanStart(this.span);

final ISentrySpan span;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment that this triggers only for sampled spans

/// information to spans when they are started.
@internal
class ThreadInfoIntegration implements Integration<SentryFlutterOptions> {
static const integrationName = 'ThreadInfoIntegration';
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
static const integrationName = 'ThreadInfoIntegration';
static const integrationName = 'ThreadInfo';

from now on this should be wtihout the integration suffix

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.

Tag all spans with thread info
2 participants