Skip to content

feat: Add feature flags to hub span#3806

Merged
denrase merged 16 commits into
mainfrom
feat/span-feature-flags
Jul 6, 2026
Merged

feat: Add feature flags to hub span#3806
denrase merged 16 commits into
mainfrom
feat/span-feature-flags

Conversation

@denrase

@denrase denrase commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

📜 Description

Adds feature flag evaluations to the currently active span through the hub when using Sentry.addFeatureFlag(...), without exposing feature flag APIs on spans directly.

💡 Motivation and Context

Closes #3766

💚 How did you test it?

Unit tests.

📝 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

denrase added 2 commits June 29, 2026 14:49
Fixes scope feature flag updates so existing flags are refreshed as the newest entry before enforcing the 100-entry limit. This prevents full-buffer updates from dropping unrelated flags or shrinking the buffer, and adds regression coverage for the 100 most recent unique flags behavior.
Adds direct feature flag APIs to span-v2 spans, including add/remove support, span-local limit handling, and forwarding from Sentry.addFeatureFlag to the active span.
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Features

  • Add feature flags to hub span by denrase in #3806

🤖 This preview updates automatically when you update the PR.

@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.44444% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.35%. Comparing base (4a02518) to head (feadc54).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ckages/dart/lib/src/feature_flags_integration.dart 93.93% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3806      +/-   ##
==========================================
+ Coverage   87.22%   87.35%   +0.13%     
==========================================
  Files         338      338              
  Lines       12250    12283      +33     
==========================================
+ Hits        10685    10730      +45     
+ Misses       1565     1553      -12     
Flag Coverage Δ
sentry 87.48% <94.44%> (+0.24%) ⬆️
sentry_dio 97.73% <ø> (ø)
sentry_drift 93.57% <ø> (ø)
sentry_file 65.29% <ø> (ø)
sentry_firebase_remote_config 100.00% <ø> (ø)
sentry_flutter 91.10% <ø> (ø)
sentry_grpc 99.09% <ø> (ø)
sentry_hive 77.48% <ø> (ø)
sentry_isar 74.37% <ø> (ø)
sentry_link 21.50% <ø> (ø)
sentry_logging 97.01% <ø> (ø)
sentry_sqflite 88.81% <ø> (ø)
sentry_supabase 97.27% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Comment thread packages/dart/lib/src/telemetry/span/recording_sentry_span_v2.dart Outdated
Comment thread packages/dart/lib/src/telemetry/span/sentry_span_v2.dart Outdated
@denrase
denrase marked this pull request as ready for review June 30, 2026 09:15
@denrase denrase changed the title feat: Add feature flag API to spans feat: Add feature flags to active spans Jun 30, 2026
@denrase denrase changed the title feat: Add feature flags to active spans feat: Add feature flags to hub span Jun 30, 2026
@denrase
denrase requested a review from buenaflor June 30, 2026 13:47
Comment thread packages/dart/test/feature_flags_integration_test.dart

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 234b2fa. Configure here.

Comment thread packages/dart/lib/src/feature_flags_integration.dart
Base automatically changed from fix/scope-feature-flags to main June 30, 2026 16:04
# Conflicts:
#	packages/dart/lib/src/feature_flags_integration.dart
#	packages/dart/test/feature_flags_integration_test.dart
@buenaflor

Copy link
Copy Markdown
Contributor

There are some failing tests

denrase added 2 commits July 3, 2026 12:01
# Conflicts:
#	packages/dart/lib/src/constants.dart
@denrase
denrase requested a review from buenaflor July 3, 2026 10:36
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

iOS Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1249.43 ms 1252.33 ms 2.90 ms
Size 5.83 MiB 6.28 MiB 460.42 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
640ad0c 1241.04 ms 1253.96 ms 12.92 ms
f11c8f8 1252.43 ms 1250.17 ms -2.25 ms
a7f011a 1247.40 ms 1255.72 ms 8.32 ms
d0aa4b6 1268.23 ms 1268.39 ms 0.15 ms
9d516f3 1256.04 ms 1262.70 ms 6.66 ms
bfabaf2 1251.72 ms 1253.38 ms 1.67 ms
98b29fe 1254.87 ms 1259.38 ms 4.51 ms
737ef5d 1255.65 ms 1252.24 ms -3.41 ms
584a4b7 1235.62 ms 1233.62 ms -2.00 ms
40c8f93 1234.27 ms 1261.98 ms 27.71 ms

App size

Revision Plain With Sentry Diff
640ad0c 7.86 MiB 9.44 MiB 1.58 MiB
f11c8f8 5.83 MiB 6.28 MiB 462.27 KiB
a7f011a 5.73 MiB 6.17 MiB 455.50 KiB
d0aa4b6 5.53 MiB 6.02 MiB 502.04 KiB
9d516f3 5.73 MiB 6.18 MiB 463.54 KiB
bfabaf2 5.53 MiB 6.01 MiB 487.95 KiB
98b29fe 5.83 MiB 6.28 MiB 459.63 KiB
737ef5d 5.73 MiB 6.18 MiB 466.16 KiB
584a4b7 5.66 MiB 6.10 MiB 451.31 KiB
40c8f93 5.53 MiB 6.00 MiB 479.94 KiB

Previous results on branch: feat/span-feature-flags

Startup times

Revision Plain With Sentry Diff
a132e96 1256.71 ms 1263.96 ms 7.24 ms
6f8b651 1251.38 ms 1257.29 ms 5.92 ms
234b2fa 1257.63 ms 1247.62 ms -10.01 ms
a7d992a 1236.11 ms 1236.90 ms 0.79 ms

App size

Revision Plain With Sentry Diff
a132e96 5.83 MiB 6.28 MiB 459.63 KiB
6f8b651 5.83 MiB 6.28 MiB 459.63 KiB
234b2fa 5.83 MiB 6.28 MiB 459.63 KiB
a7d992a 5.83 MiB 6.28 MiB 459.63 KiB

@denrase
denrase merged commit c652e19 into main Jul 6, 2026
164 of 166 checks passed
@denrase
denrase deleted the feat/span-feature-flags branch July 6, 2026 09:27
buenaflor added a commit that referenced this pull request Jul 6, 2026
…eature-flags-hub-based

Resolves conflicts with #3806 (feature flags on active spans), which
landed on the removed FeatureFlagsIntegration:

- Span forwarding (flag.evaluation.* attributes, 10-per-span cap) moves
  into Hub.addFeatureFlag, ahead of the scope buffer delegation.
- The scope buffer fix from #3806 was already implemented in
  Scope.addFeatureFlag, no change needed.
- Span tests from feature_flags_integration_test.dart are ported to
  hub_test.dart against the real Hub; end-to-end tests merged into
  sentry_test.dart unchanged.

Co-Authored-By: Claude Fable 5 <[email protected]>
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.

Feature flags not tracked on spans (spec gap)

2 participants