Skip to content
Draft
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
20 changes: 8 additions & 12 deletions Sentry.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@
630C01941EC3402C00C52CEF /* SentryKSCrashReportConverterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 630C01931EC3402C00C52CEF /* SentryKSCrashReportConverterTests.m */; };
630C01961EC341D600C52CEF /* Resources in Resources */ = {isa = PBXBuildFile; fileRef = 630C01951EC341D600C52CEF /* Resources */; };
631501BB1EE6F30B00512C5B /* SentrySwizzleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 631501BA1EE6F30B00512C5B /* SentrySwizzleTests.m */; };
631E6D331EBC679C00712345 /* SentryQueueableRequestManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 631E6D311EBC679C00712345 /* SentryQueueableRequestManager.h */; };
631E6D341EBC679C00712345 /* SentryQueueableRequestManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 631E6D321EBC679C00712345 /* SentryQueueableRequestManager.m */; };
632331F62404FFA8008D91D6 /* SentryScopeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 632331F52404FFA8008D91D6 /* SentryScopeTests.m */; };
632331F9240506DF008D91D6 /* SentryScope+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 632331F7240506DF008D91D6 /* SentryScope+Private.h */; };
63295AF51EF3C7DB002D4490 /* SentryNSDictionarySanitize.h in Headers */ = {isa = PBXBuildFile; fileRef = 63295AF31EF3C7DB002D4490 /* SentryNSDictionarySanitize.h */; settings = {ATTRIBUTES = (Private, ); }; };
Expand Down Expand Up @@ -508,7 +506,6 @@
7BAF3DCE243DCBFE008A5414 /* SentryTransportFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BAF3DCD243DCBFE008A5414 /* SentryTransportFactory.m */; };
7BAF3DD2243DD05C008A5414 /* SentryTransportInitializerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BAF3DD1243DD05C008A5414 /* SentryTransportInitializerTests.swift */; };
7BAF3DD4243DD40F008A5414 /* SentryTransportFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BAF3DD3243DD40F008A5414 /* SentryTransportFactory.h */; };
7BAF3DD92440AEC8008A5414 /* SentryRequestManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 7BAF3DD82440AEC8008A5414 /* SentryRequestManager.h */; };
7BB42EF124F3B7B700D7B39A /* SentrySession+Equality.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BB42EF024F3B7B700D7B39A /* SentrySession+Equality.m */; };
7BB6550D253EEB3900887E87 /* SentryUserFeedbackTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BB6550C253EEB3900887E87 /* SentryUserFeedbackTests.swift */; };
7BB7E7C729267A28004BF96B /* EmptyIntegration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BB7E7C629267A28004BF96B /* EmptyIntegration.swift */; };
Expand Down Expand Up @@ -1068,6 +1065,8 @@
FA67DD182DDBD4EA00896B02 /* UIImageHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA67DCED2DDBD4EA00896B02 /* UIImageHelper.swift */; };
FA67DD192DDBD4EA00896B02 /* SwizzleClassNameExclude.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA67DCD52DDBD4EA00896B02 /* SwizzleClassNameExclude.swift */; };
FA8A36182DEAA1EB0058D883 /* SentryThread+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = FA8A36172DEAA1EB0058D883 /* SentryThread+Private.h */; };
FA90FAA22E06503E008CAAE8 /* SentryQueueableRequestManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA90FAA12E065038008CAAE8 /* SentryQueueableRequestManager.swift */; };
FA90FAA42E0654D2008CAAE8 /* RequestManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA90FAA32E0654CB008CAAE8 /* RequestManager.swift */; };
FAEC270E2DF3526000878871 /* SentryUserFeedback.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAEC270D2DF3526000878871 /* SentryUserFeedback.swift */; };
FAEC273D2DF3933A00878871 /* NSData+Unzip.m in Sources */ = {isa = PBXBuildFile; fileRef = FAEC273C2DF3933200878871 /* NSData+Unzip.m */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -1314,8 +1313,6 @@
630C01931EC3402C00C52CEF /* SentryKSCrashReportConverterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SentryKSCrashReportConverterTests.m; sourceTree = "<group>"; };
630C01951EC341D600C52CEF /* Resources */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Resources; sourceTree = "<group>"; };
631501BA1EE6F30B00512C5B /* SentrySwizzleTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SentrySwizzleTests.m; sourceTree = "<group>"; };
631E6D311EBC679C00712345 /* SentryQueueableRequestManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SentryQueueableRequestManager.h; path = include/SentryQueueableRequestManager.h; sourceTree = "<group>"; };
631E6D321EBC679C00712345 /* SentryQueueableRequestManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SentryQueueableRequestManager.m; sourceTree = "<group>"; };
632331F52404FFA8008D91D6 /* SentryScopeTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryScopeTests.m; sourceTree = "<group>"; };
632331F7240506DF008D91D6 /* SentryScope+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "SentryScope+Private.h"; path = "include/SentryScope+Private.h"; sourceTree = "<group>"; };
63295AF31EF3C7DB002D4490 /* SentryNSDictionarySanitize.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryNSDictionarySanitize.h; path = include/SentryNSDictionarySanitize.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1690,7 +1687,6 @@
7BAF3DD1243DD05C008A5414 /* SentryTransportInitializerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryTransportInitializerTests.swift; sourceTree = "<group>"; };
7BAF3DD3243DD40F008A5414 /* SentryTransportFactory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryTransportFactory.h; path = include/SentryTransportFactory.h; sourceTree = "<group>"; };
7BAF3DD6243DD4A1008A5414 /* TestConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestConstants.swift; sourceTree = "<group>"; };
7BAF3DD82440AEC8008A5414 /* SentryRequestManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryRequestManager.h; path = include/SentryRequestManager.h; sourceTree = "<group>"; };
7BB42EEF24F3B7B700D7B39A /* SentrySession+Equality.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SentrySession+Equality.h"; sourceTree = "<group>"; };
7BB42EF024F3B7B700D7B39A /* SentrySession+Equality.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "SentrySession+Equality.m"; sourceTree = "<group>"; };
7BB6550C253EEB3900887E87 /* SentryUserFeedbackTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryUserFeedbackTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2316,6 +2312,8 @@
FA67DCEF2DDBD4EA00896B02 /* URLSessionTaskHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLSessionTaskHelper.swift; sourceTree = "<group>"; };
FA67DCF22DDBD4EA00896B02 /* SwiftDescriptor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftDescriptor.swift; sourceTree = "<group>"; };
FA8A36172DEAA1EB0058D883 /* SentryThread+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "SentryThread+Private.h"; path = "include/SentryThread+Private.h"; sourceTree = "<group>"; };
FA90FAA12E065038008CAAE8 /* SentryQueueableRequestManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryQueueableRequestManager.swift; sourceTree = "<group>"; };
FA90FAA32E0654CB008CAAE8 /* RequestManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestManager.swift; sourceTree = "<group>"; };
FAEC270D2DF3526000878871 /* SentryUserFeedback.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryUserFeedback.swift; sourceTree = "<group>"; };
FAEC273C2DF3933200878871 /* NSData+Unzip.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSData+Unzip.m"; sourceTree = "<group>"; };
FAEC273E2DF393E000878871 /* NSData+Unzip.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSData+Unzip.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2501,9 +2499,6 @@
630435FD1EBCA9D900C4D3FA /* SentryNSURLRequest.m */,
7B5CAF7427F5A67C00ED0DB6 /* SentryNSURLRequestBuilder.h */,
7B5CAF7627F5A68C00ED0DB6 /* SentryNSURLRequestBuilder.m */,
7BAF3DD82440AEC8008A5414 /* SentryRequestManager.h */,
631E6D311EBC679C00712345 /* SentryQueueableRequestManager.h */,
631E6D321EBC679C00712345 /* SentryQueueableRequestManager.m */,
638DC99E1EBC6B6400A66E41 /* SentryRequestOperation.h */,
638DC99F1EBC6B6400A66E41 /* SentryRequestOperation.m */,
D4291A672DD61A3F00772088 /* SentryDispatchQueueProviderProtocol.h */,
Expand Down Expand Up @@ -4248,6 +4243,8 @@
D856272A2A374A6800FB8062 /* Tools */ = {
isa = PBXGroup;
children = (
FA90FAA12E065038008CAAE8 /* SentryQueueableRequestManager.swift */,
FA90FAA32E0654CB008CAAE8 /* RequestManager.swift */,
FA67DCC02DDBD4C800896B02 /* SentryLog+Configure.swift */,
);
path = Tools;
Expand Down Expand Up @@ -4687,7 +4684,6 @@
63FE70D120DA4C1000CDBAE8 /* SentryCrashMonitorContext.h in Headers */,
63B818F91EC34639002FDF4C /* SentryDebugMeta.h in Headers */,
6360850D1ED2AFE100E8599E /* SentryBreadcrumb.h in Headers */,
7BAF3DD92440AEC8008A5414 /* SentryRequestManager.h in Headers */,
62862B1C2B1DDBC8009B16E3 /* SentryDelayedFrame.h in Headers */,
627E7589299F6FE40085504D /* SentryInternalDefines.h in Headers */,
7BE3C77B2446111500A38442 /* SentryRateLimitParser.h in Headers */,
Expand Down Expand Up @@ -4742,7 +4738,6 @@
84DEE8762B69AD6400A7BC17 /* SentryLaunchProfiling.h in Headers */,
D8ACE3CE2762187D00F5A213 /* SentryFileIOTracker.h in Headers */,
03F84D2427DD414C008FE43F /* SentryCompiler.h in Headers */,
631E6D331EBC679C00712345 /* SentryQueueableRequestManager.h in Headers */,
33EB2A922C341300004FED3D /* Sentry.h in Headers */,
7B3398632459C14000BD9C96 /* SentryEnvelopeRateLimit.h in Headers */,
6304360A1EC0595B00C4D3FA /* SentryNSDataUtils.h in Headers */,
Expand Down Expand Up @@ -5257,7 +5252,6 @@
7B0DC730288698F70039995F /* NSMutableDictionary+Sentry.m in Sources */,
628094742D39584C00B3F18B /* SentryUserCodable.swift in Sources */,
7BD4BD4527EB29F50071F4FF /* SentryClientReport.m in Sources */,
631E6D341EBC679C00712345 /* SentryQueueableRequestManager.m in Sources */,
7B8713B426415BAA006D6004 /* SentryAppStartTracker.m in Sources */,
7BDB03BB2513652900BAE198 /* SentryDispatchQueueWrapper.m in Sources */,
D8739D142BEE5049007D2F66 /* SentryRRWebSpanEvent.swift in Sources */,
Expand Down Expand Up @@ -5473,6 +5467,7 @@
7B6D1261265F784000C9BE4B /* PrivateSentrySDKOnly.mm in Sources */,
63BE85711ECEC6DE00DC44F5 /* SentryDateUtils.m in Sources */,
D451ED5D2D92ECD200C9BEA8 /* SentryOnDemandReplayError.swift in Sources */,
FA90FAA22E06503E008CAAE8 /* SentryQueueableRequestManager.swift in Sources */,
7BD4BD4927EB2A5D0071F4FF /* SentryDiscardedEvent.m in Sources */,
628308612D50ADAC00EAEF77 /* SentryRequestCodable.swift in Sources */,
03F84D3827DD4191008FE43F /* SentryBacktrace.cpp in Sources */,
Expand Down Expand Up @@ -5588,6 +5583,7 @@
7BC9A20628F41781001E7C4C /* SentryMeasurementUnit.m in Sources */,
63FE71A020DA4C1100CDBAE8 /* SentryCrashInstallation.m in Sources */,
63FE713520DA4C1100CDBAE8 /* SentryCrashMemory.c in Sources */,
FA90FAA42E0654D2008CAAE8 /* RequestManager.swift in Sources */,
629194A92D51F976000F7C6B /* SentryDebugMetaCodable.swift in Sources */,
63FE714520DA4C1100CDBAE8 /* SentryCrashObjC.c in Sources */,
63FE710520DA4C1000CDBAE8 /* SentryAsyncSafeLog.c in Sources */,
Expand Down
65 changes: 0 additions & 65 deletions Sources/Sentry/SentryQueueableRequestManager.m

This file was deleted.

1 change: 1 addition & 0 deletions Sources/Sentry/SentrySpotlightTransport.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#import "SentryNSURLRequestBuilder.h"
#import "SentryOptions.h"
#import "SentrySerialization.h"
#import "SentrySwift.h"
#import "SentryTransport.h"

NS_ASSUME_NONNULL_BEGIN
Expand Down
2 changes: 1 addition & 1 deletion Sources/Sentry/SentryTransportFactory.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
#import "SentryHttpTransport.h"
#import "SentryNSURLRequestBuilder.h"
#import "SentryOptions.h"
#import "SentryQueueableRequestManager.h"
#import "SentryRateLimitParser.h"
#import "SentryRateLimits.h"

#import "SentryRetryAfterHeaderParser.h"
#import "SentrySpotlightTransport.h"
#import "SentrySwift.h"
#import "SentryTransport.h"

NS_ASSUME_NONNULL_BEGIN
Expand Down
2 changes: 1 addition & 1 deletion Sources/Sentry/include/SentryHttpTransport.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
#import "SentryEnvelopeRateLimit.h"
#import "SentryFileManager.h"
#import "SentryRateLimits.h"
#import "SentryRequestManager.h"
#import "SentryTransport.h"

@class SentryDispatchQueueWrapper;
@class SentryNSURLRequestBuilder;
@class SentryOptions;
@protocol SentryRequestManager;

NS_ASSUME_NONNULL_BEGIN

Expand Down
1 change: 1 addition & 0 deletions Sources/Sentry/include/SentryPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#import "SentryNSDictionarySanitize.h"
#import "SentryProfiler+Private.h"
#import "SentryRandom.h"
#import "SentryRequestOperation.h"
#import "SentryScreenshot.h"
#import "SentrySdkInfo.h"
#import "SentrySerialization.h"
Expand Down
10 changes: 0 additions & 10 deletions Sources/Sentry/include/SentryQueueableRequestManager.h

This file was deleted.

17 changes: 0 additions & 17 deletions Sources/Sentry/include/SentryRequestManager.h

This file was deleted.

2 changes: 1 addition & 1 deletion Sources/Sentry/include/SentryRequestOperation.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#import "SentryAsynchronousOperation.h"
#import "SentryQueueableRequestManager.h"
#import "SentryDefines.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down
2 changes: 1 addition & 1 deletion Sources/Sentry/include/SentrySpotlightTransport.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#import "SentryDefines.h"
#import "SentryRequestManager.h"
#import "SentryTransport.h"

@class SentryDispatchQueueWrapper;
@class SentryNSURLRequestBuilder;
@class SentryOptions;
@protocol SentryRequestManager;

NS_ASSUME_NONNULL_BEGIN

Expand Down
10 changes: 10 additions & 0 deletions Sources/Swift/Tools/RequestManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@objc(SentryRequestManager)
@_spi(Private) public protocol RequestManager {

var isReady: Bool { get }

init(session: URLSession)

@objc(addRequest:completionHandler:)
func add(_ request: URLRequest, completionHandler: ((HTTPURLResponse?, Error?) -> Void)?)
}
39 changes: 39 additions & 0 deletions Sources/Swift/Tools/SentryQueueableRequestManager.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
@_implementationOnly import _SentryPrivate

@objc @_spi(Private) public final class SentryQueueableRequestManager: NSObject, RequestManager {
private let session: URLSession
private let queue: OperationQueue

@objc
public init(session: URLSession) {
self.session = session
self.queue = OperationQueue()
self.queue.name = "io.sentry.QueueableRequestManager.OperationQueue"
self.queue.maxConcurrentOperationCount = 3
}

public var isReady: Bool {
#if SENTRY_TEST || SENTRY_TEST_CI
// force every envelope to be cached in UI tests so we can inspect what the SDK would've sent
// for a given operation
if ProcessInfo.processInfo.environment["--io.sentry.sdk-environment"] == "ui-tests" {
return false

Check warning on line 20 in Sources/Swift/Tools/SentryQueueableRequestManager.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Tools/SentryQueueableRequestManager.swift#L20

Added line #L20 was not covered by tests
}
#elseif DEBUG
if ProcessInfo.processInfo.arguments.contains("--io.sentry.disable-http-transport") {
return false
}
#endif // SENTRY_TEST || SENTRY_TEST_CI

// We always have at least one operation in the queue when calling this
return self.queue.operationCount <= 1
}

public func add(_ request: URLRequest, completionHandler: SentryRequestOperationFinished?) {
let operation = SentryRequestOperation(session: self.session, request: request) { response, error in
SentryLog.debug("Queued requests: \(self.queue.operationCount - 1)")
completionHandler?(response, error)

Check warning on line 35 in Sources/Swift/Tools/SentryQueueableRequestManager.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Tools/SentryQueueableRequestManager.swift#L32-L35

Added lines #L32 - L35 were not covered by tests
}
self.queue.addOperation(operation)

Check warning on line 37 in Sources/Swift/Tools/SentryQueueableRequestManager.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Tools/SentryQueueableRequestManager.swift#L37

Added line #L37 was not covered by tests
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Sentry
@_spi(Private) import Sentry
import SentryTestUtils
import XCTest

Expand Down
2 changes: 1 addition & 1 deletion Tests/SentryTests/Networking/TestRequestManager.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
import SentryTestUtils

public class TestRequestManager: NSObject, RequestManager {
class TestRequestManager: NSObject, RequestManager {

private var nextResponse: () -> HTTPURLResponse? = { return nil }
var nextError: NSError?
Expand Down
Loading