Skip to content

Commit

Permalink
HTTP Client errors (#2308)
Browse files Browse the repository at this point in the history
  • Loading branch information
marandaneto authored Nov 3, 2022
1 parent f6eee7c commit 59afa00
Show file tree
Hide file tree
Showing 42 changed files with 806 additions and 52 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Features

- Profile concurrent transactions (#2227)
- HTTP Client errors (#2308)
- Disable bitcode for Carthage distribution (#2341)

### Fixes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1340"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1320"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1250"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
4 changes: 4 additions & 0 deletions Samples/iOS-ObjectiveC/iOS-ObjectiveC/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ - (BOOL)application:(UIApplication *)application
if ([NSProcessInfo.processInfo.arguments containsObject:@"--io.sentry.profiling.enable"]) {
options.profilesSampleRate = @1;
}
options.enableCaptureFailedRequests = YES;
SentryHttpStatusCodeRange *httpStatusCodeRange =
[[SentryHttpStatusCodeRange alloc] initWithMin:400 max:599];
options.failedRequestStatusCodes = @[ httpStatusCodeRange ];
}];

return YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1340"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1200"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1310"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1340"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
3 changes: 3 additions & 0 deletions Samples/iOS-Swift/iOS-Swift/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// because we run CPU for 15 seconds at full throttle, we trigger ANR issues being sent. disable such during benchmarks.
options.enableAppHangTracking = !isBenchmarking
options.appHangTimeoutInterval = 2
options.enableCaptureFailedRequests = true
let httpStatusCodeRange = HttpStatusCodeRange(min: 400, max: 599)
options.failedRequestStatusCodes = [ httpStatusCodeRange ]
}

if #available(iOS 14.0, *) {
Expand Down
2 changes: 1 addition & 1 deletion Samples/iOS-Swift/iOS-Swift/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class ViewController: UIViewController {
_ = FileManager.default.contents(atPath: path)
}
}

