Skip to content

Commit

Permalink
feat: Send Sentry react-native SDK version in the session replay event (
Browse files Browse the repository at this point in the history
  • Loading branch information
brustolin authored Jan 22, 2025
1 parent 488c9c5 commit 1ace28c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
## Unreleased

### Features

- Send Sentry react-native SDK version in the session replay event (#4450)

### Fixes

- Add mechanism field to unhandled rejection errors ([#4457](https://github.com/getsentry/sentry-react-native/pull/4457))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,13 @@ final class RNSentryReplayOptions: XCTestCase {
}

func assertAllDefaultReplayOptionsAreNotNil(replayOptions: [String: Any]) {
XCTAssertEqual(replayOptions.count, 5)
XCTAssertEqual(replayOptions.count, 6)
XCTAssertNotNil(replayOptions["sessionSampleRate"])
XCTAssertNotNil(replayOptions["errorSampleRate"])
XCTAssertNotNil(replayOptions["maskAllImages"])
XCTAssertNotNil(replayOptions["maskAllText"])
XCTAssertNotNil(replayOptions["maskedViewClasses"])
XCTAssertNotNil(replayOptions["sdkInfo"])
}

func testSessionSampleRate() {
Expand Down
3 changes: 3 additions & 0 deletions packages/core/ios/RNSentryReplay.mm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#import "RNSentryReplay.h"
#import "RNSentryReplayBreadcrumbConverterHelper.h"
#import "RNSentryVersion.h"
#import "React/RCTTextView.h"
#import "Replay/RNSentryReplayMask.h"
#import "Replay/RNSentryReplayUnmask.h"
Expand Down Expand Up @@ -27,6 +28,8 @@ + (void)updateOptions:(NSMutableDictionary *)options
@"maskAllImages" : replayOptions[@"maskAllImages"] ?: [NSNull null],
@"maskAllText" : replayOptions[@"maskAllText"] ?: [NSNull null],
@"maskedViewClasses" : [RNSentryReplay getReplayRNRedactClasses:replayOptions],
@"sdkInfo" :
@ { @"name" : REACT_NATIVE_SDK_NAME, @"version" : REACT_NATIVE_SDK_PACKAGE_VERSION }
}
forKey:@"sessionReplay"];
}
Expand Down
1 change: 1 addition & 0 deletions packages/core/ios/RNSentryVersion.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#import <Foundation/Foundation.h>

extern NSString *const NATIVE_SDK_NAME;
extern NSString *const REACT_NATIVE_SDK_NAME;
extern NSString *const REACT_NATIVE_SDK_PACKAGE_NAME;
extern NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION;
1 change: 1 addition & 0 deletions packages/core/ios/RNSentryVersion.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#import "RNSentryVersion.h"

NSString *const NATIVE_SDK_NAME = @"sentry.cocoa.react-native";
NSString *const REACT_NATIVE_SDK_NAME = @"sentry.javascript.react-native";
NSString *const REACT_NATIVE_SDK_PACKAGE_NAME = @"npm:@sentry/react-native";
NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION = @"6.5.0";

0 comments on commit 1ace28c

Please sign in to comment.