Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@

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

### Fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public struct SentrySDKWrapper {
options.enableLogs = true

// Experimental features
options.experimental.enableFileManagerSwizzling = !SentrySDKOverrides.Other.disableFileManagerSwizzling.boolValue
options.enableFileManagerSwizzling = !SentrySDKOverrides.Other.disableFileManagerSwizzling.boolValue
options.experimental.enableUnhandledCPPExceptionsV2 = true
}

Expand Down
2 changes: 1 addition & 1 deletion Samples/iOS-ObjectiveC/iOS-ObjectiveC/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ - (BOOL)application:(UIApplication *)application
enableViewRendererV2:![args containsObject:@"--disable-view-renderer-v2"]
enableFastViewRendering:![args containsObject:@"--disable-fast-view-rendering"]];

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

options.initialScope = ^(SentryScope *scope) {
Expand Down
14 changes: 14 additions & 0 deletions Sources/Sentry/Public/SentryOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,20 @@ NS_SWIFT_NAME(Options)
*/
@property (nonatomic, assign) BOOL enableFileIOTracing;

/**
* When enabled, the SDK tracks performance for file IO reads and writes with NSData if auto
* performance tracking and enableSwizzling are enabled.
* @note The default is @c YES .
*/
@property (nonatomic, assign) BOOL enableDataSwizzling;

/**
* When enabled, the SDK tracks performance for file IO operations with NSFileManager if auto
* performance tracking and enableSwizzling are enabled.
* @note The default is @c NO .
*/
@property (nonatomic, assign) BOOL enableFileManagerSwizzling;

/**
* Indicates the percentage of the tracing data that is collected.
* @discussion Specifying @c 0 or @c nil discards all trace data, @c 1.0 collects all trace data,
Expand Down
2 changes: 1 addition & 1 deletion Sources/Sentry/SentryNSDataSwizzling.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ - (void)startWithOptions:(SentryOptions *)options tracker:(SentryFileIOTracker *
return;
}

if (!options.experimental.enableDataSwizzling) {
if (!options.enableDataSwizzling) {
SENTRY_LOG_DEBUG(
@"Auto-tracking of NSData is disabled because enableDataSwizzling is false");
return;
Expand Down
2 changes: 1 addition & 1 deletion Sources/Sentry/SentryNSFileManagerSwizzling.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ - (void)startWithOptions:(SentryOptions *)options tracker:(SentryFileIOTracker *
return;
}

if (!options.experimental.enableFileManagerSwizzling) {
if (!options.enableFileManagerSwizzling) {
SENTRY_LOG_DEBUG(@"Auto-tracking of NSFileManager is disabled because "
@"enableFileManagerSwizzling is false");
return;
Expand Down
2 changes: 2 additions & 0 deletions Sources/Sentry/SentryOptions.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ - (instancetype)init
self.enablePropagateTraceparent = NO;
self.enableNetworkTracking = YES;
self.enableFileIOTracing = YES;
self.enableFileManagerSwizzling = NO;
self.enableDataSwizzling = YES;
self.enableNetworkBreadcrumbs = YES;
self.enableLogs = NO;
self.tracesSampleRate = nil;
Expand Down
4 changes: 2 additions & 2 deletions Sources/Swift/Helper/SentryEnabledFeaturesBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ import Foundation
}
#endif // (os(iOS) || os(tvOS)) && !SENTRY_NO_UIKIT

if options.experimental.enableDataSwizzling {
if options.enableDataSwizzling {
features.append("dataSwizzling")
}
if options.experimental.enableFileManagerSwizzling {
if options.enableFileManagerSwizzling {
features.append("fileManagerSwizzling")
}
if options.experimental.enableUnhandledCPPExceptionsV2 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public extension Data {
///
/// - Important: Using this method with auto-instrumentation for file operations enabled can lead to duplicate spans on older operating system versions.
/// It is recommended to use either automatic or manual instrumentation. You can disable automatic instrumentation by setting
/// `options.experimental.enableDataSwizzling` to `false` when initializing Sentry.
/// `options.enableDataSwizzling` to `false` when initializing Sentry.
/// - Parameters:
/// - url: The location on disk of the data to read.
/// - options: The mask specifying the options to use when reading the data. For more information, see ``NSData.ReadingOptions``.
Expand Down Expand Up @@ -44,7 +44,7 @@ public extension Data {
///
/// - Important: Using this method with auto-instrumentation for file operations enabled can lead to duplicate spans on older operating system versions.
/// It is recommended to use either automatic or manual instrumentation. You can disable automatic instrumentation by setting
/// `options.experimental.enableDataSwizzling` to `false` when initializing Sentry.
/// `options.enableDataSwizzling` to `false` when initializing Sentry.
/// - Parameters:
/// - url: The location to write the data into.
/// - options: Options for writing the data. Default value is `[]`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public extension FileManager {
///
/// - Important: Using this method with auto-instrumentation for file operations enabled can lead to duplicate spans on older operating system versions.
/// It is recommended to use either automatic or manual instrumentation. You can disable automatic instrumentation by setting
/// `options.experimental.enableFileManagerSwizzling` to `false` when initializing Sentry.
/// `options.enableFileManagerSwizzling` to `false` when initializing Sentry.
/// - Parameters:
/// - path: The path for the new file.
/// - data: A data object containing the contents of the new file.
Expand Down Expand Up @@ -48,7 +48,7 @@ public extension FileManager {
///
/// - Important: Using this method with auto-instrumentation for file operations enabled can lead to duplicate spans on older operating system versions.
/// It is recommended to use either automatic or manual instrumentation. You can disable automatic instrumentation by setting
/// `options.experimental.enableFileManagerSwizzling` to `false` when initializing Sentry.
/// `options.enableFileManagerSwizzling` to `false` when initializing Sentry.
/// - Parameter url: A file URL specifying the file or directory to remove.
/// If the URL specifies a directory, the contents of that directory are recursively removed.
/// - Note: See ``FileManager.removeItem(at:)`` for more information.
Expand All @@ -73,7 +73,7 @@ public extension FileManager {
///
/// - Important: Using this method with auto-instrumentation for file operations enabled can lead to duplicate spans on older operating system versions.
/// It is recommended to use either automatic or manual instrumentation. You can disable automatic instrumentation by setting
/// `options.experimental.enableFileManagerSwizzling` to `false` when initializing Sentry.
/// `options.enableFileManagerSwizzling` to `false` when initializing Sentry.
/// - Parameter path: A path string indicating the file or directory to remove.
/// If the path specifies a directory, the contents of that directory are recursively removed.
/// - Note: See ``FileManager.removeItem(atPath:)`` for more information.
Expand All @@ -100,7 +100,7 @@ public extension FileManager {
///
/// - Important: Using this method with auto-instrumentation for file operations enabled can lead to duplicate spans on older operating system versions.
/// It is recommended to use either automatic or manual instrumentation. You can disable automatic instrumentation by setting
/// `options.experimental.enableFileManagerSwizzling` to `false` when initializing Sentry.
/// `options.enableFileManagerSwizzling` to `false` when initializing Sentry.
/// - Parameters:
/// - srcURL: The file URL that identifies the file you want to copy.
/// The URL in this parameter must not be a file reference URL.
Expand Down Expand Up @@ -128,7 +128,7 @@ public extension FileManager {
///
/// - Important: Using this method with auto-instrumentation for file operations enabled can lead to duplicate spans on older operating system versions.
/// It is recommended to use either automatic or manual instrumentation. You can disable automatic instrumentation by setting
/// `options.experimental.enableFileManagerSwizzling` to `false` when initializing Sentry.
/// `options.enableFileManagerSwizzling` to `false` when initializing Sentry.
/// - Parameters:
/// - srcPath: The path to the file or directory you want to move.
/// - dstPath: The path at which to place the copy of `srcPath`.
Expand All @@ -155,7 +155,7 @@ public extension FileManager {
///
/// - Important: Using this method with auto-instrumentation for file operations enabled can lead to duplicate spans on older operating system versions.
/// It is recommended to use either automatic or manual instrumentation. You can disable automatic instrumentation by setting
/// `options.experimental.enableFileManagerSwizzling` to `false` when initializing Sentry.
/// `options.enableFileManagerSwizzling` to `false` when initializing Sentry.
/// - Parameters:
/// - srcURL: The file URL that identifies the file or directory you want to move.
/// The URL in this parameter must not be a file reference URL.
Expand Down Expand Up @@ -188,7 +188,7 @@ public extension FileManager {
///
/// - Important: Using this method with auto-instrumentation for file operations enabled can lead to duplicate spans on older operating system versions.
/// It is recommended to use either automatic or manual instrumentation. You can disable automatic instrumentation by setting
/// `options.experimental.enableFileManagerSwizzling` to `false` when initializing Sentry.
/// `options.enableFileManagerSwizzling` to `false` when initializing Sentry.
/// - Parameters:
/// - srcPath: The path to the file or directory you want to move.
/// - dstPath: The new path for the item in `srcPath`.
Expand Down
19 changes: 0 additions & 19 deletions Sources/Swift/SentryExperimentalOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,6 @@ import Foundation

@objcMembers
public final class SentryExperimentalOptions: NSObject {
/**
* Enables swizzling of`NSData` to automatically track file operations.
*
* - Note: Swizzling is enabled by setting ``SentryOptions.enableSwizzling`` to `true`.
* This option allows you to disable swizzling for `NSData` only, while keeping swizzling enabled for other classes.
* This is useful if you want to use manual tracing for file operations.
*/
public var enableDataSwizzling = true

/**
* Enables swizzling of`NSFileManager` to automatically track file operations.
*
* - Note: Swizzling is enabled by setting ``SentryOptions.enableSwizzling`` to `true`.
* This option allows you to disable swizzling for `NSFileManager` only, while keeping swizzling enabled for other classes.
* This is useful if you want to use manual tracing for file operations.
* - Experiment: This is an experimental feature and is therefore disabled by default. We'll enable it by default in a future release.
*/
public var enableFileManagerSwizzling = false

/**
* A more reliable way to report unhandled C++ exceptions.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ final class SentryEnabledFeaturesBuilderTests: XCTestCase {
// -- Arrange --
let options = Options()

options.experimental.enableDataSwizzling = true
options.enableDataSwizzling = true

// -- Act --
let features = SentryEnabledFeaturesBuilder.getEnabledFeatures(options: options)
Expand All @@ -140,7 +140,7 @@ final class SentryEnabledFeaturesBuilderTests: XCTestCase {
// -- Arrange --
let options = Options()

options.experimental.enableDataSwizzling = false
options.enableDataSwizzling = false

// -- Act --
let features = SentryEnabledFeaturesBuilder.getEnabledFeatures(options: options)
Expand All @@ -153,7 +153,7 @@ final class SentryEnabledFeaturesBuilderTests: XCTestCase {
// -- Arrange --
let options = Options()

options.experimental.enableFileManagerSwizzling = true
options.enableFileManagerSwizzling = true

// -- Act --
let features = SentryEnabledFeaturesBuilder.getEnabledFeatures(options: options)
Expand All @@ -166,7 +166,7 @@ final class SentryEnabledFeaturesBuilderTests: XCTestCase {
// -- Arrange --
let options = Options()

options.experimental.enableFileManagerSwizzling = false
options.enableFileManagerSwizzling = false

// -- Act --
let features = SentryEnabledFeaturesBuilder.getEnabledFeatures(options: options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class DataSentryTracingIntegrationTests: XCTestCase {
// NOTE: We are not testing for the case where swizzling is enabled, as it could lead to duplicate spans on older OS versions.
// Instead we are recommending to disable swizzling and use manual tracing.
options.enableSwizzling = true
options.experimental.enableDataSwizzling = false
options.experimental.enableFileManagerSwizzling = false
options.enableDataSwizzling = false
options.enableFileManagerSwizzling = false
}

// The base path is not unique for the DSN, therefore we need to make it unique
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class FileManagerSentryTracingIntegrationTests: XCTestCase {
// NOTE: We are not testing for the case where swizzling is enabled, as it could lead to duplicate spans on older OS versions.
// Instead we are recommending to disable swizzling and use manual tracing.
options.enableSwizzling = true
options.experimental.enableDataSwizzling = false
options.experimental.enableFileManagerSwizzling = false
options.enableDataSwizzling = false
options.enableFileManagerSwizzling = false
}

// Get the working directory of the SDK, as the path is using the DSN hash to avoid conflicts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ - (void)setUp
options.enableFileIOTracing = YES;
options.tracesSampleRate = @1;

options.experimental.enableFileManagerSwizzling = YES;
options.enableFileManagerSwizzling = YES;
}];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class SentryFileIOTrackingIntegrationTests: XCTestCase {
result.enableFileIOTracing = enableFileIOTracing
result.enableSwizzling = enableSwizzling
result.tracesSampleRate = tracesSampleRate
result.experimental.enableDataSwizzling = enableDataSwizzling
result.experimental.enableFileManagerSwizzling = enableFileManagerSwizzling
result.enableDataSwizzling = enableDataSwizzling
result.enableFileManagerSwizzling = enableFileManagerSwizzling
return result
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ - (void)setUp
- (void)setUpNSFileManagerSwizzlingWithEnabledFlag:(bool)enableFileManagerSwizzling
{
SentryOptions *options = [[SentryOptions alloc] init];
options.experimental.enableFileManagerSwizzling = enableFileManagerSwizzling;
options.enableFileManagerSwizzling = enableFileManagerSwizzling;

SentryThreadInspector *threadInspector =
[[SentryThreadInspector alloc] initWithOptions:options];
Expand Down
Loading
Loading