Skip to content
Open
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
24 changes: 16 additions & 8 deletions Sentry.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -652,10 +652,8 @@
8E4E7C7425DAAB49006AB9E2 /* SentrySpanProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E4E7C7325DAAB49006AB9E2 /* SentrySpanProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
8E4E7C7D25DAB287006AB9E2 /* SentryTracer.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E4E7C7B25DAB287006AB9E2 /* SentryTracer.h */; };
8E4E7C8225DAB2A5006AB9E2 /* SentryTracer.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E4E7C8125DAB2A5006AB9E2 /* SentryTracer.m */; };
8E564AE8267AF22600FE117D /* SentryNetworkTrackingIntegration.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E564AE5267AF22600FE117D /* SentryNetworkTrackingIntegration.m */; };
8E564AEA267AF22600FE117D /* SentryNetworkTracker.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E564AE7267AF22600FE117D /* SentryNetworkTracker.m */; };
8E564AEF267AF24400FE117D /* SentryNetworkTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E564AEC267AF24400FE117D /* SentryNetworkTracker.h */; };
8E564AF0267AF24400FE117D /* SentryNetworkTrackingIntegration.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E564AED267AF24400FE117D /* SentryNetworkTrackingIntegration.h */; };
8E5D38DD261D4A3E000D363D /* SentryPerformanceTrackingIntegration.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E5D38DB261D4A3E000D363D /* SentryPerformanceTrackingIntegration.m */; };
8E5D38E3261D4B57000D363D /* SentryPerformanceTrackingIntegration.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E5D38E2261D4B57000D363D /* SentryPerformanceTrackingIntegration.h */; };
8E70B0FD25CB72BE002B3155 /* SentrySpanTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E70B0FC25CB72BE002B3155 /* SentrySpanTests.swift */; };
Expand Down Expand Up @@ -999,6 +997,7 @@
F46DA6C32E1DBCA000DF6E3B /* SentryScopePersistentStore+Helper.swift in Sources */ = {isa = PBXBuildFile; fileRef = F46DA6C22E1DBCA000DF6E3B /* SentryScopePersistentStore+Helper.swift */; };
F46E0BA82E6A19F900DAA75C /* SentryCrashWrapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F46E0BA72E6A19F900DAA75C /* SentryCrashWrapperTests.swift */; };
F4763A072EB3AC370006DF1E /* SentryThreadInspector.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8AFCE72E8434A0007A0E18 /* SentryThreadInspector.swift */; };
F4814D912F1807A7001D14F1 /* SentryNetworkTrackingIntegrationSwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4814D902F1807A7001D14F1 /* SentryNetworkTrackingIntegrationSwiftTests.swift */; };
F48594832F11A0670035B6EE /* SentryWatchdogTerminationConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = F485947D2F11A0610035B6EE /* SentryWatchdogTerminationConstants.swift */; };
F48E2E0A2E6637840073CB22 /* TestSentryCrashWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = F48E2E092E6637840073CB22 /* TestSentryCrashWrapper.swift */; };
F48F21F52EF1F05000E33FC1 /* SentryAppStartMeasurement+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = F48F21F42EF1F04C00E33FC1 /* SentryAppStartMeasurement+Private.h */; };
Expand All @@ -1016,6 +1015,7 @@
F4A930232E65FDBF006DA6EF /* SentryMobileProvisionParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4A930222E65FDAF006DA6EF /* SentryMobileProvisionParser.swift */; };
F4A930252E661856006DA6EF /* SentryMobileProvisionParserTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4A930242E661856006DA6EF /* SentryMobileProvisionParserTests.swift */; };
F4AACD612E01ACE800DDDD1E /* SentryCrashDynamicLinkerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F4AACD602E01ACE800DDDD1E /* SentryCrashDynamicLinkerTests.m */; };
F4C781F12F045C1F00E229CC /* SentryNetworkTrackingIntegration.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4C781EF2F045C1F00E229CC /* SentryNetworkTrackingIntegration.swift */; };
F4DC35562E1FFD620077CE89 /* SentryVideoFrameProcessor.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4DC35552E1FFD610077CE89 /* SentryVideoFrameProcessor.swift */; };
F4DC35582E1FFE1F0077CE89 /* SentryVideoFrameProcessorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4DC35572E1FFE1B0077CE89 /* SentryVideoFrameProcessorTests.swift */; };
F4DCC9DD2E4AA9D0008ECE45 /* SentrySDKSettingsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4DCC9DC2E4AA9D0008ECE45 /* SentrySDKSettingsTests.swift */; };
Expand Down Expand Up @@ -2030,10 +2030,8 @@
8E4E7C7325DAAB49006AB9E2 /* SentrySpanProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySpanProtocol.h; path = Public/SentrySpanProtocol.h; sourceTree = "<group>"; };
8E4E7C7B25DAB287006AB9E2 /* SentryTracer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryTracer.h; path = include/SentryTracer.h; sourceTree = "<group>"; };
8E4E7C8125DAB2A5006AB9E2 /* SentryTracer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SentryTracer.m; sourceTree = "<group>"; };
8E564AE5267AF22600FE117D /* SentryNetworkTrackingIntegration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SentryNetworkTrackingIntegration.m; sourceTree = "<group>"; };
8E564AE7267AF22600FE117D /* SentryNetworkTracker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SentryNetworkTracker.m; sourceTree = "<group>"; };
8E564AEC267AF24400FE117D /* SentryNetworkTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SentryNetworkTracker.h; path = include/SentryNetworkTracker.h; sourceTree = "<group>"; };
8E564AED267AF24400FE117D /* SentryNetworkTrackingIntegration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SentryNetworkTrackingIntegration.h; path = include/SentryNetworkTrackingIntegration.h; sourceTree = "<group>"; };
8E5D38DB261D4A3E000D363D /* SentryPerformanceTrackingIntegration.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryPerformanceTrackingIntegration.m; sourceTree = "<group>"; };
8E5D38E2261D4B57000D363D /* SentryPerformanceTrackingIntegration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SentryPerformanceTrackingIntegration.h; path = include/SentryPerformanceTrackingIntegration.h; sourceTree = "<group>"; };
8E70B0FC25CB72BE002B3155 /* SentrySpanTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentrySpanTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2393,6 +2391,7 @@
F465D2122E87E36F00FE2DD9 /* RateLimits.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RateLimits.swift; sourceTree = "<group>"; };
F46DA6C22E1DBCA000DF6E3B /* SentryScopePersistentStore+Helper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SentryScopePersistentStore+Helper.swift"; sourceTree = "<group>"; };
F46E0BA72E6A19F900DAA75C /* SentryCrashWrapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryCrashWrapperTests.swift; sourceTree = "<group>"; };
F4814D902F1807A7001D14F1 /* SentryNetworkTrackingIntegrationSwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryNetworkTrackingIntegrationSwiftTests.swift; sourceTree = "<group>"; };
F485947D2F11A0610035B6EE /* SentryWatchdogTerminationConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryWatchdogTerminationConstants.swift; sourceTree = "<group>"; };
F48E2E092E6637840073CB22 /* TestSentryCrashWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestSentryCrashWrapper.swift; sourceTree = "<group>"; };
F48F21F42EF1F04C00E33FC1 /* SentryAppStartMeasurement+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SentryAppStartMeasurement+Private.h"; sourceTree = "<group>"; };
Expand All @@ -2410,6 +2409,7 @@
F4A930222E65FDAF006DA6EF /* SentryMobileProvisionParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryMobileProvisionParser.swift; sourceTree = "<group>"; };
F4A930242E661856006DA6EF /* SentryMobileProvisionParserTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryMobileProvisionParserTests.swift; sourceTree = "<group>"; };
F4AACD602E01ACE800DDDD1E /* SentryCrashDynamicLinkerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SentryCrashDynamicLinkerTests.m; sourceTree = "<group>"; };
F4C781EF2F045C1F00E229CC /* SentryNetworkTrackingIntegration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryNetworkTrackingIntegration.swift; sourceTree = "<group>"; };
F4DC35552E1FFD610077CE89 /* SentryVideoFrameProcessor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryVideoFrameProcessor.swift; sourceTree = "<group>"; };
F4DC35572E1FFE1B0077CE89 /* SentryVideoFrameProcessorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryVideoFrameProcessorTests.swift; sourceTree = "<group>"; };
F4DCC9DC2E4AA9D0008ECE45 /* SentrySDKSettingsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentrySDKSettingsTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3789,8 +3789,6 @@
7BE0DC3B272AE8EB004FA8B7 /* Network */ = {
isa = PBXGroup;
children = (
8E564AED267AF24400FE117D /* SentryNetworkTrackingIntegration.h */,
8E564AE5267AF22600FE117D /* SentryNetworkTrackingIntegration.m */,
8E564AEC267AF24400FE117D /* SentryNetworkTracker.h */,
8E564AE7267AF22600FE117D /* SentryNetworkTracker.m */,
62E59A522E8FB70000DB7A7B /* SentryTracePropagation.h */,
Expand Down Expand Up @@ -3899,6 +3897,7 @@
7BE0DC43272AEA7E004FA8B7 /* Network */ = {
isa = PBXGroup;
children = (
F4814D902F1807A7001D14F1 /* SentryNetworkTrackingIntegrationSwiftTests.swift */,
8EAE8E5C2681768000D6958B /* URLSessionTaskMock.h */,
8EAE8E5D2681768000D6958B /* URLSessionTaskMock.m */,
8EA05EEC267C2AB200C82B30 /* SentryNetworkTrackerTests.swift */,
Expand Down Expand Up @@ -4742,6 +4741,7 @@
D8739CF72BECFF92007D2F66 /* Performance */ = {
isa = PBXGroup;
children = (
F4C781F02F045C1F00E229CC /* Network */,
FAB007302E9EF8CB001C806A /* SentryUIViewControllerPerformanceTracker.swift */,
FAE57BF12E83049900B710F9 /* SentryDisplayLinkWrapper.swift */,
D468C0602D36699700964230 /* IO */,
Expand Down Expand Up @@ -4979,6 +4979,14 @@
path = Profiling;
sourceTree = "<group>";
};
F4C781F02F045C1F00E229CC /* Network */ = {
isa = PBXGroup;
children = (
F4C781EF2F045C1F00E229CC /* SentryNetworkTrackingIntegration.swift */,
);
path = Network;
sourceTree = "<group>";
};
F4FE86BC2EECAC31003D845F /* Screenshot */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -5390,7 +5398,6 @@
D8853C842833EABC00700D64 /* SentryANRTrackerV1.h in Headers */,
63FE715B20DA4C1100CDBAE8 /* SentryCrashSignalInfo.h in Headers */,
63FE70E520DA4C1000CDBAE8 /* SentryCrashMonitor_CPPException.h in Headers */,
8E564AF0267AF24400FE117D /* SentryNetworkTrackingIntegration.h in Headers */,
D867063E27C3BC2400048851 /* SentryCoreDataSwizzling.h in Headers */,
7D9B07A023D1E89900C5FC8E /* SentryMeta.h in Headers */,
7B4E375525822C4500059C93 /* SentryAttachment.h in Headers */,
Expand Down Expand Up @@ -5839,9 +5846,9 @@
84DBC62C2CE82F12000C4904 /* SentryFeedback.swift in Sources */,
F41362132E1C566100B84443 /* SentryScopePersistentStore+User.swift in Sources */,
63B818FA1EC34639002FDF4C /* SentryDebugMeta.m in Sources */,
8E564AE8267AF22600FE117D /* SentryNetworkTrackingIntegration.m in Sources */,
63AA75EF1EB8B3C400D153DE /* SentryClient.m in Sources */,
D4B0DC7F2DA9257A00DE61B6 /* SentryRenderVideoResult.swift in Sources */,
F4C781F12F045C1F00E229CC /* SentryNetworkTrackingIntegration.swift in Sources */,
FAAB964E2EA698730030A2DB /* SentryDebugImageProvider.swift in Sources */,
925189AC2EDDA6A300557BD1 /* FlushLogsIntegration.swift in Sources */,
7B7D873624864C9D00D2ECFF /* SentryCrashDefaultMachineContextWrapper.m in Sources */,
Expand Down Expand Up @@ -6301,6 +6308,7 @@
A8AFFCD42907E0CA00967CD7 /* SentryRequestTests.swift in Sources */,
7BD4BD4D27EB31820071F4FF /* SentryClientReportTests.swift in Sources */,
7B98D7EC25FB7C4900C5A389 /* SentryAppStateTests.swift in Sources */,
F4814D912F1807A7001D14F1 /* SentryNetworkTrackingIntegrationSwiftTests.swift in Sources */,
62A3C7BE2B7E2A6A00C75227 /* SentrySpotlightTransportTests.swift in Sources */,
8EE017A126704CD500470616 /* SentryUIViewControllerPerformanceTrackerTests.swift in Sources */,
7B5B94352657AD21002E474B /* SentryFramesTrackingIntegrationTests.swift in Sources */,
Expand Down
6 changes: 0 additions & 6 deletions Sources/Sentry/SentryBaseIntegration.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@ - (BOOL)shouldBeEnabledWithOptions:(SentryOptions *)options
}
}

if ((integrationOptions & kIntegrationOptionEnableNetworkTracking)
&& !options.enableNetworkTracking) {
[self logWithOptionName:@"enableNetworkTracking"];
return NO;
}

if ((integrationOptions & kIntegrationOptionEnableFileIOTracing)
&& !options.enableFileIOTracing) {
[self logWithOptionName:@"enableFileIOTracing"];
Expand Down
87 changes: 0 additions & 87 deletions Sources/Sentry/SentryNetworkTrackingIntegration.m

This file was deleted.

3 changes: 1 addition & 2 deletions Sources/Sentry/SentrySDKInternal.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#import "SentryInternalDefines.h"
#import "SentryLogC.h"
#import "SentryMeta.h"
#import "SentryNetworkTrackingIntegration.h"
#import "SentryProfilingConditionals.h"
#import "SentryReplayApi.h"
#import "SentrySamplerDecision.h"
Expand Down Expand Up @@ -518,7 +517,7 @@ + (void)endSession
[SentryWatchdogTerminationTrackingIntegration class],
#endif // SENTRY_HAS_UIKIT
[SentryAutoBreadcrumbTrackingIntegration class], [SentryCoreDataTrackingIntegration class],
[SentryFileIOTrackingIntegration class], [SentryNetworkTrackingIntegration class], nil];
[SentryFileIOTrackingIntegration class], nil];

return defaultIntegrations;
}
Expand Down
36 changes: 34 additions & 2 deletions Sources/Sentry/SentrySwizzleWrapperHelper.m
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
#import "SentrySwizzleWrapperHelper.h"
#import "SentryNSURLSessionTaskSearch.h"
#import "SentryNetworkTracker.h"
#import "SentrySwizzle.h"

#if SENTRY_HAS_UIKIT
# import <UIKit/UIKit.h>
#endif // SENTRY_HAS_UIKIT

NS_ASSUME_NONNULL_BEGIN

@implementation SentrySwizzleWrapperHelper

#if SENTRY_HAS_UIKIT
+ (void)swizzle:(void (^)(SEL action, _Nullable id target, _Nullable id sender,
UIEvent *_Nullable event))callback;
{
Expand All @@ -23,9 +27,37 @@ + (void)swizzle:(void (^)(SEL action, _Nullable id target, _Nullable id sender,
SentrySwizzleModeOncePerClassAndSuperclasses, swizzleSendActionKey);
# pragma clang diagnostic pop
}
#endif // SENTRY_HAS_UIKIT

+ (void)swizzleURLSessionTask:(SentryNetworkTracker *)networkTracker
{
NSArray<Class> *classesToSwizzle = [SentryNSURLSessionTaskSearch urlSessionTaskClassesToTrack];

// SentrySwizzleInstanceMethod declaration shadows a local variable. The swizzling is working
// fine and we accept this warning.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wshadow"
SEL setStateSelector = NSSelectorFromString(@"setState:");
SEL resumeSelector = NSSelectorFromString(@"resume");

for (Class classToSwizzle in classesToSwizzle) {
SentrySwizzleInstanceMethod(classToSwizzle, resumeSelector, SentrySWReturnType(void),
SentrySWArguments(), SentrySWReplacement({
[networkTracker urlSessionTaskResume:self];
SentrySWCallOriginal();
}),
SentrySwizzleModeOncePerClassAndSuperclasses, (void *)resumeSelector);

SentrySwizzleInstanceMethod(classToSwizzle, setStateSelector, SentrySWReturnType(void),
SentrySWArguments(NSURLSessionTaskState state), SentrySWReplacement({
[networkTracker urlSessionTask:self setState:state];
SentrySWCallOriginal(state);
}),
SentrySwizzleModeOncePerClassAndSuperclasses, (void *)setStateSelector);
}
#pragma clang diagnostic pop
}

@end

NS_ASSUME_NONNULL_END

#endif // SENTRY_HAS_UIKIT
1 change: 0 additions & 1 deletion Sources/Sentry/include/SentryBaseIntegration.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ typedef NS_OPTIONS(NSUInteger, SentryIntegrationOption) {
kIntegrationOptionAttachScreenshot = 1 << 4,
kIntegrationOptionEnableUserInteractionTracing = 1 << 5,
kIntegrationOptionEnableAppHangTracking = 1 << 6,
kIntegrationOptionEnableNetworkTracking = 1 << 7,
kIntegrationOptionEnableFileIOTracing = 1 << 8,
kIntegrationOptionEnableNetworkBreadcrumbs = 1 << 9,
kIntegrationOptionEnableCoreDataTracing = 1 << 10,
Expand Down
9 changes: 0 additions & 9 deletions Sources/Sentry/include/SentryNetworkTrackingIntegration.h

This file was deleted.

Loading
Loading