Skip to content
Open
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
23 changes: 16 additions & 7 deletions docs/platforms/react-native/profiling/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,29 +67,38 @@ Sentry.init({

Default value `true`, platform profilers are enabled. By default both React Native JS code executed in Hermes engine and platform specific code (Swift, Objective-C, Kotlin, Java) are profiled by their respective profilers. Setting `platformProfilers` to `false` will disable profiling of the platform specific code and only the JS code executed in Hermes will be profiled. This option is available since the SDK version [5.33.0](https://github.com/getsentry/sentry-react-native/releases/tag/5.33.0).

## Android UI Profiling (experimental)
## UI Profiling (experimental)

<Alert>

Profiling for React Native is available in SDK versions `7.9.0` and above. Android is currently the only supported platform, and support is still experimental.
UI Profiling for React Native is available in SDK versions `7.9.0` and above on Android. iOS support was added in `7.12.0`. This feature is still experimental.

</Alert>

```javascript
import * as Sentry from '@sentry/react-native';
import * as Sentry from "@sentry/react-native";

Sentry.init({
dsn: 'YOUR_DSN',
dsn: "YOUR_DSN",
tracesSampleRate: 1.0, // Required for trace mode

_experiments: {
androidProfilingOptions: {
profilingOptions: {
profileSessionSampleRate: 1.0,
lifecycle: 'trace',
lifecycle: "trace",
startOnAppStart: true,
},
Comment on lines +86 to 90
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The documentation suggests startOnAppStart: true works for iOS, but this option is not supported by the native iOS SDK and will be silently ignored.
Severity: MEDIUM

Suggested Fix

Update the documentation to clarify that startOnAppStart is an Android-only option. Provide separate configuration examples or add a note explaining the platform-specific behavior within the unified example.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: docs/platforms/react-native/profiling/index.mdx#L86-L90

Potential issue: The documentation provides a unified `profilingOptions` configuration
example that includes `startOnAppStart: true`, implying it works for both Android and
iOS. However, this option is only supported on Android. The native iOS SDK for UI
profiling does not have an equivalent option. As a result, when developers use this
configuration for an iOS application, the `startOnAppStart` setting will be silently
ignored, and profiling will not begin on application launch as expected. This creates a
discrepancy where a documented feature fails to work on one of the supported platforms
without any warning or error.

Did we get this right? 👍 / 👎 to inform future reviews.

},
});
```

For more information, see [the Android SDK documentation](https://docs.sentry.io/platforms/android/profiling/#enabling-ui-profiling)
<Note>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<Note>
<Alert>

Hey @alwx, I think this is why your builds are failing, we deprecated <Note> a while back, if you change these to <Alert> it should resolve it.


The `androidProfilingOptions` key is now deprecated. Use `profilingOptions` instead.

</Note>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
</Note>
</Alert>


For more information, see the platform-specific documentation:

- [Android SDK documentation](https://docs.sentry.io/platforms/android/profiling/#enabling-ui-profiling)
- [iOS SDK documentation](https://docs.sentry.io/platforms/apple/guides/ios/profiling/#enable-ui-profiling)
Loading