Skip to content

chore: Add tracking for feature flags - #8678

Draft
denrase wants to merge 4 commits into
mainfrom
chore/add-tracking-for-feature-flags
Draft

denrase wants to merge 4 commits into
mainfrom
chore/add-tracking-for-feature-flags

Conversation

@denrase

@denrase denrase commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

#skip-changelog

📜 Description

Track runtime use of the manual feature flag APIs by adding featureFlags to sdk.features after the API is used.

Runtime-discovered feature flag usage is stored internally and thread-safely on the active SDK options, then merged with the existing option-derived features when SDK metadata is built.

💡 Motivation and Context

We want internal telemetry showing actual feature flag API adoption, matching the behavior in sentry-flutter. Inferring this at SDK initialization is not possible because feature flags are enabled through runtime API usage.

Closes #8594

💚 How did you test it?

📝 Checklist

  • 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.
  • I updated the wizard 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.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.
  • If I added a new public API, I also added it to the SentryObjC wrapper.

denrase added 2 commits August 4, 2026 18:21
Record manual feature flag API usage as `featureFlags` in the active SDK options. Merge dynamically discovered features into `sdk.features` for subsequent events and envelope headers.

Keep the tracking internal and thread-safe. This is a best effort, we do not handle uninitialized sdk and crashed events.
@denrase denrase changed the title Chore/add tracking for feature flags chore: Add tracking for feature flags Aug 4, 2026
@denrase denrase self-assigned this Aug 4, 2026
@denrase denrase added the run-full-ci Allows gated GitHub Action workflows to run for a labelled pull request label Aug 4, 2026
@denrase
denrase marked this pull request as ready for review August 4, 2026 16:32
@sentry

sentry Bot commented Aug 4, 2026

Copy link
Copy Markdown

📲 Install Builds

iOS

🔗 App Name App ID Version Configuration
SDK-Size io.sentry.sample.SDK-Size 9.25.0 (1) Release

⚙️ sentry-cocoa Build Distribution Settings

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1211.74 ms 1255.93 ms 44.19 ms
Size 24.14 KiB 1.27 MiB 1.25 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
6beeea8 1220.50 ms 1253.93 ms 33.43 ms
5a9c804 1220.29 ms 1255.17 ms 34.88 ms
2ce4807 1220.52 ms 1254.02 ms 33.50 ms
b69e199 1210.45 ms 1251.13 ms 40.68 ms
35901c8 1217.02 ms 1259.13 ms 42.11 ms
3b7d81f 1220.53 ms 1239.06 ms 18.53 ms
871ce4d 1223.43 ms 1257.17 ms 33.75 ms
a879c92 1229.37 ms 1262.33 ms 32.97 ms
fc5cefc 1222.44 ms 1254.20 ms 31.77 ms
56dbf49 1236.41 ms 1261.31 ms 24.89 ms

App size

Revision Plain With Sentry Diff
6beeea8 24.14 KiB 1.23 MiB 1.21 MiB
5a9c804 24.14 KiB 1.15 MiB 1.13 MiB
2ce4807 24.14 KiB 1.23 MiB 1.20 MiB
b69e199 24.14 KiB 1.24 MiB 1.22 MiB
35901c8 24.14 KiB 1.24 MiB 1.21 MiB
3b7d81f 24.14 KiB 1.22 MiB 1.20 MiB
871ce4d 24.14 KiB 1.22 MiB 1.20 MiB
a879c92 24.14 KiB 1.25 MiB 1.23 MiB
fc5cefc 24.14 KiB 1.17 MiB 1.14 MiB
56dbf49 24.14 KiB 1.27 MiB 1.25 MiB

Previous results on branch: chore/add-tracking-for-feature-flags

Startup times

Revision Plain With Sentry Diff
bbe0e31 1227.21 ms 1260.16 ms 32.95 ms
af59095 1215.42 ms 1254.00 ms 38.58 ms

App size

Revision Plain With Sentry Diff
bbe0e31 24.14 KiB 1.27 MiB 1.24 MiB
af59095 24.14 KiB 1.27 MiB 1.25 MiB

@itaybre itaybre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems a bit over engineered, at this moment I believe a simple boolean flag would be simpler and if we end up with other features like this we can build the set logic

@denrase

denrase commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

@itaybre Thought I add something generic as we track multiple runtime values in flutter and it's easy to query this data, but we can also do it simpy and then expand if needed.

@denrase
denrase marked this pull request as draft August 5, 2026 07:24
@denrase
denrase marked this pull request as ready for review August 5, 2026 11:54
@denrase
denrase requested a review from itaybre August 5, 2026 11:54
@philippsuess

Copy link
Copy Markdown
Contributor

I agree with @itaybre. We already sent this information with the events. We pull the features list from the scope. I tried to get that info in Hex, but we don't index that info yet.

@itaybre I think we should talk to the data team and ask them to index this, so we see how many projects and orgs use this. Maybe also numbers on how many events have feature flags and how many would be useful, but mostly how many orgs and projects. As I'm on PTO soon, @itaybre or @denrase, could you maybe talk to the data team so we get this info?

Then we could close this PR.

@denrase

denrase commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator Author

@philipphofmann Will do, putting this in draft/blocked for now until we have an aswer.

@denrase denrase added the Blocked label Aug 7, 2026
@denrase
denrase marked this pull request as draft August 11, 2026 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Blocked run-full-ci Allows gated GitHub Action workflows to run for a labelled pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tracking for feature flags

3 participants