Skip to content

Conversation

@buenaflor
Copy link
Contributor

@buenaflor buenaflor commented Feb 11, 2026

Summary

  • Adds a features list to SdkVersion (alongside integrations and packages) for additional SDK metadata
  • Reports SwiftPackageManager or CocoaPods as an SDK feature on iOS based on build type
  • Differentiates package name as spm:sentry-cocoa vs cocoapods:sentry-cocoa

This allows us to internally query usage data

Note: features metadata was introduced here getsentry/team-sdks#83 and is currently used in sentry cocoa as well

Motivation

Closes #3492

Test plan

  • SdkVersion serialization roundtrip (toJson/fromJson) includes features
  • addFeature() deduplication works correctly
  • LoadContextsIntegration merges native features into event SDK
  • Feature deduplication in event processor verified
  • Manual verification: SPM build shows "features": ["SwiftPackageManager"] in event payload
image

🤖 Generated with Claude Code

buenaflor and others added 3 commits February 11, 2026 17:45
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 11, 2026 16:46
@buenaflor buenaflor requested a review from denrase as a code owner February 11, 2026 16:46
@buenaflor buenaflor changed the title feat(flutter): Add SDK features metadata for SPM vs CocoaPods tracking internal(flutter): Add SDK features metadata for SPM vs CocoaPods tracking Feb 11, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds SDK build-time metadata support for tracking iOS integration type (Swift Package Manager vs CocoaPods) by introducing sdk.features and wiring it through Dart/Flutter and the native iOS plugin.

Changes:

  • Extend SdkVersion (Dart) with features, JSON (de)serialization, and addFeature() deduplication.
  • Merge native-reported features into the event SDK in LoadContextsIntegration.
  • Report iOS build type via native plugin (SwiftPackageManager vs CocoaPods) and adjust iOS package naming for SPM vs CocoaPods.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/flutter/test/integrations/load_contexts_integration_test.dart Adds coverage for merging/deduplicating sdk.features from native contexts.
packages/flutter/lib/src/sentry_flutter.dart Ensures features are preserved when the Flutter SDK info is set on options.
packages/flutter/lib/src/integrations/load_contexts_integration.dart Merges features from native loadContexts into event.sdk using addFeature().
packages/flutter/ios/sentry_flutter/Sources/sentry_flutter/SentryFlutterPlugin.swift Emits iOS feature (SwiftPackageManager/CocoaPods) and merges Flutter sdk.features into native event SDK.
packages/flutter/ios/sentry_flutter/Package.swift Defines SENTRY_FLUTTER_SPM for SwiftPM builds to drive conditional reporting.
packages/dart/test/protocol/sdk_version_test.dart Updates SDK JSON fixtures and adds tests for addFeature() dedup behavior.
packages/dart/lib/src/protocol/sdk_version.dart Introduces features field, serialization, and addFeature() helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@cursor cursor bot left a comment

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.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

Android Performance metrics 🚀

  Plain With Sentry Diff
Startup time 366.58 ms 348.67 ms -17.91 ms
Size 14.09 MiB 15.28 MiB 1.19 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
cba2765 405.98 ms 422.02 ms 16.04 ms
f872f8e 402.38 ms 416.20 ms 13.82 ms
e2d675d 457.92 ms 529.17 ms 71.25 ms
3f47ea3 368.20 ms 388.14 ms 19.94 ms
a2c8611 384.89 ms 371.41 ms -13.48 ms
f761369 462.73 ms 563.80 ms 101.06 ms
6f47800 451.04 ms 509.64 ms 58.60 ms
e04b24b 504.72 ms 516.43 ms 11.71 ms
a909995 383.55 ms 370.78 ms -12.77 ms
cf443d2 464.64 ms 479.04 ms 14.40 ms

App size

Revision Plain With Sentry Diff
cba2765 13.93 MiB 15.18 MiB 1.25 MiB
f872f8e 13.93 MiB 15.18 MiB 1.25 MiB
e2d675d 6.54 MiB 7.69 MiB 1.15 MiB
3f47ea3 13.93 MiB 15.18 MiB 1.25 MiB
a2c8611 14.09 MiB 15.28 MiB 1.19 MiB
f761369 6.54 MiB 7.70 MiB 1.16 MiB
6f47800 6.54 MiB 7.69 MiB 1.15 MiB
e04b24b 13.93 MiB 15.00 MiB 1.06 MiB
a909995 14.09 MiB 15.28 MiB 1.19 MiB
cf443d2 13.93 MiB 15.00 MiB 1.06 MiB

