Skip to content

Commit 36c0d1a

Browse files
authored
feat: Move enableFileManagerSwizzling and enableDataSwizzling to top-level options (#6592)
1 parent 45e9fb1 commit 36c0d1a

18 files changed

+212
-198
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828

2929
- Add SentryDistribution as Swift Package Manager target (#6149)
3030
- Add option `enablePropagateTraceparent` to support OTel/W3C trace propagation (#6356)
31+
- Move `enableFileManagerSwizzling` from experimental options to top-level options (#6592).
32+
This option is still disabled by default and will be enabled in a future major release.
33+
- Move `enableDataSwizzling` from experimental options to top-level options (#6592). This option remains enabled by default.
3134

3235
### Fixes
3336

Samples/SentrySampleShared/SentrySampleShared/SentrySDKWrapper.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public struct SentrySDKWrapper {
161161
options.enableLogs = true
162162

163163
// Experimental features
164-
options.experimental.enableFileManagerSwizzling = !SentrySDKOverrides.Other.disableFileManagerSwizzling.boolValue
164+
options.enableFileManagerSwizzling = !SentrySDKOverrides.Other.disableFileManagerSwizzling.boolValue
165165
options.experimental.enableUnhandledCPPExceptionsV2 = true
166166
}
167167

Samples/iOS-ObjectiveC/iOS-ObjectiveC/AppDelegate.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ - (BOOL)application:(UIApplication *)application
6363
enableViewRendererV2:![args containsObject:@"--disable-view-renderer-v2"]
6464
enableFastViewRendering:![args containsObject:@"--disable-fast-view-rendering"]];
6565

66-
options.experimental.enableFileManagerSwizzling
66+
options.enableFileManagerSwizzling
6767
= ![args containsObject:@"--disable-filemanager-swizzling"];
6868

6969
options.initialScope = ^(SentryScope *scope) {

Sources/Sentry/Public/SentryOptions.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,20 @@ NS_SWIFT_NAME(Options)
407407
*/
408408
@property (nonatomic, assign) BOOL enableFileIOTracing;
409409

410+
/**
411+
* When enabled, the SDK tracks performance for file IO reads and writes with NSData if auto
412+
* performance tracking and enableSwizzling are enabled.
413+
* @note The default is @c YES .
414+
*/
415+
@property (nonatomic, assign) BOOL enableDataSwizzling;
416+
417+
/**
418+
* When enabled, the SDK tracks performance for file IO operations with NSFileManager if auto
419+
* performance tracking and enableSwizzling are enabled.
420+
* @note The default is @c NO .
421+
*/
422+
@property (nonatomic, assign) BOOL enableFileManagerSwizzling;
423+
410424
/**
411425
* Indicates the percentage of the tracing data that is collected.
412426
* @discussion Specifying @c 0 or @c nil discards all trace data, @c 1.0 collects all trace data,

Sources/Sentry/SentryNSDataSwizzling.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ - (void)startWithOptions:(SentryOptions *)options tracker:(SentryFileIOTracker *
3030
return;
3131
}
3232

33-
if (!options.experimental.enableDataSwizzling) {
33+
if (!options.enableDataSwizzling) {
3434
SENTRY_LOG_DEBUG(
3535
@"Auto-tracking of NSData is disabled because enableDataSwizzling is false");
3636
return;

Sources/Sentry/SentryNSFileManagerSwizzling.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ - (void)startWithOptions:(SentryOptions *)options tracker:(SentryFileIOTracker *
3131
return;
3232
}
3333

34-
if (!options.experimental.enableFileManagerSwizzling) {
34+
if (!options.enableFileManagerSwizzling) {
3535
SENTRY_LOG_DEBUG(@"Auto-tracking of NSFileManager is disabled because "
3636
@"enableFileManagerSwizzling is false");
3737
return;

Sources/Sentry/SentryOptions.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ - (instancetype)init
113113
self.enablePropagateTraceparent = NO;
114114
self.enableNetworkTracking = YES;
115115
self.enableFileIOTracing = YES;
116+
self.enableFileManagerSwizzling = NO;
117+
self.enableDataSwizzling = YES;
116118
self.enableNetworkBreadcrumbs = YES;
117119
self.enableLogs = NO;
118120
self.tracesSampleRate = nil;

Sources/Swift/Helper/SentryEnabledFeaturesBuilder.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ import Foundation
3636
}
3737
#endif // (os(iOS) || os(tvOS)) && !SENTRY_NO_UIKIT
3838

39-
if options.experimental.enableDataSwizzling {
39+
if options.enableDataSwizzling {
4040
features.append("dataSwizzling")
4141
}
42-
if options.experimental.enableFileManagerSwizzling {
42+
if options.enableFileManagerSwizzling {
4343
features.append("fileManagerSwizzling")
4444
}
4545
if options.experimental.enableUnhandledCPPExceptionsV2 {

Sources/Swift/Integrations/Performance/IO/Data+SentryTracing.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public extension Data {
1313
///
1414
/// - Important: Using this method with auto-instrumentation for file operations enabled can lead to duplicate spans on older operating system versions.
1515
/// It is recommended to use either automatic or manual instrumentation. You can disable automatic instrumentation by setting
16-
/// `options.experimental.enableDataSwizzling` to `false` when initializing Sentry.
16+
/// `options.enableDataSwizzling` to `false` when initializing Sentry.
1717
/// - Parameters:
1818
/// - url: The location on disk of the data to read.
1919
/// - options: The mask specifying the options to use when reading the data. For more information, see ``NSData.ReadingOptions``.
@@ -44,7 +44,7 @@ public extension Data {
4444
///
4545
/// - Important: Using this method with auto-instrumentation for file operations enabled can lead to duplicate spans on older operating system versions.
4646
/// It is recommended to use either automatic or manual instrumentation. You can disable automatic instrumentation by setting
47-
/// `options.experimental.enableDataSwizzling` to `false` when initializing Sentry.
47+
/// `options.enableDataSwizzling` to `false` when initializing Sentry.
4848
/// - Parameters:
4949
/// - url: The location to write the data into.
5050
/// - options: Options for writing the data. Default value is `[]`.

Sources/Swift/Integrations/Performance/IO/FileManager+SentryTracing.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public extension FileManager {
1414
///
1515
/// - Important: Using this method with auto-instrumentation for file operations enabled can lead to duplicate spans on older operating system versions.
1616
/// It is recommended to use either automatic or manual instrumentation. You can disable automatic instrumentation by setting
17-
/// `options.experimental.enableFileManagerSwizzling` to `false` when initializing Sentry.
17+
/// `options.enableFileManagerSwizzling` to `false` when initializing Sentry.
1818
/// - Parameters:
1919
/// - path: The path for the new file.
2020
/// - data: A data object containing the contents of the new file.
@@ -48,7 +48,7 @@ public extension FileManager {
4848
///
4949
/// - Important: Using this method with auto-instrumentation for file operations enabled can lead to duplicate spans on older operating system versions.
5050
/// It is recommended to use either automatic or manual instrumentation. You can disable automatic instrumentation by setting
51-
/// `options.experimental.enableFileManagerSwizzling` to `false` when initializing Sentry.
51+
/// `options.enableFileManagerSwizzling` to `false` when initializing Sentry.
5252
/// - Parameter url: A file URL specifying the file or directory to remove.
5353
/// If the URL specifies a directory, the contents of that directory are recursively removed.
5454
/// - Note: See ``FileManager.removeItem(at:)`` for more information.
@@ -73,7 +73,7 @@ public extension FileManager {
7373
///
7474
/// - Important: Using this method with auto-instrumentation for file operations enabled can lead to duplicate spans on older operating system versions.
7575
/// It is recommended to use either automatic or manual instrumentation. You can disable automatic instrumentation by setting
76-
/// `options.experimental.enableFileManagerSwizzling` to `false` when initializing Sentry.
76+
/// `options.enableFileManagerSwizzling` to `false` when initializing Sentry.
7777
/// - Parameter path: A path string indicating the file or directory to remove.
7878
/// If the path specifies a directory, the contents of that directory are recursively removed.
7979
/// - Note: See ``FileManager.removeItem(atPath:)`` for more information.
@@ -100,7 +100,7 @@ public extension FileManager {
100100
///
101101
/// - Important: Using this method with auto-instrumentation for file operations enabled can lead to duplicate spans on older operating system versions.
102102
/// It is recommended to use either automatic or manual instrumentation. You can disable automatic instrumentation by setting
103-
/// `options.experimental.enableFileManagerSwizzling` to `false` when initializing Sentry.
103+
/// `options.enableFileManagerSwizzling` to `false` when initializing Sentry.
104104
/// - Parameters:
105105
/// - srcURL: The file URL that identifies the file you want to copy.
106106
/// The URL in this parameter must not be a file reference URL.
@@ -128,7 +128,7 @@ public extension FileManager {
128128
///
129129
/// - Important: Using this method with auto-instrumentation for file operations enabled can lead to duplicate spans on older operating system versions.
130130
/// It is recommended to use either automatic or manual instrumentation. You can disable automatic instrumentation by setting
131-
/// `options.experimental.enableFileManagerSwizzling` to `false` when initializing Sentry.
131+
/// `options.enableFileManagerSwizzling` to `false` when initializing Sentry.
132132
/// - Parameters:
133133
/// - srcPath: The path to the file or directory you want to move.
134134
/// - dstPath: The path at which to place the copy of `srcPath`.
@@ -155,7 +155,7 @@ public extension FileManager {
155155
///
156156
/// - Important: Using this method with auto-instrumentation for file operations enabled can lead to duplicate spans on older operating system versions.
157157
/// It is recommended to use either automatic or manual instrumentation. You can disable automatic instrumentation by setting
158-
/// `options.experimental.enableFileManagerSwizzling` to `false` when initializing Sentry.
158+
/// `options.enableFileManagerSwizzling` to `false` when initializing Sentry.
159159
/// - Parameters:
160160
/// - srcURL: The file URL that identifies the file or directory you want to move.
161161
/// The URL in this parameter must not be a file reference URL.
@@ -188,7 +188,7 @@ public extension FileManager {
188188
///
189189
/// - Important: Using this method with auto-instrumentation for file operations enabled can lead to duplicate spans on older operating system versions.
190190
/// It is recommended to use either automatic or manual instrumentation. You can disable automatic instrumentation by setting
191-
/// `options.experimental.enableFileManagerSwizzling` to `false` when initializing Sentry.
191+
/// `options.enableFileManagerSwizzling` to `false` when initializing Sentry.
192192
/// - Parameters:
193193
/// - srcPath: The path to the file or directory you want to move.
194194
/// - dstPath: The new path for the item in `srcPath`.

0 commit comments

Comments
 (0)