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
1 change: 1 addition & 0 deletions CHANGELOG-v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Removes segment property on SentryUser, SentryBaggage, and SentryTraceContext (#
Removes public SentrySerializable conformance from many public models (#5636)
Removes Decodable conformances from the public API of model classes (#5691)
Removes enableTracing property from SentryOptions (#5694)
Removes `integrations` property from `SentryOptions` (#5749)

### Fixes

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Move continuous profiling payload serialization off of the main thread (#5613)
- Improve video generation using apple recommended loop (#5612)
- Use -OSize for release builds (#5721)
- Mark The `integrations` parameter of `SentryOptions` as deprecated rather than printing a warning (#5749)

### Fixes

Expand Down
3 changes: 3 additions & 0 deletions SentryTestUtils/TestOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@ import Foundation
import Sentry

public extension Options {
@available(*, deprecated)
func setIntegrations(_ integrations: [AnyClass]) {
self.integrations = integrations.map {
NSStringFromClass($0)
}
}

@available(*, deprecated)
func removeAllIntegrations() {
self.integrations = []
}

@available(*, deprecated)
static func noIntegrations() -> Options {
let options = Options()
options.removeAllIntegrations()
Expand Down
6 changes: 5 additions & 1 deletion Sources/Sentry/Public/SentryOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,14 @@ NS_SWIFT_NAME(Options)
@property (nullable, nonatomic, copy)
SentryOnCrashedLastRunCallback onCrashedLastRun NS_SWIFT_SENDABLE;

#if !SDK_V9
/**
* Array of integrations to install.
*/
@property (nullable, nonatomic, copy) NSArray<NSString *> *integrations;
@property (nullable, nonatomic, copy) NSArray<NSString *> *integrations DEPRECATED_MSG_ATTRIBUTE(
"Setting `SentryOptions.integrations` is deprecated. Integrations should be enabled or "
"disabled using their respective `SentryOptions.enable*` property.");
#endif // !SDK_V9

/**
* Array of default integrations. Will be used if @c integrations is @c nil .
Expand Down
7 changes: 4 additions & 3 deletions Sources/Sentry/SentryOptions.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ - (instancetype)init
self.debug = NO;
self.maxBreadcrumbs = defaultMaxBreadcrumbs;
self.maxCacheItems = 30;
#if !SDK_V9
_integrations = [SentryOptions defaultIntegrations];
#endif // !SDK_V9
self.sampleRate = SENTRY_DEFAULT_SAMPLE_RATE;
self.enableAutoSessionTracking = YES;
self.enableGraphQLOperationTracking = NO;
Expand Down Expand Up @@ -208,13 +210,12 @@ - (void)setFailedRequestTargets:(NSArray *)failedRequestTargets
_failedRequestTargets = failedRequestTargets;
}

#if !SDK_V9
- (void)setIntegrations:(NSArray<NSString *> *)integrations
{
SENTRY_LOG_WARN(
@"Setting `SentryOptions.integrations` is deprecated. Integrations should be enabled or "
@"disabled using their respective `SentryOptions.enable*` property.");
_integrations = integrations.mutableCopy;
}
#endif // !SDK_V9

- (void)setDsn:(NSString *)dsn
{
Expand Down
7 changes: 7 additions & 0 deletions Sources/Sentry/SentrySDKInternal.m
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,15 @@ + (void)installIntegrations
return;
}
SentryOptions *options = [SentrySDKInternal.currentHub getClient].options;
#if SDK_V9
NSMutableArray<NSString *> *integrationNames = [SentryOptions defaultIntegrations].mutableCopy;
#else
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
NSMutableArray<NSString *> *integrationNames =
[SentrySDKInternal.currentHub getClient].options.integrations.mutableCopy;
# pragma clang diagnostic pop
#endif // SDK_V9

NSArray<Class> *defaultIntegrations = SentryOptionsInternal.defaultIntegrationClasses;

Expand Down
5 changes: 5 additions & 0 deletions Sources/Sentry/SentyOptionsInternal.m
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,15 @@ + (BOOL)validateOptions:(NSDictionary<NSString *, id> *)options
sentryOptions.onCrashedLastRun = options[@"onCrashedLastRun"];
}

#if !SDK_V9
if ([options[@"integrations"] isKindOfClass:[NSArray class]]) {
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wdeprecated-declarations"
sentryOptions.integrations =
[[options[@"integrations"] filteredArrayUsingPredicate:isNSString] mutableCopy];
# pragma clang diagnstic pop
}
#endif // !SDK_V9

if ([options[@"sampleRate"] isKindOfClass:[NSNumber class]]) {
sentryOptions.sampleRate = options[@"sampleRate"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import XCTest
// swiftlint:disable file_length
class SentryProfilingPublicAPITests: XCTestCase {
private class Fixture {
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
let options: Options = {
let options = Options.noIntegrations()
options.dsn = TestConstants.dsnAsString(username: "SentrySDKTests")
Expand Down Expand Up @@ -35,7 +36,9 @@ class SentryProfilingPublicAPITests: XCTestCase {

let currentDate = TestCurrentDateProvider()
lazy var timerFactory = TestSentryNSTimerFactory(currentDateProvider: currentDate)
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
lazy var client = TestClient(options: options)!
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
lazy var hub = SentryHub(client: client, andScope: scope)
}

Expand All @@ -52,6 +55,7 @@ class SentryProfilingPublicAPITests: XCTestCase {
SentryDependencyContainer.sharedInstance().dateProvider = fixture.currentDate
}

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
override func tearDown() {
super.tearDown()

Expand Down Expand Up @@ -668,12 +672,14 @@ extension SentryProfilingPublicAPITests {
}

private extension SentryProfilingPublicAPITests {
@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
func givenSdkWithHub() {
SentrySDKInternal.setCurrentHub(fixture.hub)
SentrySDKInternal.setStart(with: fixture.options)
sentry_sdkInitProfilerTasks(fixture.options, fixture.hub)
}

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
func givenSdkWithHubButNoClient() {
SentrySDKInternal.setCurrentHub(SentryHub(client: nil, andScope: nil))
SentrySDKInternal.setStart(with: fixture.options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class SentryCoreDataTrackingIntegrationTests: XCTestCase {
let options: Options
let coreDataStack: TestCoreDataStack

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
init(testName: String) {
coreDataStack = TestCoreDataStack(databaseFilename: "db-\(testName.hashValue).sqlite")
options = Options()
Expand All @@ -24,6 +25,7 @@ class SentryCoreDataTrackingIntegrationTests: XCTestCase {

private var fixture: Fixture!

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
override func setUp() {
super.setUp()
fixture = Fixture(testName: self.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class DataSentryTracingIntegrationTests: XCTestCase {

init() {}

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
func getSut(testName: String, isSDKEnabled: Bool = true, isEnabled: Bool = true) throws -> Data {
let fileManager = FileManager.default
let tempDirUrl = URL(fileURLWithPath: NSTemporaryDirectory())
Expand Down Expand Up @@ -130,6 +131,7 @@ class DataSentryTracingIntegrationTests: XCTestCase {

// MARK: - Data.init(contentsOfWithSentryTracing:)

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
func testInitContentsOfWithSentryTracing_shouldTraceManually() throws {
// -- Arrange --
let expectedData = try fixture.getSut(testName: self.name)
Expand Down Expand Up @@ -159,6 +161,7 @@ class DataSentryTracingIntegrationTests: XCTestCase {
XCTAssertGreaterThan(endTimestamp.timeIntervalSince1970, startTimestamp.timeIntervalSince1970)
}

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
func testInitContentsOfWithSentryTracingWithOptions_shouldPassOptionsToSystemImplementation() throws {
// -- Arrange --
let expectedData = try fixture.getSut(testName: self.name)
Expand Down Expand Up @@ -186,6 +189,7 @@ class DataSentryTracingIntegrationTests: XCTestCase {
XCTAssertEqual(mappedSentryData, expectedData)
}

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
func testInitContentsOfWithSentryTracing_throwsError_shouldTraceManuallyWithErrorRethrow() throws {
// -- Arrange --
let _ = try fixture.getSut(testName: self.name)
Expand All @@ -212,6 +216,7 @@ class DataSentryTracingIntegrationTests: XCTestCase {
XCTAssertGreaterThan(endTimestamp.timeIntervalSince1970, startTimestamp.timeIntervalSince1970)
}

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
func testInitContentsOfWithSentryTracing_nonFileUrl_shouldNotTraceManually() throws {
// -- Arrange --
let _ = try fixture.getSut(testName: self.name)
Expand All @@ -225,6 +230,7 @@ class DataSentryTracingIntegrationTests: XCTestCase {
XCTAssertEqual(parentTransaction.children.count, 0)
}

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
func testInitContentsOfWithSentryTracing_trackerIsNotEnabled_shouldNotTraceManually() throws {
// -- Arrange --
let _ = try fixture.getSut(testName: self.name, isEnabled: false)
Expand All @@ -238,6 +244,7 @@ class DataSentryTracingIntegrationTests: XCTestCase {
XCTAssertEqual(parentTransaction.children.count, 0)
}

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
func testInitContentsOfWithSentryTracing_fileIsIgnored_shouldNotTraceManually() throws {
// -- Arrange --
let _ = try fixture.getSut(testName: self.name)
Expand All @@ -251,6 +258,7 @@ class DataSentryTracingIntegrationTests: XCTestCase {
XCTAssertEqual(parentTransaction.children.count, 0)
}

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
func testInitContentsOfWithSentryTracing_SDKIsNotStarted_shouldReadData() throws {
// -- Arrange --
let _ = try fixture.getSut(testName: self.name, isSDKEnabled: false)
Expand All @@ -263,6 +271,7 @@ class DataSentryTracingIntegrationTests: XCTestCase {
XCTAssertEqual(data, fixture.data)
}

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
func testInitContentsOfWithSentryTracing_SDKIsClosed_shouldReadData() throws {
// -- Arrange --
let _ = try fixture.getSut(testName: self.name)
Expand All @@ -278,6 +287,7 @@ class DataSentryTracingIntegrationTests: XCTestCase {

// MARK: - Data.writeWithSentryTracing(to:)

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
func testWriteWithSentryTracing_shouldTraceManuallyWithErrorRethrow() throws {
// -- Arrange --
let sut: Data = try fixture.getSut(testName: self.name)
Expand Down Expand Up @@ -313,6 +323,7 @@ class DataSentryTracingIntegrationTests: XCTestCase {
XCTAssertGreaterThan(endTimestamp.timeIntervalSince1970, startTimestamp.timeIntervalSince1970)
}

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
func testWriteWithSentryTracingWithOptions_shouldPassOptionsToSystemImplementation() throws {
// -- Arrange --
let sut: Data = try fixture.getSut(testName: self.name)
Expand Down Expand Up @@ -344,6 +355,7 @@ class DataSentryTracingIntegrationTests: XCTestCase {
XCTAssertEqual(writtenData, sut)
}

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
func testWriteWithSentryTracing_throwsError_shouldTraceManuallyWithErrorRethrow() throws {
// -- Arrange --
let sut: Data = try fixture.getSut(testName: self.name)
Expand All @@ -370,6 +382,7 @@ class DataSentryTracingIntegrationTests: XCTestCase {
XCTAssertGreaterThan(endTimestamp.timeIntervalSince1970, startTimestamp.timeIntervalSince1970)
}

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
func testWriteWithSentryTracing_nonFileUrl_shouldNotTraceManually() throws {
// -- Arrange --
let sut: Data = try fixture.getSut(testName: self.name)
Expand All @@ -382,6 +395,7 @@ class DataSentryTracingIntegrationTests: XCTestCase {
XCTAssertEqual(parentTransaction.children.count, 0)
}

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
func testWriteWithSentryTracing_trackerIsNotEnabled_shouldNotTraceManually() throws {
// -- Arrange --
let sut: Data = try fixture.getSut(testName: self.name, isEnabled: false)
Expand All @@ -394,6 +408,7 @@ class DataSentryTracingIntegrationTests: XCTestCase {
XCTAssertEqual(parentTransaction.children.count, 0)
}

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
func testWriteWithSentryTracing_fileIsIgnored_shouldNotTraceManually() throws {
// -- Arrange --
let sut: Data = try fixture.getSut(testName: self.name)
Expand All @@ -413,6 +428,7 @@ class DataSentryTracingIntegrationTests: XCTestCase {
XCTAssertEqual(parentTransaction.children.count, 0)
}

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
func testWriteWithSentryTracing_SDKIsNotStarted_shouldWriteFile() throws {
// -- Arrange --
let sut: Data = try fixture.getSut(testName: self.name, isSDKEnabled: false)
Expand All @@ -431,6 +447,7 @@ class DataSentryTracingIntegrationTests: XCTestCase {
XCTAssertEqual(writtenData, fixture.data)
}

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
func testWriteWithSentryTracing_SDKIsClosed_shouldWriteFile() throws {
// -- Arrange --
let sut: Data = try fixture.getSut(testName: self.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
@_spi(Private) import SentryTestUtils
import XCTest

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
class FileManagerSentryTracingIntegrationTests: XCTestCase {
private class Fixture {
let mockDateProvider: TestCurrentDateProvider = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class SentryFileIOTrackerSwiftHelpersTests: XCTestCase {
private let destPath = "/path/to/dest"
private let testError = NSError(domain: "Test", code: 1, userInfo: nil)

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
override func setUp() {
mockedDateProvider = TestCurrentDateProvider()
SentryDependencyContainer.sharedInstance().dateProvider = mockedDateProvider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class SentryFileIOTrackerTests: XCTestCase {

private var fixture: Fixture!

@available(*, deprecated, message: "This is deprecated because SentryOptions integrations is deprecated")
override func setUp() {
super.setUp()
fixture = Fixture()
Expand Down
Loading
Loading