Previous results on branch: internal/spm-vs-cocoapods

Startup times

Revision Plain With Sentry Diff
07ddb75 371.33 ms 367.13 ms -4.20 ms
f361bc4 365.48 ms 368.48 ms 3.00 ms
67ee1b9 374.09 ms 363.98 ms -10.11 ms

App size

Revision Plain With Sentry Diff
07ddb75 14.09 MiB 15.28 MiB 1.19 MiB
f361bc4 14.09 MiB 15.28 MiB 1.19 MiB
67ee1b9 14.09 MiB 15.28 MiB 1.19 MiB

@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

iOS Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1242.87 ms 1244.40 ms 1.52 ms
Size 5.66 MiB 6.10 MiB 452.22 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
40c8f93 1234.27 ms 1261.98 ms 27.71 ms
e1ab497 1260.92 ms 1260.22 ms -0.69 ms
6b69699 1254.80 ms 1273.31 ms 18.52 ms
4ff8a1b 1233.71 ms 1240.21 ms 6.49 ms
3ddf010 1243.78 ms 1241.74 ms -2.04 ms
a5b28db 1260.16 ms 1260.08 ms -0.08 ms
e5b87f8 1257.94 ms 1261.90 ms 3.96 ms
73a3c38 1263.37 ms 1277.90 ms 14.53 ms
6f47800 1247.52 ms 1259.37 ms 11.85 ms
cf443d2 1255.79 ms 1248.38 ms -7.40 ms

App size

Revision Plain With Sentry Diff
40c8f93 5.53 MiB 6.00 MiB 479.94 KiB
e1ab497 5.53 MiB 6.01 MiB 487.96 KiB
6b69699 7.86 MiB 9.44 MiB 1.58 MiB
4ff8a1b 5.53 MiB 5.96 MiB 444.85 KiB
3ddf010 5.53 MiB 6.02 MiB 501.22 KiB
a5b28db 5.53 MiB 6.02 MiB 501.31 KiB
e5b87f8 5.53 MiB 6.02 MiB 502.11 KiB
73a3c38 7.86 MiB 9.44 MiB 1.58 MiB
6f47800 7.86 MiB 9.44 MiB 1.58 MiB
cf443d2 5.53 MiB 6.00 MiB 479.99 KiB

Previous results on branch: internal/spm-vs-cocoapods

Startup times

Revision Plain With Sentry Diff
67ee1b9 1247.71 ms 1255.29 ms 7.58 ms
07ddb75 1254.27 ms 1266.63 ms 12.37 ms
f361bc4 1248.24 ms 1254.13 ms 5.89 ms

App size

Revision Plain With Sentry Diff
67ee1b9 5.66 MiB 6.10 MiB 452.21 KiB
07ddb75 5.66 MiB 6.10 MiB 452.22 KiB
f361bc4 5.66 MiB 6.10 MiB 452.21 KiB

@buenaflor
Copy link
Contributor Author

e2e tests failing with 403 still, probably the auth token is invalid ..

Copy link
Collaborator

@denrase denrase left a comment

Choose a reason for hiding this comment

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

Just some questions regarding dedupe.

}
if let features = flutterSdk!["features"] as? [String] {
if let sdkFeatures = sdk["features"] as? [String] {
sdk["features"] = sdkFeatures + features
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if we even need this, but shouldn't we do de-duplication here as well?

Copy link
Contributor Author

@buenaflor buenaflor Feb 11, 2026

Choose a reason for hiding this comment

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

we can, I just didnt add it because theres almost no chance for a dupe to happen - imo we don't really need it

final sdk = event.sdk ?? _options.sdk;

for (final feature in features) {
sdk.addFeature(feature);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here should the merged de-duplication be done, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah when adding/merging to the dart features it already dedupes (addFeature only adds if unique)

expect(event?.sdk?.features.contains('SwiftPackageManager'), true);
});

test('does not duplicate feature if already present', () async {
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

@buenaflor buenaflor merged commit a920b0f into main Feb 12, 2026
141 checks passed
@buenaflor buenaflor deleted the internal/spm-vs-cocoapods branch February 12, 2026 16:30
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.

Investigate if it's possible to track SPM vs Cocoapods usage

2 participants