guard let imgUrl = URL(string: "https://sentry-brand.storage.googleapis.com/sentry-logo-black.png") else {
return
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1310"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1200"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1250"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
30 changes: 29 additions & 1 deletion Sentry.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@
7BBD18BB24530D2600427C76 /* SentryFileManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BBD18BA24530D2600427C76 /* SentryFileManagerTests.swift */; };
7BC3936825B1AB3E004F03D3 /* SentryLevelMapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BC3936725B1AB3E004F03D3 /* SentryLevelMapper.h */; };
7BC3936E25B1AB72004F03D3 /* SentryLevelMapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BC3936D25B1AB72004F03D3 /* SentryLevelMapper.m */; };
7BC5B6FA290BCDE500D99477 /* SentryHttpStatusCodeRange+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BC5B6F8290BCDE500D99477 /* SentryHttpStatusCodeRange+Private.h */; };
7BC63F0828081242009D9E37 /* SentrySwizzleWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BC63F0728081242009D9E37 /* SentrySwizzleWrapper.h */; };
7BC63F0A28081288009D9E37 /* SentrySwizzleWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BC63F0928081288009D9E37 /* SentrySwizzleWrapper.m */; };
7BC6EBF4255C044A0059822A /* SentryEventTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BC6EBF3255C044A0059822A /* SentryEventTests.swift */; };
Expand Down Expand Up @@ -663,6 +664,12 @@
A811D867248E2770008A41EA /* SentrySystemEventBreadcrumbsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = A811D866248E2770008A41EA /* SentrySystemEventBreadcrumbsTest.swift */; };
A839D89824864B80003B7AFD /* SentrySystemEventBreadcrumbs.h in Headers */ = {isa = PBXBuildFile; fileRef = A839D89724864B80003B7AFD /* SentrySystemEventBreadcrumbs.h */; };
A839D89A24864BA8003B7AFD /* SentrySystemEventBreadcrumbs.m in Sources */ = {isa = PBXBuildFile; fileRef = A839D89924864BA8003B7AFD /* SentrySystemEventBreadcrumbs.m */; };
A8AFFCCD29069C3E00967CD7 /* SentryHttpStatusCodeRange.h in Headers */ = {isa = PBXBuildFile; fileRef = A8AFFCCC29069C3E00967CD7 /* SentryHttpStatusCodeRange.h */; settings = {ATTRIBUTES = (Public, ); }; };
A8AFFCCF2906C03700967CD7 /* SentryRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = A8AFFCCE2906C03700967CD7 /* SentryRequest.h */; settings = {ATTRIBUTES = (Public, ); }; };
A8AFFCD22907DA7600967CD7 /* SentryHttpStatusCodeRangeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8AFFCD12907DA7600967CD7 /* SentryHttpStatusCodeRangeTests.swift */; };
A8AFFCD42907E0CA00967CD7 /* SentryRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8AFFCD32907E0CA00967CD7 /* SentryRequestTests.swift */; };
A8F17B2E2901765900990B25 /* SentryRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = A8F17B2D2901765900990B25 /* SentryRequest.m */; };
A8F17B342902870300990B25 /* SentryHttpStatusCodeRange.m in Sources */ = {isa = PBXBuildFile; fileRef = A8F17B332902870300990B25 /* SentryHttpStatusCodeRange.m */; };
D8019910286B089000C277F0 /* SentryCrashReportSinkTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = D801990F286B089000C277F0 /* SentryCrashReportSinkTest.swift */; };
D808FB88281AB33C009A2A33 /* SentryUIEventTrackerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D808FB86281AB31D009A2A33 /* SentryUIEventTrackerTests.swift */; };
D808FB8B281BCE96009A2A33 /* TestSentrySwizzleWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = D808FB89281BCE46009A2A33 /* TestSentrySwizzleWrapper.swift */; };
Expand Down Expand Up @@ -1226,6 +1233,7 @@
7BBEB16026AEE5EF00C06C03 /* SentryTracer+Test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SentryTracer+Test.h"; sourceTree = "<group>"; };
7BC3936725B1AB3E004F03D3 /* SentryLevelMapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryLevelMapper.h; path = include/SentryLevelMapper.h; sourceTree = "<group>"; };
7BC3936D25B1AB72004F03D3 /* SentryLevelMapper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryLevelMapper.m; sourceTree = "<group>"; };
7BC5B6F8290BCDE500D99477 /* SentryHttpStatusCodeRange+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "SentryHttpStatusCodeRange+Private.h"; path = "include/SentryHttpStatusCodeRange+Private.h"; sourceTree = "<group>"; };
7BC63F0728081242009D9E37 /* SentrySwizzleWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySwizzleWrapper.h; path = include/SentrySwizzleWrapper.h; sourceTree = "<group>"; };
7BC63F0928081288009D9E37 /* SentrySwizzleWrapper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentrySwizzleWrapper.m; sourceTree = "<group>"; };
7BC6EBF3255C044A0059822A /* SentryEventTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryEventTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1448,6 +1456,12 @@
A811D866248E2770008A41EA /* SentrySystemEventBreadcrumbsTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentrySystemEventBreadcrumbsTest.swift; sourceTree = "<group>"; };
A839D89724864B80003B7AFD /* SentrySystemEventBreadcrumbs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySystemEventBreadcrumbs.h; path = include/SentrySystemEventBreadcrumbs.h; sourceTree = "<group>"; };
A839D89924864BA8003B7AFD /* SentrySystemEventBreadcrumbs.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentrySystemEventBreadcrumbs.m; sourceTree = "<group>"; };
A8AFFCCC29069C3E00967CD7 /* SentryHttpStatusCodeRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SentryHttpStatusCodeRange.h; path = Public/SentryHttpStatusCodeRange.h; sourceTree = "<group>"; };
A8AFFCCE2906C03700967CD7 /* SentryRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SentryRequest.h; path = Public/SentryRequest.h; sourceTree = "<group>"; };
A8AFFCD12907DA7600967CD7 /* SentryHttpStatusCodeRangeTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryHttpStatusCodeRangeTests.swift; sourceTree = "<group>"; };
A8AFFCD32907E0CA00967CD7 /* SentryRequestTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryRequestTests.swift; sourceTree = "<group>"; };
A8F17B2D2901765900990B25 /* SentryRequest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryRequest.m; sourceTree = "<group>"; };
A8F17B332902870300990B25 /* SentryHttpStatusCodeRange.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryHttpStatusCodeRange.m; sourceTree = "<group>"; };
D801990F286B089000C277F0 /* SentryCrashReportSinkTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryCrashReportSinkTest.swift; sourceTree = "<group>"; };
D808FB86281AB31D009A2A33 /* SentryUIEventTrackerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryUIEventTrackerTests.swift; sourceTree = "<group>"; };
D808FB89281BCE46009A2A33 /* TestSentrySwizzleWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestSentrySwizzleWrapper.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1645,6 +1659,8 @@
7BD4BD4827EB2A5D0071F4FF /* SentryDiscardedEvent.m */,
7BC9A20128F41350001E7C4C /* SentryMeasurementUnit.h */,
7BC9A20528F41781001E7C4C /* SentryMeasurementUnit.m */,
A8F17B2D2901765900990B25 /* SentryRequest.m */,
A8AFFCCE2906C03700967CD7 /* SentryRequest.h */,
);
name = Protocol;
sourceTree = "<group>";
Expand Down Expand Up @@ -1925,6 +1941,7 @@
8ED3D305264DFE700049393B /* SentryUIViewControllerSanitizerTests.swift */,
D8918B212849FA6D00701F9A /* SentrySDKIntegrationTestsBase.swift */,
0A1B497228E597DD00D7BFA3 /* TestLogOutput.swift */,
A8AFFCD12907DA7600967CD7 /* SentryHttpStatusCodeRangeTests.swift */,
);
path = SentryTests;
sourceTree = "<group>";
Expand Down Expand Up @@ -2279,6 +2296,7 @@
7BD4BD4A27EB2DC20071F4FF /* SentryDiscardedEventTests.swift */,
7BD4BD4C27EB31820071F4FF /* SentryClientReportTests.swift */,
7B68345028F7EB3D00FB7064 /* SentryMeasurementUnitTests.swift */,
A8AFFCD32907E0CA00967CD7 /* SentryRequestTests.swift */,
);
path = Protocol;
sourceTree = "<group>";
Expand Down Expand Up @@ -2574,6 +2592,9 @@
8E564AE7267AF22600FE117D /* SentryNetworkTracker.m */,
D8370B6B273DF20F00F66E2D /* SentryNSURLSessionTaskSearch.h */,
D8370B68273DF1E900F66E2D /* SentryNSURLSessionTaskSearch.m */,
A8F17B332902870300990B25 /* SentryHttpStatusCodeRange.m */,
A8AFFCCC29069C3E00967CD7 /* SentryHttpStatusCodeRange.h */,
7BC5B6F8290BCDE500D99477 /* SentryHttpStatusCodeRange+Private.h */,
);
name = Network;
sourceTree = "<group>";
Expand Down Expand Up @@ -2999,6 +3020,7 @@
8EA1ED0D2669028C00E62B98 /* SentryUIViewControllerSwizzling.h in Headers */,
7B98D7E425FB7A7200C5A389 /* SentryAppState.h in Headers */,
7BDEAA022632A4580001EA25 /* SentryOptions+Private.h in Headers */,
A8AFFCCD29069C3E00967CD7 /* SentryHttpStatusCodeRange.h in Headers */,
15E0A8EA240F2C9000F044E3 /* SentrySerialization.h in Headers */,
63FE70EF20DA4C1000CDBAE8 /* SentryCrashMonitor_AppState.h in Headers */,
635B3F381EBC6E2500A6176D /* SentryAsynchronousOperation.h in Headers */,
Expand Down Expand Up @@ -3061,6 +3083,7 @@
0ACBA10328A6407200D711F7 /* UIView+Sentry.h in Headers */,
632F43501F581D5400A18A36 /* SentryCrashExceptionApplication.h in Headers */,
7B85DC1E24EFAFCD007D01D2 /* SentryClient+Private.h in Headers */,
A8AFFCCF2906C03700967CD7 /* SentryRequest.h in Headers */,
7BD4BD4327EB29BA0071F4FF /* SentryClientReport.h in Headers */,
7BF9EF762722B34700B5BBEF /* SentrySubClassFinder.h in Headers */,
7BC852332458802C005A70F0 /* SentryDataCategoryMapper.h in Headers */,
Expand Down Expand Up @@ -3146,6 +3169,7 @@
7BC852392458830A005A70F0 /* SentryEnvelopeItemType.h in Headers */,
63AA769D1EB9C57A00D153DE /* SentryError.h in Headers */,
63FE714F20DA4C1100CDBAE8 /* NSError+SentrySimpleConstructor.h in Headers */,
7BC5B6FA290BCDE500D99477 /* SentryHttpStatusCodeRange+Private.h in Headers */,
7B04A9AF24EAC02C00E710B1 /* SentryRetryAfterHeaderParser.h in Headers */,
7DC83100239826280043DD9A /* SentryIntegrationProtocol.h in Headers */,
7B98D7BC25FB607300C5A389 /* SentryOutOfMemoryTracker.h in Headers */,
Expand Down Expand Up @@ -3222,7 +3246,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1250;
LastUpgradeCheck = 1200;
LastUpgradeCheck = 1400;
ORGANIZATIONNAME = Sentry;
TargetAttributes = {
63AA759A1EB8AEF500D153DE = {
Expand Down Expand Up @@ -3306,6 +3330,7 @@
7BE3C77D2446112C00A38442 /* SentryRateLimitParser.m in Sources */,
8ECC674A25C23A20000E2BF6 /* SentryTransactionContext.m in Sources */,
03BCC38C27E1C01A003232C7 /* SentryTime.mm in Sources */,
A8F17B342902870300990B25 /* SentryHttpStatusCodeRange.m in Sources */,
03F84D3727DD4191008FE43F /* SentrySamplingProfiler.cpp in Sources */,
8453421628BE8A9500C22EEC /* SentrySpanStatus.m in Sources */,
7B9657262683104C00C66E25 /* NSData+Sentry.m in Sources */,
Expand Down Expand Up @@ -3399,6 +3424,7 @@
6344DDBA1EC3115C00D9160D /* SentryCrashReportConverter.m in Sources */,
63FE70FD20DA4C1000CDBAE8 /* SentryCrashCachedData.c in Sources */,
8EE32518261FE27B00DC3FF2 /* SentryUIViewControllerSanitizer.m in Sources */,
A8F17B2E2901765900990B25 /* SentryRequest.m in Sources */,
7BE1E33424F7E3CB009D3AD0 /* SentryMigrateSessionInit.m in Sources */,
15E0A8F22411A45A00F044E3 /* SentrySession.m in Sources */,
7B6D1261265F784000C9BE4B /* PrivateSentrySDKOnly.m in Sources */,
Expand Down Expand Up @@ -3537,6 +3563,7 @@
63FE720D20DA66EC00CDBAE8 /* NSError+SimpleConstructor_Tests.m in Sources */,
69BEE6F72620729E006DF9DF /* UrlSessionDelegateSpy.swift in Sources */,
035E73C827D56757005EEB11 /* SentryBacktraceTests.mm in Sources */,
A8AFFCD42907E0CA00967CD7 /* SentryRequestTests.swift in Sources */,
7BD4BD4D27EB31820071F4FF /* SentryClientReportTests.swift in Sources */,
7B98D7EC25FB7C4900C5A389 /* SentryAppStateTests.swift in Sources */,
8EE017A126704CD500470616 /* SentryUIViewControllerPerformanceTrackerTests.swift in Sources */,
Expand All @@ -3548,6 +3575,7 @@
0A5370A128A3EC2400B2DCDE /* SentryViewHierarchyTests.swift in Sources */,
D8FFE50C2703DBB400607131 /* SwizzlingCallTests.swift in Sources */,
D8B76B0828081461000A58C4 /* TestSentryScreenShot.swift in Sources */,
A8AFFCD22907DA7600967CD7 /* SentryHttpStatusCodeRangeTests.swift in Sources */,
7BE2C7F8257000A4003B66C7 /* SentryTestIntegration.m in Sources */,
84A8892128DBD8D600C51DFD /* SentryDeviceTests.mm in Sources */,
7BC6EBF4255C044A0059822A /* SentryEventTests.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion Sentry.xcodeproj/xcshareddata/xcschemes/Sentry.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1200"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 2 additions & 0 deletions Sources/Sentry/Public/Sentry.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ FOUNDATION_EXPORT const unsigned char SentryVersionString[];
#import "SentryEvent.h"
#import "SentryException.h"
#import "SentryFrame.h"
#import "SentryHttpStatusCodeRange.h"
#import "SentryHub.h"
#import "SentryId.h"
#import "SentryIntegrationProtocol.h"
Expand All @@ -31,6 +32,7 @@ FOUNDATION_EXPORT const unsigned char SentryVersionString[];
#import "SentryMessage.h"
#import "SentryNSError.h"
#import "SentryOptions.h"
#import "SentryRequest.h"
#import "SentrySDK.h"
#import "SentrySampleDecision.h"
#import "SentrySamplingContext.h"
Expand Down
9 changes: 7 additions & 2 deletions Sources/Sentry/Public/SentryEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

NS_ASSUME_NONNULL_BEGIN

@class SentryThread, SentryException, SentryStacktrace, SentryUser, SentryDebugMeta,
SentryBreadcrumb, SentryId, SentryMessage;
@class SentryThread, SentryException, SentryStacktrace, SentryUser, SentryDebugMeta, SentryContext,
SentryBreadcrumb, SentryId, SentryMessage, SentryRequest;

NS_SWIFT_NAME(Event)
@interface SentryEvent : NSObject <SentrySerializable>
Expand Down Expand Up @@ -159,6 +159,11 @@ NS_SWIFT_NAME(Event)
*/
@property (nonatomic, strong) NSArray<SentryBreadcrumb *> *_Nullable breadcrumbs;

/**
* Set the Http request information.
*/
@property (nonatomic, strong, nullable) SentryRequest *request;

/**
* Init an SentryEvent will set all needed fields by default
* @return SentryEvent
Expand Down
37 changes: 37 additions & 0 deletions Sources/Sentry/Public/SentryHttpStatusCodeRange.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#import "SentryDefines.h"

NS_ASSUME_NONNULL_BEGIN

/**
* The Http status code range.
* The range is inclusive so the min and max is considered part of the range.
*
* Example for a range: 400 to 499, 500 to 599, 400 to 599.
* Example for a single status code 400, 500.
*/
NS_SWIFT_NAME(HttpStatusCodeRange)
@interface SentryHttpStatusCodeRange : NSObject
SENTRY_NO_INIT

@property (nonatomic, readonly) NSInteger min;

@property (nonatomic, readonly) NSInteger max;

/**
* The Http status code min and max.
* The range is inclusive so the min and max is considered part of the range.
*
* Example for a range: 400 to 499, 500 to 599, 400 to 599.
*/
- (instancetype)initWithMin:(NSInteger)min max:(NSInteger)max;

/**
* The Http status code.
*
* Example for a single status code 400, 500.
*/
- (instancetype)initWithStatusCode:(NSInteger)statusCode;

@end

NS_ASSUME_NONNULL_END
27 changes: 26 additions & 1 deletion Sources/Sentry/Public/SentryOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

NS_ASSUME_NONNULL_BEGIN

@class SentryDsn, SentrySdkInfo, SentryMeasurementValue;
@class SentryDsn, SentrySdkInfo, SentryMeasurementValue, SentryHttpStatusCodeRange;

NS_SWIFT_NAME(Options)
@interface SentryOptions : NSObject
Expand Down Expand Up @@ -414,6 +414,31 @@ NS_SWIFT_NAME(Options)
*/
@property (nonatomic, retain) NSArray *tracePropagationTargets;

/**
* When enabled, the SDK captures HTTP Client errors. Default value is NO.
* This feature requires enableSwizzling enabled as well, Default value is YES.
*/
@property (nonatomic, assign) BOOL enableCaptureFailedRequests;

/**
* The SDK will only capture HTTP Client errors if the HTTP Response status code is within the
* defined range.
*
* Defaults to 500 - 599.
*/
@property (nonatomic, strong) NSArray<SentryHttpStatusCodeRange *> *failedRequestStatusCodes;

/**
* An array of hosts or regexes that determines if HTTP Client errors will be automatically
* captured.
*
* This array can contain instances of NSString which should match the URL (using `contains`),
* and instances of NSRegularExpression, which will be used to check the whole URL.
*
* The default value automatically captures HTTP Client errors of all outgoing requests.
*/
@property (nonatomic, strong) NSArray *failedRequestTargets;

@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit 59afa00

Please sign in to comment.