First of all, thanks for contributing!
This document provides some basic guidelines for contributing to this repository. To propose improvements, feel free to submit a PR or open an Issue.
Note: Datadog requires that all commits within this repository must be signed, including those within external contribution PRs. Please ensure you have followed GitHub's Signing Commits guide before proposing a contribution. PRs lacking signed commits will not be processed and may be rejected.
To get started with the project, run yarn install
in the root directory to install the required dependencies for each package:
yarn install
This repository contains 2 main projects:
- SDK project (in the
packages
folder), which consists of the following workspaces:codepush
: an integration for the react-native-code-push library.core
: the core React Native SDK allowing tracking of logs, spans and RUM events.react-native-apollo-client
: an integration for the Apollo Client library.react-native-navigation
: an integration for the react-native-navigation library.react-native-webview
: an integration for thereact-native-webview
library.react-navigation
: an integration for the react-navigation library.
- Sample app project (in the
example
folder)
The sample app project exists as dedicated project, because the React Native tooling, the Metro
bundler specifically, doesn't support symbolic links, and symbolic links are used by the yarn workspaces to have a single place for hosting node_modules
.
Workspaces are managed with Lerna.
If you are using Visual Studio Code, please make sure to set workspace version of TypeScript instead of the native Typescript bundled with Visual Studio, check this to see how to do it.
To edit the Objective-C and Swift files, open example/ios/DdSdkReactNativeExample.xcworkspace
in XCode and find the source files at Pods > Development Pods > DdSdkReactNative
.
To edit the Kotlin files, open example/android
in Android studio and find the source files at ddsdkreactnative
under Android
.
You can find an app ready for developing with the new architecture under example-new-architecture/
.
Create a ddCredentials.js
file at the root of the app containing your datadog credentials:
export const APPLICATION_ID = '<APP_ID>';
export const CLIENT_TOKEN = '<CLIENT_TOKEN>';
export const ENVIRONMENT = '<ENVIRONMENT>';
You can run the samples, linters and test using the following commands:
# Run the Unit Tests
yarn test
# Run the linter
yarn lint
# Run a command for the particular workspace (ex. @datadog/mobile-react-native)
yarn workspace @datadog/mobile-react-native <command>
The example
folder contains a sample React Native application used to develop and test the SDK.
To run it properly, you need to create a example/src/ddCredentials.js
file with the following content:
export const APPLICATION_ID = "<YOUR_APPLICATION_ID>";
export const CLIENT_TOKEN = "<YOUR_CLIENT_TOKEN>";
export const ENVIRONMENT = "<YOUR_ENVIRONMENT_NAME>";
You can then run the sample app using the following commands (from example
folder, make sure to do yarn install
before):
# Run the Android sample
yarn android
# Run the ios sample
yarn ios
To bump your SDK version, run the following command, where x.y.z
is the new version you want to set:
./update-version x.y.z
This bumps the versions in the lerna.json
and related package.json
files, and commits them.
To publish the packages, run the following command:
yarn run lerna publish from-package
This publishes the packages and also adds updated gitHead
to the corresponding package.json
files.
cd path/to/dd-sdk-reactnative && yarn workspace @datadog/mobile-react-native pack
- this creates a tarball from your local & unpublished package
cd {some other folder} && react-native init SomeAppName --version 0.63.4 && cd SomeAppName
npm install --save path/to/dd-sdk-reactnative/packages/core/{tarball that npm pack created}
- this installs the unpublished version of
@datadog/mobile-react-native
from your local
- this installs the unpublished version of
If for some reason yarn pack
doesn't work, you can do the workaround below after creating SomeAppName
:
yarn install --save path/to/dd-sdk-reactnative/packages/core
open node_modules
and remove symlink to@datadog/mobile-react-native
- copy the real
@datadog/mobile-react-native
folder tonode_modules
react-native
doesn't support symlinks and JS engine givesunresolved module: @datadog/mobile-react-native
when you import it in your JS code
Now you can proceed to /ios
:
cd ../ios && open SomeAppName.xcworkspace
- make the changes below in
Podfile
and runpod install
platform :ios, '12.0'
use_frameworks!
# and disable Flipper related lines
NOTE: You do NOT need to add DdSdkReactNative
here manually, pod install
should find and install it automatically
Now you can go back to your App.js/tsx
and use @datadog/mobile-react-native
from there
Example code:
import { DdSdkReactNative, DdSdkReactNativeConfiguration } from '@datadog/mobile-react-native';
const App: () => React$Node = () => {
const config = new DdSdkReactNativeConfiguration(
"<CLIENT_TOKEN>",
"<ENVIRONMENT_NAME>",
"<RUM_APPLICATION_ID>",
true, // track User interactions (e.g.: Tap on buttons)
true, // track XHR Resources
true // track Errors
)
DdSdkReactNative.initialize(config);
...
Then your project should work without problems ✅
If it doesn't, you should fix it before shipping ❌
Many great ideas for new features come from the community, and we'd be happy to consider yours!
To share your request, you can open an issue with the details about what you'd like to see. At a minimum, please provide:
- The goal of the new feature;
- A description of how it might be used or behave;
- Links to any important resources (e.g. Github repos, websites, screenshots, specifications, diagrams).
For any urgent matters (such as outages) or issues concerning the Datadog service or UI, contact our support team via https://docs.datadoghq.com/help/ for direct, faster assistance.
You may submit bug reports concerning the Datadog SDK for Android by opening a Github issue. At a minimum, please provide:
- A description of the problem;
- Steps to reproduce;
- Expected behavior;
- Actual behavior;
- Errors (with stack traces) or warnings received;
- Any details you can share about your configuration including:
- Android API level;
- Datadog SDK version;
- Versions of any other relevant dependencies (OkHttp, …);
- Your ProGuard configuration;
- The list of Gradle plugins applied to your project.
If at all possible, also provide:
- Logs (from the tracer/application/agent) or other diagnostics;
- Screenshots, links, or other visual aids that are publicly accessible;
- Code sample or test that reproduces the problem;
- An explanation of what causes the bug and/or how it can be fixed.
Reports that include rich detail are better, and ones with code that reproduce the bug are best.
We welcome code contributions to the library, which you can submit as a pull request. Before you submit a PR, make sure that you first create an Issue to explain the bug or the feature your patch covers, and make sure another Issue or PR doesn't already exist.
To create a pull request:
- Fork the repository from https://github.com/DataDog/dd-sdk-reactnative ;
- Make any changes for your patch;
- Write tests that demonstrate how the feature works or how the bug is fixed;
- Update any documentation such as
docs/GettingStarted.md
, especially for new features; - Submit the pull request from your fork back to this repository .
The pull request will be run through our CI pipeline, and a project member will review the changes with you. At a minimum, to be accepted and merged, pull requests must:
- Have a stated goal and detailed description of the changes made;
- Include thorough test coverage and documentation, where applicable;
- Pass all tests and code quality checks (linting/coverage/benchmarks) on CI;
- Receive at least one approval from a project member with push permissions.
Make sure that your code is clean and readable, that your commits are small and atomic, with a proper commit message.