Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ See the [dedicated troubleshooting guide](./docs/troubleshooting_no_data.md).
Original issue: https://github.com/DataDog/dd-sdk-reactnative/issues/41

If you have the following error message:

```
Undefined symbols for architecture x86_64:
"static Foundation.JSONEncoder.OutputFormatting.withoutEscapingSlashes.getter : Foundation.JSONEncoder.OutputFormatting", referenced from:
Expand All @@ -17,6 +18,7 @@ Undefined symbols for architecture x86_64:
```

open Xcode and go to `Build Settings` of your project (_not your app target_) then make sure `Library Search Paths` is the following:

```
LIBRARY_SEARCH_PATHS = (
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
Expand All @@ -42,7 +44,7 @@ We made the change below to fix it:
### Infinite loop-like error messages

Sometimes, almost randomly, my RN project gives error messages non-stop.
CPU usage goes up to %+100 and you'll quickly notice a problem with your laptop fan goes crazy.
CPU usage goes up to 100%+ and you'll quickly notice a problem when your laptop fan goes crazy.

This is the issue: https://github.com/facebook/react-native/issues/28801

Expand Down
50 changes: 31 additions & 19 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
2. From the iOS folder, run `pod install`.
3. From the root folder, run `yarn ios` or `yarn android`.

## Enable new architcture
## Enable new architecture

### iOS

Expand All @@ -20,7 +20,7 @@ Set `newArchEnabled=true` in `benchmarks/android/gradle.properties`.

## ENV config

The `.env` config file contains configuration for the Datadog API, as well as a test scenario that you can launch when the app boots up. If it doesn't contain a test scenario, the app waits for a deeplink to trigger a test scenario instead.
The `.env` config file contains a configuration for the Datadog API, as well as a test scenario that you can launch when the app boots up. If it doesn't contain a test scenario, the app waits for a deep link to trigger a test scenario instead.

DD_CLIENT_TOKEN="CLIENT_TOKEN"
DD_API_KEY="API_KEY"
Expand All @@ -33,37 +33,43 @@ The `.env` config file contains configuration for the Datadog API, as well as a
## Changing ENV settings

### Debug

```
$ ENVFILE=.env.alternate yarn ios
```

or:

```
$ ENVFILE=.env.alternate yarn android
```

### Release

On Android:
```

```
$ ENVFILE=.env.alternate ./gradlew assembleRelease
```

On iOS:
```

```
xcodebuild -scheme alternate
```
```

## Set test scenarios using deeplinks
## Set test scenarios using deep links

You can trigger test scenarios by running a deeplink with a specific set of parameters to the benchmark app.
You can trigger test scenarios by running a deep link with a specific set of parameters to the benchmark app.

## Run a test scenario

Launch a specific test scenario with a particular configuration:

- **Method**: `start`
- **Parameters**:
- **scenario**: name of the test as defined on `Scenario` enum in `types/testConfig.ts`
- **runType**: `instrumented|baseline|profiling`
- **scenario**: name of the test as defined on the `Scenario` enum in `types/testConfig.ts`
- **runType**: `instrumented|baseline|profiling`

### iOS

Expand Down Expand Up @@ -95,9 +101,9 @@ xcrun simctl openurl booted "benchmark://stop"
adb shell am start -W -a android.intent.action.VIEW -d 'benchmark://stop' com.benchmarkrunner
```

## Adding a New Scenario to Benchmarks
## Adding a new scenario to benchmarks

### Define the New Scenario
### Define the new scenario

In `benchmarks/src/testSetup/types/testConfig.ts`, add a new entry to the `Scenario` enum:

Expand All @@ -110,22 +116,22 @@ export enum Scenario {
}
```

The string value (`'newScenario'`) is what must be passed using deeplink as the `scenario` parameter.
The string value (`'newScenario'`) is what must be passed using a deep link as the `scenario` parameter.

Alternatively, if you're using a `.env` file to set the scenario, add:

```env
BENCH_SCENARIO="newScenario"
```

### Create the Scenario Component
### Create the scenario component

Create a new folder under `benchmarks/src/scenario/` named after your scenario (for example, `NewScenario`). Inside this folder, define your scenario’s main component and its props.

Create a `types.ts` file:

```ts
import type { TestConfig } from "benchmarks/src/testSetup/types/testConfig";
import type {TestConfig} from 'benchmarks/src/testSetup/types/testConfig';

export type NewScenarioProps = {
testConfig?: TestConfig;
Expand All @@ -144,7 +150,7 @@ function NewScenario(props: NewScenarioProps): React.JSX.Element {
export default NewScenario;
```

### Register the Scenario in the App
### Register the scenario in the app

In `benchmarks/src/App.tsx`, add a new case to the scenario switch using the enum identifier you just created:

Expand All @@ -153,9 +159,9 @@ case Scenario.NewScenario:
return <NewScenario testConfig={testConfig} />;
```

You can now trigger this scenario either through a deeplink or by setting `BENCH_SCENARIO` in the `.env` file.
You can then trigger this scenario through either a deep link or by setting `BENCH_SCENARIO` in the `.env` file.

## Instrumenting a Scenario
## Instrument a scenario

Depending on the scenario’s structure and flow, the Datadog SDK initialization may vary. Each scenario is responsible for managing its own initialization logic.

Expand All @@ -178,5 +184,11 @@ useEffect(() => {
If your scenario uses the `DatadogProvider`, you can retrieve the necessary configuration using `getDatadogProviderConfig()` from the same `testUtils` module:

```ts
return <DatadogProvider config={getDatadogProviderConfig()} onInitialization={onDatadogInitialization}>...</DatadogProvider>
return (
<DatadogProvider
config={getDatadogProviderConfig()}
onInitialization={onDatadogInitialization}>
...
</DatadogProvider>
);
```
4 changes: 2 additions & 2 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const datadogConfiguration = new DatadogProviderConfiguration(
true, // track XHR Resources
true // track Errors
);
// Optional: Select your Datadog website (one of "US1", "US3", "US5", EU1", "AP1", "AP2", or "US1_FED"). Default is "US1".
// Optional: Select your Datadog website (one of "US1", "US3", "US5", "EU1", "AP1", "AP2", or "US1_FED"). Default is "US1".
datadogConfiguration.site = 'US1';
// Optional: enable or disable native crash reports
datadogConfiguration.nativeCrashReportEnabled = true;
Expand Down Expand Up @@ -102,7 +102,7 @@ tempers with the linux kernel, the stored data might become readable.
### iOS

Before data is uploaded to Datadog, it is stored in cleartext in the cache directory (`Library/Caches`)
of your [application sandbox](4), which can't be read by any other app installed on the device.
of your [application sandbox][4], which can't be read by any other app installed on the device.

[1]: https://app.datadoghq.com/rum/application/create
[2]: https://raw.githubusercontent.com/DataDog/dd-sdk-reactnative/main/docs/image_reactnative.png
Expand Down
Loading