Skip to content

Commit 5e18d8a

Browse files
Merge remote-tracking branch 'origin/main' into v6
2 parents d296b5b + 0732f34 commit 5e18d8a

File tree

16 files changed

+223
-35
lines changed

16 files changed

+223
-35
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @krystofwoldrich @lucas-zimerman
1+
* @krystofwoldrich @lucas-zimerman @antonis

CHANGELOG.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,36 @@
77
- Xcode Debug Files upload completes in foreground by default ([#4090](https://github.com/getsentry/sentry-react-native/pull/4090))
88
- Use `SENTRY_FORCE_FOREGROUND=false` for background upload
99

10+
### Dependencies
11+
12+
- Bump CLI from v2.36.1 to v2.36.4 ([#4116](https://github.com/getsentry/sentry-react-native/pull/4116), [#4131](https://github.com/getsentry/sentry-react-native/pull/4131))
13+
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2364)
14+
- [diff](https://github.com/getsentry/sentry-cli/compare/2.36.1...2.36.4)
15+
16+
## 5.33.1
17+
18+
### Internal
19+
20+
This is re-release of 5.33.0 with no changes to ensure that 5.33.1 is tagged as latest release on npmjs.com
21+
22+
## 5.33.0
23+
24+
### Features
25+
26+
- Add an option to disable native (iOS and Android) profiling for the `HermesProfiling` integration ([#4094](https://github.com/getsentry/sentry-react-native/pull/4094))
27+
28+
To disable native profilers add the `hermesProfilingIntegration`.
29+
30+
```js
31+
import * as Sentry from '@sentry/react-native';
32+
33+
Sentry.init({
34+
integrations: [
35+
Sentry.hermesProfilingIntegration({ platformProfilers: false }),
36+
],
37+
});
38+
```
39+
1040
## 6.0.0-beta.1
1141

1242
### Features
@@ -468,6 +498,24 @@ Sentry Javascript SDK 8.0.0 ([JS Docs](https://docs.sentry.io/platforms/javascri
468498

469499
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/)
470500

501+
## 5.24.2
502+
503+
### Features
504+
505+
- Add an option to disable native (iOS and Android) profiling for the `HermesProfiling` integration ([#4094](https://github.com/getsentry/sentry-react-native/pull/4094))
506+
507+
To disable native profilers add the `hermesProfilingIntegration`.
508+
509+
```js
510+
import * as Sentry from '@sentry/react-native';
511+
512+
Sentry.init({
513+
integrations: [
514+
Sentry.hermesProfilingIntegration({ platformProfilers: false }),
515+
],
516+
});
517+
```
518+
471519
## 5.24.1
472520

473521
### Fixes

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

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -718,15 +718,17 @@ private void initializeAndroidProfiler() {
718718
);
719719
}
720720

721-
public WritableMap startProfiling() {
721+
public WritableMap startProfiling(boolean platformProfilers) {
722722
final WritableMap result = new WritableNativeMap();
723-
if (androidProfiler == null) {
723+
if (androidProfiler == null && platformProfilers) {
724724
initializeAndroidProfiler();
725725
}
726726

727727
try {
728728
HermesSamplingProfiler.enable();
729-
androidProfiler.start();
729+
if (androidProfiler != null) {
730+
androidProfiler.start();
731+
}
730732

731733
result.putBoolean("started", true);
732734
} catch (Throwable e) {
@@ -741,7 +743,10 @@ public WritableMap stopProfiling() {
741743
final WritableMap result = new WritableNativeMap();
742744
File output = null;
743745
try {
744-
AndroidProfiler.ProfileEndData end = androidProfiler.endAndCollect(false, null);
746+
AndroidProfiler.ProfileEndData end = null;
747+
if (androidProfiler != null) {
748+
end = androidProfiler.endAndCollect(false, null);
749+
}
745750
HermesSamplingProfiler.disable();
746751

747752
output = File.createTempFile(
@@ -753,14 +758,16 @@ public WritableMap stopProfiling() {
753758
HermesSamplingProfiler.dumpSampledTraceToFile(output.getPath());
754759
result.putString("profile", readStringFromFile(output));
755760

756-
WritableMap androidProfile = new WritableNativeMap();
757-
byte[] androidProfileBytes = FileUtils.readBytesFromFile(end.traceFile.getPath(), maxTraceFileSize);
758-
String base64AndroidProfile = Base64.encodeToString(androidProfileBytes, NO_WRAP | NO_PADDING);
761+
if (end != null) {
762+
WritableMap androidProfile = new WritableNativeMap();
763+
byte[] androidProfileBytes = FileUtils.readBytesFromFile(end.traceFile.getPath(), maxTraceFileSize);
764+
String base64AndroidProfile = Base64.encodeToString(androidProfileBytes, NO_WRAP | NO_PADDING);
759765

760-
androidProfile.putString("sampled_profile", base64AndroidProfile);
761-
androidProfile.putInt("android_api_level", buildInfo.getSdkInfoVersion());
762-
androidProfile.putString("build_id", getProguardUuid());
763-
result.putMap("androidProfile", androidProfile);
766+
androidProfile.putString("sampled_profile", base64AndroidProfile);
767+
androidProfile.putInt("android_api_level", buildInfo.getSdkInfoVersion());
768+
androidProfile.putString("build_id", getProguardUuid());
769+
result.putMap("androidProfile", androidProfile);
770+
}
764771
} catch (Throwable e) {
765772
result.putString("error", e.toString());
766773
} finally {

packages/core/android/src/newarch/java/io/sentry/react/RNSentryModule.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ public void fetchNativeSdkInfo(Promise promise) {
139139
}
140140

141141
@Override
142-
public WritableMap startProfiling() {
143-
return this.impl.startProfiling();
142+
public WritableMap startProfiling(boolean platformProfilers) {
143+
return this.impl.startProfiling(platformProfilers);
144144
}
145145

146146
@Override

packages/core/android/src/oldarch/java/io/sentry/react/RNSentryModule.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ public void fetchNativeSdkInfo(Promise promise) {
139139
}
140140

141141
@ReactMethod(isBlockingSynchronousMethod = true)
142-
public WritableMap startProfiling() {
143-
return this.impl.startProfiling();
142+
public WritableMap startProfiling(boolean platformProfilers) {
143+
return this.impl.startProfiling(platformProfilers);
144144
}
145145

146146
@ReactMethod(isBlockingSynchronousMethod = true)

packages/core/ios/RNSentry.mm

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -649,18 +649,22 @@ - (NSDictionary*) fetchNativeStackFramesBy: (NSArray<NSNumber*>*)instructionsAdd
649649
static SentryId* nativeProfileTraceId = nil;
650650
static uint64_t nativeProfileStartTime = 0;
651651

652-
RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSDictionary *, startProfiling)
652+
RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSDictionary *, startProfiling: (BOOL)platformProfilers)
653653
{
654654
#if SENTRY_PROFILING_ENABLED
655655
try {
656656
facebook::hermes::HermesRuntime::enableSamplingProfiler();
657-
if (nativeProfileTraceId == nil && nativeProfileStartTime == 0) {
657+
if (nativeProfileTraceId == nil && nativeProfileStartTime == 0 && platformProfilers) {
658658
#if SENTRY_TARGET_PROFILING_SUPPORTED
659659
nativeProfileTraceId = [RNSentryId newId];
660660
nativeProfileStartTime = [PrivateSentrySDKOnly startProfilerForTrace: nativeProfileTraceId];
661661
#endif
662662
} else {
663-
NSLog(@"Native profiling already in progress. Currently existing trace: %@", nativeProfileTraceId);
663+
if (!platformProfilers) {
664+
NSLog(@"Native profiling is disabled. Only starting Hermes profiling.");
665+
} else {
666+
NSLog(@"Native profiling already in progress. Currently existing trace: %@", nativeProfileTraceId);
667+
}
664668
}
665669
return @{ @"started": @YES };
666670
} catch (const std::exception& ex) {

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"dependencies": {
6868
"@sentry/babel-plugin-component-annotate": "2.20.1",
6969
"@sentry/browser": "8.30.0",
70-
"@sentry/cli": "2.36.1",
70+
"@sentry/cli": "2.36.4",
7171
"@sentry/core": "8.30.0",
7272
"@sentry/react": "8.30.0",
7373
"@sentry/types": "8.30.0",

packages/core/src/js/NativeRNSentry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export interface Spec extends TurboModule {
3434
enableNativeFramesTracking(): void;
3535
fetchModules(): Promise<string | undefined | null>;
3636
fetchViewHierarchy(): Promise<number[] | undefined | null>;
37-
startProfiling(): { started?: boolean; error?: string };
37+
startProfiling(platformProfilers: boolean): { started?: boolean; error?: string };
3838
stopProfiling(): {
3939
profile?: string;
4040
nativeProfile?: UnsafeObject;

packages/core/src/js/profiling/integration.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,28 @@ const INTEGRATION_NAME = 'HermesProfiling';
2424

2525
const MS_TO_NS: number = 1e6;
2626

27+
export interface HermesProfilingOptions {
28+
/**
29+
* Enable or disable profiling of native (iOS and Android) threads
30+
*
31+
* @default true
32+
*/
33+
platformProfilers?: boolean;
34+
}
35+
36+
const defaultOptions: Required<HermesProfilingOptions> = {
37+
platformProfilers: true,
38+
};
39+
2740
/**
2841
* Profiling integration creates a profile for each transaction and adds it to the event envelope.
2942
*
3043
* @experimental
3144
*/
32-
export const hermesProfilingIntegration: IntegrationFn = () => {
45+
export const hermesProfilingIntegration = (
46+
initOptions: HermesProfilingOptions = defaultOptions,
47+
): IntegrationFn => {
48+
const usePlatformProfilers = initOptions.platformProfilers ?? true;
3349
let _currentProfile:
3450
| {
3551
span_id: string;
@@ -137,7 +153,7 @@ export const hermesProfilingIntegration: IntegrationFn = () => {
137153
* Starts a new profile and links it to the transaction.
138154
*/
139155
const _startNewProfile = (activeSpan: Span): void => {
140-
const profileStartTimestampNs = startProfiling();
156+
const profileStartTimestampNs = startProfiling(usePlatformProfilers);
141157
if (!profileStartTimestampNs) {
142158
return;
143159
}
@@ -234,8 +250,8 @@ export const hermesProfilingIntegration: IntegrationFn = () => {
234250
/**
235251
* Starts Profilers and returns the timestamp when profiling started in nanoseconds.
236252
*/
237-
export function startProfiling(): number | null {
238-
const started = NATIVE.startProfiling();
253+
export function startProfiling(platformProfilers: boolean): number | null {
254+
const started = NATIVE.startProfiling(platformProfilers);
239255
if (!started) {
240256
return null;
241257
}

packages/core/src/js/replay/mobilereplay.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export interface MobileReplayOptions {
1818
maskAllText?: boolean;
1919

2020
/**
21-
* Mask all text in recordings
21+
* Mask all images in recordings
2222
*
2323
* @default true
2424
*/

0 commit comments

Comments
 (0)