Skip to content

Commit c3ff79f

Browse files
committed
Merge branch 'main' into feat/replay
2 parents 41f816a + 148f924 commit c3ff79f

File tree

31 files changed

+958
-279
lines changed

31 files changed

+958
-279
lines changed

CHANGELOG.md

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,59 @@
88

99
Access to Mobile Replay is limited to early access orgs on Sentry. If you're interested, [sign up for the waitlist](https://sentry.io/lp/mobile-replay-beta/)
1010

11+
## 5.24.1
12+
13+
### Fixes
14+
15+
- App Start Native Frames can start with zeroed values ([#3881](https://github.com/getsentry/sentry-react-native/pull/3881))
16+
17+
### Dependencies
18+
19+
- Bump Cocoa SDK from v8.28.0 to v8.29.1 ([#3890](https://github.com/getsentry/sentry-react-native/pull/3890))
20+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8291)
21+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.28.0...8.29.1)
22+
23+
## 5.24.0
24+
25+
### Features
26+
27+
- Add native application start spans ([#3855](https://github.com/getsentry/sentry-react-native/pull/3855), [#3884](https://github.com/getsentry/sentry-react-native/pull/3884))
28+
- This doesn't change the app start measurement length, but add child spans (more detail) into the existing app start span
29+
- Added JS Bundle Execution start information to the application start measurements ([#3857](https://github.com/getsentry/sentry-react-native/pull/3857))
30+
31+
### Fixes
32+
33+
- Add more expressive debug logs to Native Frames Integration ([#3880](https://github.com/getsentry/sentry-react-native/pull/3880))
34+
- Add missing tracing integrations when using `client.init()` ([#3882](https://github.com/getsentry/sentry-react-native/pull/3882))
35+
- Ensure `sentry-cli` doesn't trigger Xcode `error:` prefix ([#3887](https://github.com/getsentry/sentry-react-native/pull/3887))
36+
- Fixes `--allow-failure` failing Xcode builds
37+
38+
### Dependencies
39+
40+
- Bump Cocoa SDK from v8.27.0 to v8.28.0 ([#3866](https://github.com/getsentry/sentry-react-native/pull/3866))
41+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8280)
42+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.27.0...8.28.0)
43+
- Bump Android SDK from v7.8.0 to v7.10.0 ([#3805](https://github.com/getsentry/sentry-react-native/pull/3805))
44+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7100)
45+
- [diff](https://github.com/getsentry/sentry-java/compare/7.8.0...7.10.0)
46+
- Bump JavaScript SDK from v7.113.0 to v7.117.0 ([#3806](https://github.com/getsentry/sentry-react-native/pull/3806))
47+
- [changelog](https://github.com/getsentry/sentry-javascript/blob/v7/CHANGELOG.md#71170)
48+
- [diff](https://github.com/getsentry/sentry-javascript/compare/7.113.0...7.117.0)
49+
50+
## 5.23.1
51+
52+
### Fixes
53+
54+
- Fix failing iOS builds due to missing SentryLevel ([#3854](https://github.com/getsentry/sentry-react-native/pull/3854))
55+
- Add missing logs to dropped App Start spans ([#3861](https://github.com/getsentry/sentry-react-native/pull/3861))
56+
- Make all options of `startTimeToInitialDisplaySpan` optional ([#3867](https://github.com/getsentry/sentry-react-native/pull/3867))
57+
- Add Span IDs to Time to Display debug logs ([#3868](https://github.com/getsentry/sentry-react-native/pull/3868))
58+
- Use TTID end timestamp when TTFD should be updated with an earlier timestamp ([#3869](https://github.com/getsentry/sentry-react-native/pull/3869))
59+
60+
## 5.23.0
61+
62+
This release does *not* build on iOS. Please use `5.23.1` or newer.
63+
1164
### Features
1265

1366
- Functional integrations ([#3814](https://github.com/getsentry/sentry-react-native/pull/3814))
@@ -638,7 +691,7 @@ This release is compatible with `[email protected]` and newer.
638691
});
639692
```
640693

641-
Read more at https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#7690
694+
Read more at <https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#7690>
642695

643696
- Report current screen in `contexts.app.view_names` ([#3339](https://github.com/getsentry/sentry-react-native/pull/3339))
644697

@@ -1029,6 +1082,7 @@ This has been fixed in [version `5.9.1`](https://github.com/getsentry/sentry-rea
10291082
## 5.4.0
10301083

10311084
### Features
1085+
10321086
- Add TS 4.1 typings ([#2995](https://github.com/getsentry/sentry-react-native/pull/2995))
10331087
- TS 3.8 are present and work automatically with older projects
10341088
- Add CPU Info to Device Context ([#2984](https://github.com/getsentry/sentry-react-native/pull/2984))
@@ -2676,7 +2730,7 @@ We are looking into ways making this more stable and plan to re-enable it again
26762730

26772731
## v0.23.2
26782732

2679-
- Fixed #228 again ¯\\_(ツ)_
2733+
- Fixed #228 again ¯\\*(ツ)*
26802734

26812735
## v0.23.1
26822736

RNSentry.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Pod::Spec.new do |s|
3333
s.preserve_paths = '*.js'
3434

3535
s.dependency 'React-Core'
36-
s.dependency 'Sentry/HybridSDK', '8.27.0'
36+
s.dependency 'Sentry/HybridSDK', '8.29.1'
3737

3838
s.source_files = 'ios/**/*.{h,m,mm}'
3939
s.public_header_files = 'ios/RNSentry.h'

RNSentryCocoaTester/RNSentryCocoaTester.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
330F308C2C0F3840002A0D4E /* RNSentryBreadcrumbTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 330F308B2C0F3840002A0D4E /* RNSentryBreadcrumbTests.m */; };
1011
33958C692BFCF12600AD1FB6 /* RNSentryOnDrawReporterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 33958C682BFCF12600AD1FB6 /* RNSentryOnDrawReporterTests.m */; };
1112
33AFDFED2B8D14B300AAB120 /* RNSentryFramesTrackerListenerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 33AFDFEC2B8D14B300AAB120 /* RNSentryFramesTrackerListenerTests.m */; };
1213
33AFDFF12B8D15E500AAB120 /* RNSentryDependencyContainerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 33AFDFF02B8D15E500AAB120 /* RNSentryDependencyContainerTests.m */; };
@@ -16,6 +17,8 @@
1617

1718
/* Begin PBXFileReference section */
1819
1482D5685A340AB93348A43D /* Pods-RNSentryCocoaTesterTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNSentryCocoaTesterTests.release.xcconfig"; path = "Target Support Files/Pods-RNSentryCocoaTesterTests/Pods-RNSentryCocoaTesterTests.release.xcconfig"; sourceTree = "<group>"; };
20+
330F308B2C0F3840002A0D4E /* RNSentryBreadcrumbTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNSentryBreadcrumbTests.m; sourceTree = "<group>"; };
21+
330F308D2C0F385A002A0D4E /* RNSentryBreadcrumb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNSentryBreadcrumb.h; path = ../ios/RNSentryBreadcrumb.h; sourceTree = "<group>"; };
1922
3360898D29524164007C7730 /* RNSentryCocoaTesterTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNSentryCocoaTesterTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
2023
338739072A7D7D2800950DDD /* RNSentryTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNSentryTests.h; sourceTree = "<group>"; };
2124
33958C672BFCEF5A00AD1FB6 /* RNSentryOnDrawReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNSentryOnDrawReporter.h; path = ../ios/RNSentryOnDrawReporter.h; sourceTree = "<group>"; };
@@ -80,13 +83,15 @@
8083
33AFDFF02B8D15E500AAB120 /* RNSentryDependencyContainerTests.m */,
8184
33AFDFF22B8D15F600AAB120 /* RNSentryDependencyContainerTests.h */,
8285
33958C682BFCF12600AD1FB6 /* RNSentryOnDrawReporterTests.m */,
86+
330F308B2C0F3840002A0D4E /* RNSentryBreadcrumbTests.m */,
8387
);
8488
path = RNSentryCocoaTesterTests;
8589
sourceTree = "<group>";
8690
};
8791
33AFE0122B8F319000AAB120 /* RNSentry */ = {
8892
isa = PBXGroup;
8993
children = (
94+
330F308D2C0F385A002A0D4E /* RNSentryBreadcrumb.h */,
9095
33958C672BFCEF5A00AD1FB6 /* RNSentryOnDrawReporter.h */,
9196
33AFE0132B8F31AF00AAB120 /* RNSentryDependencyContainer.h */,
9297
);
@@ -204,6 +209,7 @@
204209
33AFDFF12B8D15E500AAB120 /* RNSentryDependencyContainerTests.m in Sources */,
205210
33F58AD02977037D008F60EA /* RNSentryTests.mm in Sources */,
206211
33958C692BFCF12600AD1FB6 /* RNSentryOnDrawReporterTests.m in Sources */,
212+
330F308C2C0F3840002A0D4E /* RNSentryBreadcrumbTests.m in Sources */,
207213
33AFDFED2B8D14B300AAB120 /* RNSentryFramesTrackerListenerTests.m in Sources */,
208214
);
209215
runOnlyForDeploymentPostprocessing = 0;
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#import <XCTest/XCTest.h>
2+
#import "RNSentryBreadcrumb.h"
3+
@import Sentry;
4+
5+
@interface RNSentryBreadcrumbTests : XCTestCase
6+
7+
@end
8+
9+
@implementation RNSentryBreadcrumbTests
10+
11+
- (void)testGeneratesSentryBreadcrumbFromNSDictionary
12+
{
13+
SentryBreadcrumb* actualCrumb = [RNSentryBreadcrumb from:@{
14+
@"level": @"error",
15+
@"category": @"testCategory",
16+
@"type": @"testType",
17+
@"message": @"testMessage",
18+
@"data": @{
19+
@"test": @"data"
20+
}
21+
}];
22+
23+
XCTAssertEqual(actualCrumb.level, kSentryLevelError);
24+
XCTAssertEqual(actualCrumb.category, @"testCategory");
25+
XCTAssertEqual(actualCrumb.type, @"testType");
26+
XCTAssertEqual(actualCrumb.message, @"testMessage");
27+
XCTAssertTrue([actualCrumb.data isKindOfClass:[NSDictionary class]]);
28+
XCTAssertEqual(actualCrumb.data[@"test"], @"data");
29+
}
30+
31+
- (void)testUsesInfoAsDefaultSentryLevel
32+
{
33+
SentryBreadcrumb* actualCrumb = [RNSentryBreadcrumb from:@{
34+
@"message": @"testMessage",
35+
}];
36+
37+
XCTAssertEqual(actualCrumb.level, kSentryLevelInfo);
38+
}
39+
40+
@end

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,5 @@ android {
5454

5555
dependencies {
5656
implementation 'com.facebook.react:react-native:+'
57-
api 'io.sentry:sentry-android:7.9.0-alpha.1'
57+
api 'io.sentry:sentry-android:7.11.0-alpha.2'
5858
}

android/src/main/java/io/sentry/react/RNSentryModuleImpl.java

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public class RNSentryModuleImpl {
105105
private FrameMetricsAggregator frameMetricsAggregator = null;
106106
private boolean androidXAvailable;
107107

108-
private static boolean didFetchAppStart;
108+
private static boolean hasFetchedAppStart;
109109

110110
// 700ms to constitute frozen frames.
111111
private static final int FROZEN_FRAME_THRESHOLD = 700;
@@ -369,28 +369,17 @@ public void fetchNativeRelease(Promise promise) {
369369
}
370370

371371
public void fetchNativeAppStart(Promise promise) {
372-
final AppStartMetrics appStartInstance = AppStartMetrics.getInstance();
373-
final SentryDate appStartTime = appStartInstance.getAppStartTimeSpan().getStartTimestamp();
374-
final boolean isColdStart = appStartInstance.getAppStartType() == AppStartMetrics.AppStartType.COLD;
372+
final Map<String, Object> measurement = InternalSentrySdk.getAppStartMeasurement();
375373

376-
if (appStartTime == null) {
377-
logger.log(SentryLevel.WARNING, "App start won't be sent due to missing appStartTime.");
378-
promise.resolve(null);
379-
} else {
380-
final double appStartTimestampMs = DateUtils.nanosToMillis(appStartTime.nanoTimestamp());
381-
382-
WritableMap appStart = Arguments.createMap();
383-
384-
appStart.putDouble("appStartTime", appStartTimestampMs);
385-
appStart.putBoolean("isColdStart", isColdStart);
386-
appStart.putBoolean("didFetchAppStart", didFetchAppStart);
374+
WritableMap mutableMeasurement = (WritableMap) RNSentryMapConverter.convertToWritable(measurement);
375+
mutableMeasurement.putBoolean("has_fetched", hasFetchedAppStart);
387376

388-
promise.resolve(appStart);
389-
}
390377
// This is always set to true, as we would only allow an app start fetch to only
391378
// happen once in the case of a JS bundle reload, we do not want it to be
392379
// instrumented again.
393-
didFetchAppStart = true;
380+
hasFetchedAppStart = true;
381+
382+
promise.resolve(mutableMeasurement);
394383
}
395384

396385
/**
@@ -427,11 +416,6 @@ public void fetchNativeFrames(Promise promise) {
427416
}
428417
}
429418

430-
if (totalFrames == 0 && slowFrames == 0 && frozenFrames == 0) {
431-
promise.resolve(null);
432-
return;
433-
}
434-
435419
WritableMap map = Arguments.createMap();
436420
map.putInt("totalFrames", totalFrames);
437421
map.putInt("slowFrames", slowFrames);

ios/RNSentry.mm

Lines changed: 12 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#import <Sentry/SentryFormatter.h>
2424
#import <Sentry/SentryAppStartMeasurement.h>
2525
#import "RNSentryId.h"
26+
#import "RNSentryBreadcrumb.h"
2627

2728
// This guard prevents importing Hermes in JSC apps
2829
#if SENTRY_PROFILING_ENABLED
@@ -54,7 +55,7 @@ + (void)storeEnvelope:(SentryEnvelope *)envelope;
5455

5556
@end
5657

57-
static bool didFetchAppStart;
58+
static bool hasFetchedAppStart;
5859

5960
static NSString* const nativeSdkName = @"sentry.cocoa.react-native";
6061

@@ -400,24 +401,20 @@ - (NSDictionary*) fetchNativeStackFramesBy: (NSArray<NSNumber*>*)instructionsAdd
400401
rejecter:(RCTPromiseRejectBlock)reject)
401402
{
402403
#if SENTRY_HAS_UIKIT
403-
SentryAppStartMeasurement *appStartMeasurement = PrivateSentrySDKOnly.appStartMeasurement;
404-
405-
if (appStartMeasurement == nil) {
404+
NSDictionary<NSString *, id> *measurements = [PrivateSentrySDKOnly appStartMeasurementWithSpans];
405+
if (measurements == nil) {
406406
resolve(nil);
407-
} else {
408-
BOOL isColdStart = appStartMeasurement.type == SentryAppStartTypeCold;
409-
410-
resolve(@{
411-
@"isColdStart": [NSNumber numberWithBool:isColdStart],
412-
@"appStartTime": [NSNumber numberWithDouble:(appStartMeasurement.appStartTimestamp.timeIntervalSince1970 * 1000)],
413-
@"didFetchAppStart": [NSNumber numberWithBool:didFetchAppStart],
414-
});
415-
407+
return;
416408
}
417409

410+
NSMutableDictionary<NSString *, id> *mutableMeasurements = [[NSMutableDictionary alloc] initWithDictionary:measurements];
411+
[mutableMeasurements setValue:[NSNumber numberWithBool:hasFetchedAppStart] forKey:@"has_fetched"];
412+
418413
// This is always set to true, as we would only allow an app start fetch to only happen once
419414
// in the case of a JS bundle reload, we do not want it to be instrumented again.
420-
didFetchAppStart = true;
415+
hasFetchedAppStart = true;
416+
417+
resolve(mutableMeasurements);
421418
#else
422419
resolve(nil);
423420
#endif
@@ -439,12 +436,6 @@ - (NSDictionary*) fetchNativeStackFramesBy: (NSArray<NSNumber*>*)instructionsAdd
439436
NSNumber *total = [NSNumber numberWithLong:frames.total];
440437
NSNumber *frozen = [NSNumber numberWithLong:frames.frozen];
441438
NSNumber *slow = [NSNumber numberWithLong:frames.slow];
442-
NSNumber *zero = [NSNumber numberWithLong:0L];
443-
444-
if ([total isEqualToNumber:zero] && [frozen isEqualToNumber:zero] && [slow isEqualToNumber:zero]) {
445-
resolve(nil);
446-
return;
447-
}
448439

449440
resolve(@{
450441
@"totalFrames": total,
@@ -578,32 +569,7 @@ - (NSDictionary*) fetchNativeStackFramesBy: (NSArray<NSNumber*>*)instructionsAdd
578569
RCT_EXPORT_METHOD(addBreadcrumb:(NSDictionary *)breadcrumb)
579570
{
580571
[SentrySDK configureScope:^(SentryScope * _Nonnull scope) {
581-
SentryBreadcrumb* breadcrumbInstance = [[SentryBreadcrumb alloc] init];
582-
583-
NSString * levelString = breadcrumb[@"level"];
584-
SentryLevel sentryLevel;
585-
if ([levelString isEqualToString:@"fatal"]) {
586-
sentryLevel = kSentryLevelFatal;
587-
} else if ([levelString isEqualToString:@"warning"]) {
588-
sentryLevel = kSentryLevelWarning;
589-
} else if ([levelString isEqualToString:@"error"]) {
590-
sentryLevel = kSentryLevelError;
591-
} else if ([levelString isEqualToString:@"debug"]) {
592-
sentryLevel = kSentryLevelDebug;
593-
} else {
594-
sentryLevel = kSentryLevelInfo;
595-
}
596-
[breadcrumbInstance setLevel:sentryLevel];
597-
598-
[breadcrumbInstance setCategory:breadcrumb[@"category"]];
599-
600-
[breadcrumbInstance setType:breadcrumb[@"type"]];
601-
602-
[breadcrumbInstance setMessage:breadcrumb[@"message"]];
603-
604-
[breadcrumbInstance setData:breadcrumb[@"data"]];
605-
606-
[scope addBreadcrumb:breadcrumbInstance];
572+
[scope addBreadcrumb:[RNSentryBreadcrumb from:breadcrumb]];
607573
}];
608574
}
609575

ios/RNSentryBreadcrumb.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#import <Foundation/Foundation.h>
2+
3+
@class SentryBreadcrumb;
4+
5+
@interface RNSentryBreadcrumb : NSObject
6+
7+
+ (SentryBreadcrumb *)from: (NSDictionary *) dict;
8+
9+
@end

ios/RNSentryBreadcrumb.m

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#import "RNSentryBreadcrumb.h"
2+
@import Sentry;
3+
4+
@implementation RNSentryBreadcrumb
5+
6+
+(SentryBreadcrumb*) from: (NSDictionary *) dict
7+
{
8+
SentryBreadcrumb* crumb = [[SentryBreadcrumb alloc] init];
9+
10+
NSString * levelString = dict[@"level"];
11+
SentryLevel sentryLevel;
12+
if ([levelString isEqualToString:@"fatal"]) {
13+
sentryLevel = kSentryLevelFatal;
14+
} else if ([levelString isEqualToString:@"warning"]) {
15+
sentryLevel = kSentryLevelWarning;
16+
} else if ([levelString isEqualToString:@"error"]) {
17+
sentryLevel = kSentryLevelError;
18+
} else if ([levelString isEqualToString:@"debug"]) {
19+
sentryLevel = kSentryLevelDebug;
20+
} else {
21+
sentryLevel = kSentryLevelInfo;
22+
}
23+
24+
[crumb setLevel:sentryLevel];
25+
[crumb setCategory:dict[@"category"]];
26+
[crumb setType:dict[@"type"]];
27+
[crumb setMessage:dict[@"message"]];
28+
[crumb setData:dict[@"data"]];
29+
30+
return crumb;
31+
}
32+
33+
@end

0 commit comments

Comments
 (0)