Skip to content

Commit

Permalink
Merge branch 'main' into feat/transactions-for-crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
philipphofmann committed Nov 7, 2024
2 parents 32518c2 + 66d0583 commit 0f07f4f
Show file tree
Hide file tree
Showing 32 changed files with 275 additions and 138 deletions.
2 changes: 1 addition & 1 deletion .github/last-release-runid
Original file line number Diff line number Diff line change
@@ -1 +1 @@
11404022886
11685387200
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

## Unreleased

### Fixes

- Session replay masking not working inside scroll view (#4498)

### Improvements

- Add extra logs for UIViewControllerSwizzling (#4511)

## 8.40.0

## Feature

- Add option to report uncaught NSExceptions on macOS (#4471)
Expand All @@ -16,6 +26,7 @@
- Improve frames tracker performance (#4469)
- Log a warning when dropping envelopes due to rate-limiting (#4463)
- Expose `SentrySessionReplayIntegration-Hybrid.h` as `private` (#4486)
- Stops session replay if rate limiting is activated (#4496)
- Add `maskedViewClasses` and `unmaskedViewClasses` to SentryReplayOptions init via dict (#4492)
- Add `quality` to SentryReplayOptions init via dict (#4495)

Expand Down
8 changes: 4 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ let package = Package(
targets: [
.binaryTarget(
name: "Sentry",
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.39.0-beta.1/Sentry.xcframework.zip",
checksum: "0e82bbb2f5714b52249da238cefd5c2ded20e69b52d2c812cc3ac804f02fa0f9" //Sentry-Static
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.40.0/Sentry.xcframework.zip",
checksum: "aa02c15ed98f2560436ccbcc0d25c848f2e8250c28c6c4a01ff3ac4231eb008b" //Sentry-Static
),
.binaryTarget(
name: "Sentry-Dynamic",
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.39.0-beta.1/Sentry-Dynamic.xcframework.zip",
checksum: "77822c632e846f5a19f3042ad89713885dcdc3d953ab49f4f1d8631170459598" //Sentry-Dynamic
url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.40.0/Sentry-Dynamic.xcframework.zip",
checksum: "a24eeb1737a531d56c8b4ce6f63b2d1fb1a2a0fd05c4eb85a27ece8fe3e442b5" //Sentry-Dynamic
),
.target ( name: "SentrySwiftUI",
dependencies: ["Sentry", "SentryInternal"],
Expand Down
2 changes: 1 addition & 1 deletion Samples/iOS-Swift/iOS-Swift/Sample.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MARKETING_VERSION = 8.39.0
MARKETING_VERSION = 8.40.0
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class TableViewController: UITableViewController {

let w = 1.0 - (Double(indexPath.row) / 99)
cell.backgroundColor = UIColor(white: CGFloat(w), alpha: 1)
cell.textLabel?.text = "Row #\(indexPath.row)"

return cell
}
Expand Down
2 changes: 1 addition & 1 deletion Sentry.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Sentry"
s.version = "8.39.0-beta.1"
s.version = "8.40.0"
s.summary = "Sentry client for cocoa"
s.homepage = "https://github.com/getsentry/sentry-cocoa"
s.license = "mit"
Expand Down
4 changes: 0 additions & 4 deletions Sentry.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
621D9F2F2B9B0320003D94DE /* SentryCurrentDateProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 621D9F2E2B9B0320003D94DE /* SentryCurrentDateProvider.swift */; };
621F61F12BEA073A005E654F /* SentryEnabledFeaturesBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 621F61F02BEA073A005E654F /* SentryEnabledFeaturesBuilder.swift */; };
6221BBCA2CAA932100C627CA /* SentryANRType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6221BBC92CAA932100C627CA /* SentryANRType.swift */; };
6229416A2BB2F123004765D1 /* SentryNSDataUtilsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 622941692BB2F123004765D1 /* SentryNSDataUtilsTests.swift */; };
622C08D829E546F4002571D4 /* SentryTraceOrigins.h in Headers */ = {isa = PBXBuildFile; fileRef = 622C08D729E546F4002571D4 /* SentryTraceOrigins.h */; };
622C08DB29E554B9002571D4 /* SentrySpanContext+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 622C08D929E554B9002571D4 /* SentrySpanContext+Private.h */; };
62375FB92B47F9F000CC55F1 /* SentryDependencyContainerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62375FB82B47F9F000CC55F1 /* SentryDependencyContainerTests.swift */; };
Expand Down Expand Up @@ -1083,7 +1082,6 @@
621D9F2E2B9B0320003D94DE /* SentryCurrentDateProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryCurrentDateProvider.swift; sourceTree = "<group>"; };
621F61F02BEA073A005E654F /* SentryEnabledFeaturesBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryEnabledFeaturesBuilder.swift; sourceTree = "<group>"; };
6221BBC92CAA932100C627CA /* SentryANRType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryANRType.swift; sourceTree = "<group>"; };
622941692BB2F123004765D1 /* SentryNSDataUtilsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryNSDataUtilsTests.swift; sourceTree = "<group>"; };
622C08D729E546F4002571D4 /* SentryTraceOrigins.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentryTraceOrigins.h; path = include/SentryTraceOrigins.h; sourceTree = "<group>"; };
622C08D929E554B9002571D4 /* SentrySpanContext+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "SentrySpanContext+Private.h"; path = "include/SentrySpanContext+Private.h"; sourceTree = "<group>"; };
62375FB82B47F9F000CC55F1 /* SentryDependencyContainerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SentryDependencyContainerTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2928,7 +2926,6 @@
children = (
7B6438A626A70DDB000D0F65 /* UIViewControllerSentryTests.swift */,
7B0DC73328869BF40039995F /* NSMutableDictionarySentryTests.swift */,
622941692BB2F123004765D1 /* SentryNSDataUtilsTests.swift */,
);
path = Categories;
sourceTree = "<group>";
Expand Down Expand Up @@ -4931,7 +4928,6 @@
7B2A70DF27D60904008B0D15 /* SentryTestThreadWrapper.swift in Sources */,
62F4DDA12C04CB9700588890 /* SentryBaggageSerializationTests.swift in Sources */,
7BE912AF272166DD00E49E62 /* SentryNoOpSpanTests.swift in Sources */,
6229416A2BB2F123004765D1 /* SentryNSDataUtilsTests.swift in Sources */,
7B56D73524616E5600B842DA /* SentryConcurrentRateLimitsDictionaryTests.swift in Sources */,
7B7D8730248648AD00D2ECFF /* SentryStacktraceBuilderTests.swift in Sources */,
62E081AB29ED4322000F69FC /* SentryBreadcrumbTestDelegate.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion SentryPrivate.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "SentryPrivate"
s.version = "8.39.0-beta.1"
s.version = "8.40.0"
s.summary = "Sentry Private Library."
s.homepage = "https://github.com/getsentry/sentry-cocoa"
s.license = "mit"
Expand Down
4 changes: 2 additions & 2 deletions SentrySwiftUI.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "SentrySwiftUI"
s.version = "8.39.0-beta.1"
s.version = "8.40.0"
s.summary = "Sentry client for SwiftUI"
s.homepage = "https://github.com/getsentry/sentry-cocoa"
s.license = "mit"
Expand All @@ -19,5 +19,5 @@ Pod::Spec.new do |s|
s.watchos.framework = 'WatchKit'

s.source_files = "Sources/SentrySwiftUI/**/*.{swift,h,m}"
s.dependency 'Sentry', "8.39.0-beta.1"
s.dependency 'Sentry', "8.40.0"
end
2 changes: 1 addition & 1 deletion Sources/Configuration/SDK.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ DYLIB_INSTALL_NAME_BASE = @rpath
MACH_O_TYPE = mh_dylib
FRAMEWORK_VERSION = A

CURRENT_PROJECT_VERSION = 8.39.0
CURRENT_PROJECT_VERSION = 8.40.0

ALWAYS_SEARCH_USER_PATHS = NO
CLANG_ENABLE_OBJC_ARC = YES
Expand Down
2 changes: 1 addition & 1 deletion Sources/Configuration/SentrySwiftUI.xcconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PRODUCT_NAME = SentrySwiftUI
CURRENT_PROJECT_VERSION = 8.39.0
CURRENT_PROJECT_VERSION = 8.40.0

MACOSX_DEPLOYMENT_TARGET = 10.15
IPHONEOS_DEPLOYMENT_TARGET = 13.0
Expand Down
8 changes: 4 additions & 4 deletions Sources/Sentry/SentryClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ - (instancetype)initWithOptions:(SentryOptions *)options
fileManager:(SentryFileManager *)fileManager
deleteOldEnvelopeItems:(BOOL)deleteOldEnvelopeItems
{
NSArray<id<SentryTransport>> *transports = [SentryTransportFactory
initTransports:options
sentryFileManager:fileManager
currentDateProvider:SentryDependencyContainer.sharedInstance.dateProvider];
NSArray<id<SentryTransport>> *transports =
[SentryTransportFactory initTransports:options
sentryFileManager:fileManager
rateLimits:SentryDependencyContainer.sharedInstance.rateLimits];

SentryTransportAdapter *transportAdapter =
[[SentryTransportAdapter alloc] initWithTransports:transports options:options];
Expand Down
24 changes: 24 additions & 0 deletions Sources/Sentry/SentryDependencyContainer.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@
#import <SentryCrash.h>
#import <SentryCrashWrapper.h>
#import <SentryDebugImageProvider.h>
#import <SentryDefaultRateLimits.h>
#import <SentryDependencyContainer.h>
#import <SentryHttpDateParser.h>
#import <SentryNSNotificationCenterWrapper.h>
#import <SentryRateLimitParser.h>
#import <SentryRetryAfterHeaderParser.h>
#import <SentrySDK+Private.h>
#import <SentrySwift.h>
#import <SentrySwizzleWrapper.h>
Expand Down Expand Up @@ -215,6 +219,26 @@ - (SentryNSNotificationCenterWrapper *)notificationCenterWrapper
}
}

- (id<SentryRateLimits>)rateLimits
{
@synchronized(sentryDependencyContainerLock) {
if (_rateLimits == nil) {
SentryRetryAfterHeaderParser *retryAfterHeaderParser =
[[SentryRetryAfterHeaderParser alloc]
initWithHttpDateParser:[[SentryHttpDateParser alloc] init]
currentDateProvider:self.dateProvider];
SentryRateLimitParser *rateLimitParser =
[[SentryRateLimitParser alloc] initWithCurrentDateProvider:self.dateProvider];

_rateLimits = [[SentryDefaultRateLimits alloc]
initWithRetryAfterHeaderParser:retryAfterHeaderParser
andRateLimitParser:rateLimitParser
currentDateProvider:self.dateProvider];
}
return _rateLimits;
}
}

#if SENTRY_HAS_UIKIT
- (SentryUIDeviceWrapper *)uiDeviceWrapper SENTRY_DISABLE_THREAD_SANITIZER(
"double-checked lock produce false alarms")
Expand Down
2 changes: 1 addition & 1 deletion Sources/Sentry/SentryMeta.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ @implementation SentryMeta
// Don't remove the static keyword. If you do the compiler adds the constant name to the global
// symbol table and it might clash with other constants. When keeping the static keyword the
// compiler replaces all occurrences with the value.
static NSString *versionString = @"8.39.0-beta.1";
static NSString *versionString = @"8.40.0";
static NSString *sdkName = @"sentry.cocoa";

+ (NSString *)versionString
Expand Down
7 changes: 0 additions & 7 deletions Sources/Sentry/SentryNSDataUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,4 @@
return mutable;
}

NSUInteger
sentry_crc32ofString(NSString *value)
{
NSData *data = [value dataUsingEncoding:NSUTF8StringEncoding];
return crc32(0, data.bytes, (uInt)[data length]);
}

NS_ASSUME_NONNULL_END
24 changes: 24 additions & 0 deletions Sources/Sentry/SentrySessionReplayIntegration.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# import "SentryNSNotificationCenterWrapper.h"
# import "SentryOptions.h"
# import "SentryRandom.h"
# import "SentryRateLimits.h"
# import "SentryReachability.h"
# import "SentrySDK+Private.h"
# import "SentryScope+Private.h"
Expand Down Expand Up @@ -46,6 +47,12 @@ @implementation SentrySessionReplayIntegration {
SentryReplayOptions *_replayOptions;
SentryNSNotificationCenterWrapper *_notificationCenter;
SentryOnDemandReplay *_resumeReplayMaker;
id<SentryRateLimits> _rateLimits;
// We need to use this variable to identify whether rate limiting was ever activated for session
// replay in this session, instead of always looking for the rate status in `SentryRateLimits`
// This is the easiest way to ensure segment 0 will always reach the server, because session
// replay absolutely needs segment 0 to make replay work.
BOOL _rateLimited;
}

- (instancetype)init
Expand Down Expand Up @@ -78,6 +85,7 @@ - (void)setupWith:(SentryReplayOptions *)replayOptions enableTouchTracker:(BOOL)
{
_replayOptions = replayOptions;
_viewPhotographer = [[SentryViewPhotographer alloc] initWithRedactOptions:replayOptions];
_rateLimits = SentryDependencyContainer.sharedInstance.rateLimits;

if (touchTracker) {
_touchTracker = [[SentryTouchTracker alloc]
Expand Down Expand Up @@ -416,6 +424,12 @@ - (void)resume

- (void)start
{
if (_rateLimited) {
SENTRY_LOG_WARN(
@"This session was rate limited. Not starting session replay until next app session");
return;
}

if (self.sessionReplay != nil) {
if (self.sessionReplay.isFullSession == NO) {
[self.sessionReplay captureReplay];
Expand Down Expand Up @@ -447,6 +461,7 @@ - (void)sentrySessionEnded:(SentrySession *)session

- (void)sentrySessionStarted:(SentrySession *)session
{
_rateLimited = NO;
[self startSession];
}

Expand Down Expand Up @@ -553,6 +568,15 @@ - (void)sessionReplayNewSegmentWithReplayEvent:(SentryReplayEvent *)replayEvent
replayRecording:(SentryReplayRecording *)replayRecording
videoUrl:(NSURL *)videoUrl
{
if ([_rateLimits isRateLimitActive:kSentryDataCategoryReplay] ||
[_rateLimits isRateLimitActive:kSentryDataCategoryAll]) {
SENTRY_LOG_DEBUG(
@"Rate limiting is active for replays. Stopping session replay until next session.");
_rateLimited = YES;
[self stop];
return;
}

[SentrySDK.currentHub captureReplayEvent:replayEvent
replayRecording:replayRecording
video:videoUrl];
Expand Down
10 changes: 5 additions & 5 deletions Sources/Sentry/SentrySubClassFinder.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ - (instancetype)initWithDispatchQueue:(SentryDispatchQueueWrapper *)dispatchQueu
- (void)actOnSubclassesOfViewControllerInImage:(NSString *)imageName block:(void (^)(Class))block;
{
[self.dispatchQueue dispatchAsyncWithBlock:^{
SENTRY_LOG_DEBUG(@"ActOnSubclassesOfViewControllerInImage: %@", imageName);

Class viewControllerClass = [UIViewController class];
if (viewControllerClass == nil) {
SENTRY_LOG_DEBUG(@"UIViewController class not found.");
Expand Down Expand Up @@ -85,11 +87,9 @@ - (void)actOnSubclassesOfViewControllerInImage:(NSString *)imageName block:(void
block(NSClassFromString(className));
}

[SentryLog
logWithMessage:[NSString stringWithFormat:@"The following UIViewControllers will "
@"generate automatic transactions: %@",
[classesToSwizzle componentsJoinedByString:@", "]]
andLevel:kSentryLevelDebug];
SENTRY_LOG_DEBUG(
@"The following UIViewControllers will generate automatic transactions: %@",
[classesToSwizzle componentsJoinedByString:@", "]);
}];
}];
}
Expand Down
13 changes: 1 addition & 12 deletions Sources/Sentry/SentryTransportFactory.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ @implementation SentryTransportFactory

+ (NSArray<id<SentryTransport>> *)initTransports:(SentryOptions *)options
sentryFileManager:(SentryFileManager *)sentryFileManager
currentDateProvider:(id<SentryCurrentDateProvider>)currentDateProvider
rateLimits:(id<SentryRateLimits>)rateLimits
{
NSURLSession *session;

Expand All @@ -42,17 +42,6 @@ @implementation SentryTransportFactory
id<SentryRequestManager> requestManager =
[[SentryQueueableRequestManager alloc] initWithSession:session];

SentryHttpDateParser *httpDateParser = [[SentryHttpDateParser alloc] init];
SentryRetryAfterHeaderParser *retryAfterHeaderParser =
[[SentryRetryAfterHeaderParser alloc] initWithHttpDateParser:httpDateParser
currentDateProvider:currentDateProvider];
SentryRateLimitParser *rateLimitParser =
[[SentryRateLimitParser alloc] initWithCurrentDateProvider:currentDateProvider];
id<SentryRateLimits> rateLimits =
[[SentryDefaultRateLimits alloc] initWithRetryAfterHeaderParser:retryAfterHeaderParser
andRateLimitParser:rateLimitParser
currentDateProvider:currentDateProvider];

SentryEnvelopeRateLimit *envelopeRateLimit =
[[SentryEnvelopeRateLimit alloc] initWithRateLimits:rateLimits];

Expand Down
Loading

0 comments on commit 0f07f4f

Please sign in to comment.