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
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@ The RUM React Native SDK supports monitoring hybrid applications.

The RUM React Native SDK supports [OpenTelemetry][9] and distributed traces through header generation.

### Source maps (Android)

Uploading source maps lets Flashcat show readable stack traces for release builds. Apply the bundled Gradle script in `android/app/build.gradle`:

```groovy
apply from: "../../node_modules/@flashcatcloud/mobile-react-native/flashcat-sourcemaps.gradle"
```

It adds an `upload<Variant>Sourcemaps` task that runs automatically after the JS bundle task and uploads the bundle and its source map through `@flashcatcloud/flashcat-cli`, authenticated with the `FLASHCAT_API_KEY` environment variable.

The upload never blocks the build:

- If `FLASHCAT_API_KEY` is not set, the task is skipped and a warning is printed.
- If the upload fails (invalid key, network error, ...), a warning containing the CLI output is printed and the build continues.
- Set `FLASHCAT_SOURCEMAPS_DRY_RUN=true` (or the Gradle property `flashcatSourcemapsDryRun=true`) to run the task without uploading; this also silences the missing-key warning.

## Troubleshooting

If you encounter any issue when using the Flashcat SDK for React Native, please take a look at the [troubleshooting documentation][4], or at the [existing issues][5].
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"npmClient": "yarn",
"version": "0.1.0",
"version": "0.1.1",
"packages": [
"packages/*"
],
Expand Down
4 changes: 2 additions & 2 deletions packages/codepush/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@flashcatcloud/mobile-react-native-code-push",
"version": "0.1.0",
"version": "0.1.1",
"description": "A client-side React Native module to interact with Appcenter Codepush and Datadog",
"keywords": [
"datadog",
Expand Down Expand Up @@ -39,7 +39,7 @@
"prepare": "rm -rf lib && yarn bob build"
},
"devDependencies": {
"@flashcatcloud/mobile-react-native": "workspace:0.1.0",
"@flashcatcloud/mobile-react-native": "workspace:0.1.1",
"@testing-library/react-native": "7.0.2",
"react-native-builder-bob": "0.26.0",
"react-native-code-push": "7.1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
package com.datadog.reactnative

// This is automatically updated by the update-version.sh script
internal const val SDK_VERSION = "0.1.0"
internal const val SDK_VERSION = "0.1.1"
22 changes: 18 additions & 4 deletions packages/core/flashcat-sourcemaps.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ afterEvaluate {
group = "flashcat"
description = "Uploads sourcemaps to Flashcat."

// The upload must never break the release build: skip it when no API key is
// available (the dry run mode does not need one).
onlyIf {
if (isDryRun || System.getenv("FLASHCAT_API_KEY")) {
return true
}
logger.warn("WARNING: FLASHCAT_API_KEY is not set, skipping sourcemap upload to Flashcat" +
" for variant=${targetName}. Set FLASHCAT_API_KEY to upload sourcemaps," +
" or set FLASHCAT_SOURCEMAPS_DRY_RUN=true to silence this warning.")
return false
}

def uploadSourcemap = { jsBundleFile ->
return [
"${getFlashcatCliExecPath(reactConfig)}",
Expand Down Expand Up @@ -362,6 +374,8 @@ private def runShellCommand(
workingDir = workingDirectory
standardOutput = outputStream
errorOutput = errorStream
// A failed upload must not fail the build: report it and move on.
ignoreExitValue = true
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine("cmd", "/c", *command)
} else {
Expand All @@ -370,17 +384,17 @@ private def runShellCommand(
}

if (result.exitValue != 0) {
logger.error(errorStream.toString("UTF-8"))
result.rethrowFailure()
logger.warn("WARNING: Flashcat sourcemap upload step failed (exit code ${result.exitValue})," +
" the build continues without it. stderr=${errorStream.toString("UTF-8")}" +
" stdout=${outputStream.toString("UTF-8")}")
} else {
logger.lifecycle(outputStream.toString("UTF-8"))
}
} catch (Exception e) {
def errorStreamContent = errorStream.toString("UTF-8")
def standardStreamContent = outputStream.toString("UTF-8")
logger.error("Exception raised during command execution," +
logger.warn("WARNING: Flashcat sourcemap upload step failed, the build continues without it." +
" stderr=${errorStreamContent}, stdout=${standardStreamContent}, exception=${e}")
throw e
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/core/ios/Sources/SdkVersion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
import Foundation

// This is automatically updated by the update-version.sh script
let SdkVersion = "0.1.0"
let SdkVersion = "0.1.1"
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@flashcatcloud/mobile-react-native",
"version": "0.1.0",
"version": "0.1.1",
"description": "A client-side React Native module to interact with Datadog",
"keywords": [
"datadog",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/version.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// generated by genversion
export const version = '0.1.0';
export const version = '0.1.1';
2 changes: 1 addition & 1 deletion packages/internal-testing-tools/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@flashcatcloud/react-native-internal-testing-tools",
"version": "0.1.0",
"version": "0.1.1",
"description": "Internal tools for testing the Datadog React Native SDK.",
"keywords": [
"datadog",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-apollo-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@flashcatcloud/mobile-react-native-apollo-client",
"version": "0.1.0",
"version": "0.1.1",
"private": true,
"description": "A client-side React Native module to interact with Apollo Client and Datadog",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-babel-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@flashcatcloud/mobile-react-native-babel-plugin",
"version": "0.1.0",
"version": "0.1.1",
"description": "A Babel plugin that enhances Datadog's React Native SDK by automatically enriching React components with contextual metadata.",
"keywords": [
"babel",
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native-navigation/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@flashcatcloud/mobile-react-native-navigation",
"version": "0.1.0",
"version": "0.1.1",
"description": "A client-side React Native module to interact with Datadog",
"keywords": [
"datadog",
Expand Down Expand Up @@ -36,7 +36,7 @@
"prepare": "rm -rf lib && yarn bob build"
},
"devDependencies": {
"@flashcatcloud/mobile-react-native": "^0.1.0",
"@flashcatcloud/mobile-react-native": "^0.1.1",
"@testing-library/react-native": "7.0.2",
"react-native-builder-bob": "0.26.0",
"react-native-gesture-handler": "1.10.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-session-replay/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@flashcatcloud/mobile-react-native-session-replay",
"version": "0.1.0",
"version": "0.1.1",
"description": "A client-side React Native module to enable session replay with Datadog",
"keywords": [
"datadog",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-webview/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@flashcatcloud/mobile-react-native-webview",
"version": "0.1.0",
"version": "0.1.1",
"description": "A client-side React Native module to interact with react-native-webview and Datadog",
"keywords": [
"datadog",
Expand Down
4 changes: 2 additions & 2 deletions packages/react-navigation/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@flashcatcloud/mobile-react-navigation",
"version": "0.1.0",
"version": "0.1.1",
"description": "A client-side React Native module to interact with Datadog",
"keywords": [
"datadog",
Expand Down Expand Up @@ -36,7 +36,7 @@
"prepare": "rm -rf lib && yarn bob build"
},
"devDependencies": {
"@flashcatcloud/mobile-react-native": "^0.1.0",
"@flashcatcloud/mobile-react-native": "^0.1.1",
"@react-navigation/native-v5": "npm:@react-navigation/native@5.9.8",
"@react-navigation/native-v6": "npm:@react-navigation/native@6.1.2",
"@react-navigation/stack-v5": "npm:@react-navigation/stack@5.14.2",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2535,7 +2535,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@flashcatcloud/mobile-react-native-code-push@workspace:packages/codepush"
dependencies:
"@flashcatcloud/mobile-react-native": "workspace:0.1.0"
"@flashcatcloud/mobile-react-native": "workspace:0.1.1"
"@testing-library/react-native": 7.0.2
react-native-builder-bob: 0.26.0
react-native-code-push: 7.1.0
Expand All @@ -2551,7 +2551,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@flashcatcloud/mobile-react-native-navigation@workspace:packages/react-native-navigation"
dependencies:
"@flashcatcloud/mobile-react-native": ^0.1.0
"@flashcatcloud/mobile-react-native": ^0.1.1
"@testing-library/react-native": 7.0.2
react-native-builder-bob: 0.26.0
react-native-gesture-handler: 1.10.3
Expand Down Expand Up @@ -2593,7 +2593,7 @@ __metadata:
languageName: unknown
linkType: soft

"@flashcatcloud/mobile-react-native@^0.1.0, @flashcatcloud/mobile-react-native@workspace:0.1.0, @flashcatcloud/mobile-react-native@workspace:packages/core":
"@flashcatcloud/mobile-react-native@^0.1.1, @flashcatcloud/mobile-react-native@workspace:0.1.1, @flashcatcloud/mobile-react-native@workspace:packages/core":
version: 0.0.0-use.local
resolution: "@flashcatcloud/mobile-react-native@workspace:packages/core"
dependencies:
Expand All @@ -2610,7 +2610,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@flashcatcloud/mobile-react-navigation@workspace:packages/react-navigation"
dependencies:
"@flashcatcloud/mobile-react-native": ^0.1.0
"@flashcatcloud/mobile-react-native": ^0.1.1
"@react-navigation/native-v5": "npm:@react-navigation/native@5.9.8"
"@react-navigation/native-v6": "npm:@react-navigation/native@6.1.2"
"@react-navigation/stack-v5": "npm:@react-navigation/stack@5.14.2"
Expand Down