Skip to content

Commit a6899a2

Browse files
feat: Track usage of the enableCaptureFailedRequests option (#2368)
1 parent 062f06c commit a6899a2

4 files changed

Lines changed: 25 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Features
6+
7+
- Report usage of enableCaptureFailedRequests (#2368)
8+
59
### Fixes
610

711
- Fix issue with invalid profiles uploading (#2358 and #2359)

Sources/Sentry/Public/SentryOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ NS_SWIFT_NAME(Options)
416416

417417
/**
418418
* When enabled, the SDK captures HTTP Client errors. Default value is NO.
419-
* This feature requires enableSwizzling enabled as well, Default value is YES.
419+
* This feature requires enableSwizzling enabled as well, default value is YES.
420420
*/
421421
@property (nonatomic, assign) BOOL enableCaptureFailedRequests;
422422

Sources/Sentry/SentryClient.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,10 @@ - (void)setSdk:(SentryEvent *)event
654654
if (self.options.stitchAsyncCode) {
655655
[integrations addObject:@"StitchAsyncCode"];
656656
}
657+
658+
if (self.options.enableCaptureFailedRequests) {
659+
[integrations addObject:@"CaptureFailedRequests"];
660+
}
657661
}
658662

659663
event.sdk = @{

Tests/SentryTests/SentryClientTests.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,6 +1047,22 @@ class SentryClientTest: XCTestCase {
10471047
)
10481048
}
10491049
}
1050+
1051+
func testTrackEnableCaptureFailedRequests() {
1052+
SentrySDK.start(options: Options())
1053+
1054+
let eventId = fixture.getSut(configureOptions: { options in
1055+
options.enableCaptureFailedRequests = true
1056+
}).capture(message: fixture.messageAsString)
1057+
1058+
eventId.assertIsNotEmpty()
1059+
assertLastSentEvent { actual in
1060+
assertArrayEquals(
1061+
expected: ["AutoBreadcrumbTracking", "AutoSessionTracking", "Crash", "NetworkTracking", "CaptureFailedRequests"],
1062+
actual: actual.sdk?["integrations"] as? [String]
1063+
)
1064+
}
1065+
}
10501066

10511067
func testSetSDKIntegrations_NoIntegrations() {
10521068
let expected: [String] = []

0 commit comments

Comments
 (0)