Conversation
|
✅ All CI checks and tests passed. 🎉 All green!🧪 All tests passed 🔗 Commit SHA: f92f052 | Docs | View more details | Give us feedback! |
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The public API does not enforce its documented sampling-rate range, allowing invalid values to produce inconsistent native behavior.
Review effort: Balanced
Findings: 2
Open (2)
What changed in this PR
Adds a profiling package that exposes Datadog’s native iOS and Android profilers to React Native applications.
Changes:
- Adds the
DdProfiling.enableAPI and native bridges for both architectures. - Adds JavaScript and native tests, documentation, and example integrations.
- Integrates profiling into CI, packaging, and SDK version-management scripts.
| File | Description |
|---|---|
yarn.lock |
Registers the profiling workspace. |
update-version.sh |
Packages profiling during releases. |
update-native-sdk-versions.sh |
Includes profiling in version checks. |
packages/react-native-profiling/tsconfig.json |
Adds TypeScript configuration. |
packages/react-native-profiling/src/specs/NativeDdProfiling.ts |
Defines the TurboModule contract. |
packages/react-native-profiling/src/Profiling.ts |
Implements the public profiling API. |
packages/react-native-profiling/src/nativeModulesTypes.ts |
Defines native module types. |
packages/react-native-profiling/src/index.ts |
Exports the package API. |
packages/react-native-profiling/src/__tests__/Profiling.test.ts |
Tests configuration forwarding. |
packages/react-native-profiling/README.md |
Documents setup and behavior. |
packages/react-native-profiling/package.json |
Configures package build and codegen. |
packages/react-native-profiling/ios/Tests/DdProfilingTests.swift |
Tests the iOS implementation. |
packages/react-native-profiling/ios/Sources/DdProfilingImplementation.swift |
Configures the iOS profiler. |
packages/react-native-profiling/ios/Sources/DdProfiling.mm |
Implements the iOS bridge. |
packages/react-native-profiling/ios/Sources/DdProfiling.h |
Declares the iOS module. |
packages/react-native-profiling/DatadogSDKReactNativeProfiling.podspec |
Defines the profiling pod. |
packages/react-native-profiling/babel.config.js |
Adds Babel configuration. |
packages/react-native-profiling/android/src/test/kotlin/com/datadog/reactnative/tools/unit/ReflectUtils.kt |
Adds reflection test utilities. |
packages/react-native-profiling/android/src/test/kotlin/com/datadog/reactnative/tools/unit/GenericAssert.kt |
Adds native test assertions. |
packages/react-native-profiling/android/src/test/kotlin/com/datadog/reactnative/profiling/DdProfilingImplementationTest.kt |
Tests Android profiling behavior. |
packages/react-native-profiling/android/src/rnpre74/kotlin/com/datadog/reactnative/profiling/DdSDKReactNativeProfilingPackage.kt |
Registers the pre-0.74 package. |
packages/react-native-profiling/android/src/rnpost74/kotlin/com/datadog/reactnative/profiling/DdSDKReactNativeProfilingPackage.kt |
Registers the post-0.74 package. |
packages/react-native-profiling/android/src/oldarch/kotlin/com/datadog/reactnative/profiling/DdProfiling.kt |
Adds the legacy bridge module. |
packages/react-native-profiling/android/src/newarch/kotlin/com/datadog/reactnative/profiling/DdProfiling.kt |
Adds the TurboModule implementation. |
packages/react-native-profiling/android/src/main/kotlin/com/datadog/reactnative/profiling/ProfilingWrapper.kt |
Defines the profiler wrapper. |
packages/react-native-profiling/android/src/main/kotlin/com/datadog/reactnative/profiling/ProfilingSDKWrapper.kt |
Delegates to the native SDK. |
packages/react-native-profiling/android/src/main/kotlin/com/datadog/reactnative/profiling/DdProfilingImplementation.kt |
Builds Android profiler configuration. |
packages/react-native-profiling/android/src/main/AndroidManifest.xml |
Declares Android permissions. |
packages/react-native-profiling/android/settings.gradle |
Configures local Gradle dependencies. |
packages/react-native-profiling/android/gradlew.bat |
Adds the Windows Gradle wrapper. |
packages/react-native-profiling/android/gradlew |
Adds the POSIX Gradle wrapper. |
packages/react-native-profiling/android/gradle/wrapper/gradle-wrapper.properties |
Configures the Gradle distribution. |
packages/react-native-profiling/android/gradle.properties |
Defines Android build defaults. |
packages/react-native-profiling/android/detekt.yml |
Configures Kotlin analysis. |
packages/react-native-profiling/android/build.gradle |
Builds and tests the Android module. |
packages/react-native-profiling/__mocks__/react-native.ts |
Mocks the native module. |
example/src/screens/MainScreen.tsx |
Adds a JS long-task trigger. |
example/src/ddUtils.tsx |
Enables JS long-task reporting. |
example/src/App.tsx |
Enables profiling in the example. |
example/package.json |
Adds the profiling dependency. |
example/ios/Podfile.lock |
Locks profiling pods. |
example/ios/Podfile |
Includes profiling native tests. |
example-new-architecture/package.json |
Adds profiling to the new-architecture example. |
example-new-architecture/ios/Podfile.lock |
Locks new-architecture profiling pods. |
example-new-architecture/App.tsx |
Enables profiling under the new architecture. |
bump-native-dd-sdk.sh |
Includes profiling in SDK bumps. |
.gitlab-ci.yml |
Builds and tests native profiling. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| <Text style={{ marginTop: 20 }}>{this.state.resultLongTaskAction}</Text> | ||
| <Button | ||
| title="Trigger JS long task (500ms)" | ||
| accessibilityLabel="trigger_js_long_task_button" |
Comment on lines
+71
to
+74
| applicationLaunchSampleRate: | ||
| applicationLaunchSampleRate !== undefined | ||
| ? applicationLaunchSampleRate | ||
| : DEFAULTS.applicationLaunchSampleRate, |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What does this PR do?
Exposes the native Datadog Profilers for iOS and Android to be enabled and configured from the React Native SDK.
It does so by adding a new
@datadog/mobile-react-native-profilingpackage.DdProfiling.enable({ applicationLaunchSampleRate?, continuousSampleRate?, customEndpoint? })API, available on both the old and new architecture.enabledoes nothing below API 35, the native profiler's minimum.test:native-ios-profilingjob, and the Android profiling build runs intest:native-android. The version and native SDK bump scripts now include the package.exampleapp also setslongTaskThresholdMs: 200and adds a "Trigger JS long task" button, because continuous profiles are only uploaded when they capture a long task, an ANR/app hang or a vital.Motivation
Native profilers are already available and running on the native SDKs, so RN users should be able to leverage them on their apps.
Additional Notes
This PR depends on #1336 being merged (and dd-sdk-android to be bumped) before it can be merged. Otherwise TTID-based profiles will not be tracked on Android devices.
Review checklist (to be filled by reviewers)