-
-
Notifications
You must be signed in to change notification settings - Fork 375
chore: Convert SentryFramesTrackingIntegration to Swift
#7044
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
base: main
Are you sure you want to change the base?
Changes from all commits
8ec937e
bafb623
37d602e
1437985
6985a35
f09049f
dcf1273
3b0e020
9a6b315
39337c0
fb98b73
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| @_implementationOnly import _SentryPrivate | ||
|
|
||
| #if (os(iOS) || os(tvOS) || os(visionOS)) && !SENTRY_NO_UIKIT | ||
|
|
||
| final class SentryFramesTrackingIntegration<Dependencies: FramesTrackingProvider>: NSObject, SwiftIntegration { | ||
| let tracker: SentryFramesTracker | ||
|
|
||
| init?(with options: Options, dependencies: Dependencies) { | ||
| // Check hybrid SDK mode first - if enabled, always start frames tracking | ||
| if !PrivateSentrySDKOnly.framesTrackingMeasurementHybridSDKMode { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like I forgot to remove the old code. |
||
|
|
||
| // Check if frames tracking should be enabled based on options | ||
| let performanceDisabled = !options.enableAutoPerformanceTracing || !options.isTracingEnabled | ||
| let appHangsDisabled = options.isAppHangTrackingDisabled() | ||
| let watchdogDisabled = !options.enableWatchdogTerminationTracking | ||
|
|
||
| // The watchdog tracker uses the frames tracker, so frame tracking | ||
| // must be enabled if watchdog tracking is enabled. | ||
| if performanceDisabled && appHangsDisabled && watchdogDisabled { | ||
| if appHangsDisabled { | ||
| SentrySDKLog.debug("Not going to enable \(Self.name) because enableAppHangTracking is disabled or the appHangTimeoutInterval is 0.") | ||
| } | ||
|
|
||
| if performanceDisabled { | ||
| SentrySDKLog.debug("Not going to enable \(Self.name) because enableAutoPerformanceTracing and isTracingEnabled are disabled.") | ||
| } | ||
|
|
||
| if watchdogDisabled { | ||
| SentrySDKLog.debug("Not going to enable \(Self.name) because enableWatchdogTerminationTracking is disabled.") | ||
| } | ||
|
|
||
| return nil | ||
| } | ||
| } | ||
|
|
||
| tracker = dependencies.framesTracker | ||
| tracker.start() | ||
| } | ||
|
|
||
| func uninstall() { | ||
| tracker.stop() | ||
| } | ||
|
|
||
| static var name: String { | ||
| "SentryFramesTrackingIntegration" | ||
| } | ||
| } | ||
|
|
||
| #endif | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Integration order change breaks frames tracker dependency
The conversion moves
SentryFramesTrackingIntegrationfrom ObjC integrations to Swift integrations, which changes when it's installed. Previously it was installed early, beforeSentryWatchdogTerminationTrackingIntegration. Now Swift integrations are installed after all ObjC integrations, so the frames tracker starts after the watchdog termination integration. SinceSentryANRTrackerV2(used by watchdog tracking) depends on the frames tracker to compute frame delays, callinggetFramesDelaySPIreturns-1whenisRunningisfalse, causing ANR detection to skip frames-based analysis until the Swift integrations complete installation. The comment in the old code states "the watchdog tracker uses the frames tracker, so frame tracking must be enabled if watchdog tracking is enabled."Additional Locations (1)
Sources/Sentry/SentrySDKInternal.m#L514-L517There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, worth checking out