@datadog/mobile-react-native 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DatadogSDKReactNative.podspec +6 -6
- package/android/build.gradle +38 -22
- package/android/src/test/kotlin/com/datadog/reactnative/DdLogsTest.kt +7 -7
- package/android/src/test/kotlin/com/datadog/reactnative/DdRumTest.kt +3 -3
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +15 -15
- package/android/src/test/kotlin/com/datadog/reactnative/DdTraceTest.kt +9 -9
- package/android/src/test/kotlin/com/datadog/tools/unit/MockRumMonitor.kt +2 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/ActionEventForgeryFactory.kt +1 -1
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/ResourceEventForgeryFactory.kt +1 -1
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/TelemetryConfigurationEventForgeryFactory.kt +1 -0
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/commonjs/logs/DdLogs.js +3 -3
- package/lib/commonjs/logs/DdLogs.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +3 -3
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js +8 -9
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -1
- package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js +4 -4
- package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
- package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js +1 -1
- package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
- package/lib/commonjs/sdk/EventMappers/EventMapper.js +1 -1
- package/lib/commonjs/sdk/EventMappers/EventMapper.js.map +1 -1
- package/lib/commonjs/specs/NativeDdLogs.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +1 -1
- package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/module/logs/DdLogs.js +3 -3
- package/lib/module/logs/DdLogs.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +3 -3
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js +8 -9
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js +4 -4
- package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/DatadogProvider.js +1 -1
- package/lib/module/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
- package/lib/module/sdk/EventMappers/EventMapper.js +1 -1
- package/lib/module/sdk/EventMappers/EventMapper.js.map +1 -1
- package/lib/module/specs/NativeDdLogs.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +1 -1
- package/lib/typescript/logs/DdLogs.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.d.ts +1 -1
- package/lib/typescript/sdk/EventMappers/EventMapper.d.ts +1 -1
- package/lib/typescript/specs/NativeDdLogs.d.ts +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/DdSdkReactNativeConfiguration.tsx +1 -1
- package/src/__tests__/mock.test.ts +1 -1
- package/src/logs/DdLogs.ts +3 -3
- package/src/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.tsx +3 -3
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/__tests__/internalDevResourceBlocklist.test.ts +5 -5
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.ts +8 -9
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.ts +1 -1
- package/src/sdk/DatadogProvider/Buffer/BoundedBuffer.ts +5 -5
- package/src/sdk/DatadogProvider/DatadogProvider.tsx +1 -1
- package/src/sdk/EventMappers/EventMapper.ts +1 -1
- package/src/specs/NativeDdLogs.ts +1 -1
- package/src/version.ts +1 -1
|
@@ -19,12 +19,12 @@ Pod::Spec.new do |s|
|
|
|
19
19
|
s.dependency "React-Core"
|
|
20
20
|
|
|
21
21
|
# /!\ Remember to keep the versions in sync with DatadogSDKReactNativeSessionReplay.podspec
|
|
22
|
-
s.dependency 'DatadogCore', '~> 2.
|
|
23
|
-
s.dependency 'DatadogLogs', '~> 2.
|
|
24
|
-
s.dependency 'DatadogTrace', '~> 2.
|
|
25
|
-
s.dependency 'DatadogRUM', '~> 2.
|
|
26
|
-
s.dependency 'DatadogCrashReporting', '~> 2.
|
|
27
|
-
s.dependency 'DatadogWebViewTracking', '~> 2.
|
|
22
|
+
s.dependency 'DatadogCore', '~> 2.6.0'
|
|
23
|
+
s.dependency 'DatadogLogs', '~> 2.6.0'
|
|
24
|
+
s.dependency 'DatadogTrace', '~> 2.6.0'
|
|
25
|
+
s.dependency 'DatadogRUM', '~> 2.6.0'
|
|
26
|
+
s.dependency 'DatadogCrashReporting', '~> 2.6.0'
|
|
27
|
+
s.dependency 'DatadogWebViewTracking', '~> 2.6.0'
|
|
28
28
|
|
|
29
29
|
s.test_spec 'Tests' do |test_spec|
|
|
30
30
|
test_spec.source_files = 'ios/Tests/*.swift'
|
package/android/build.gradle
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import java.nio.file.Paths
|
|
2
|
+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
3
|
+
|
|
1
4
|
buildscript {
|
|
2
5
|
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
|
|
3
6
|
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['DdSdkReactNative_kotlinVersion']
|
|
@@ -33,6 +36,29 @@ apply plugin: 'kotlin-android'
|
|
|
33
36
|
apply plugin: 'org.jlleitschuh.gradle.ktlint'
|
|
34
37
|
apply plugin: "io.gitlab.arturbosch.detekt"
|
|
35
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Finds the path of the installed npm package with the given name using Node's
|
|
41
|
+
* module resolution algorithm, which searches "node_modules" directories up to
|
|
42
|
+
* the file system root.
|
|
43
|
+
* This enables us to handle monorepos without requiring the node executable.
|
|
44
|
+
*
|
|
45
|
+
* The search begins at the given base directory (a File object). The returned
|
|
46
|
+
* path is a string.
|
|
47
|
+
*/
|
|
48
|
+
static def findNodeModulePath(baseDir, packageName) {
|
|
49
|
+
def basePath = baseDir.toPath().normalize()
|
|
50
|
+
// Node's module resolution algorithm searches up to the root directory,
|
|
51
|
+
// after which the base path will be null
|
|
52
|
+
while (basePath) {
|
|
53
|
+
def candidatePath = Paths.get(basePath.toString(), "node_modules", packageName)
|
|
54
|
+
if (candidatePath.toFile().exists()) {
|
|
55
|
+
return candidatePath.toString()
|
|
56
|
+
}
|
|
57
|
+
basePath = basePath.getParent()
|
|
58
|
+
}
|
|
59
|
+
return null
|
|
60
|
+
}
|
|
61
|
+
|
|
36
62
|
def resolveReactNativeDirectory() {
|
|
37
63
|
def reactNativeLocation = rootProject.hasProperty("reactNativeDir") ? rootProject.getProperty("reactNativeDir") : null
|
|
38
64
|
|
|
@@ -40,24 +66,10 @@ def resolveReactNativeDirectory() {
|
|
|
40
66
|
return file(reactNativeLocation)
|
|
41
67
|
}
|
|
42
68
|
|
|
43
|
-
|
|
44
|
-
// Resolve React Native location with Node
|
|
45
|
-
// This will make sure that we get installation location correctly in monorepos
|
|
46
|
-
def reactNativePackageJsonPathStdout = new ByteArrayOutputStream()
|
|
47
|
-
|
|
48
|
-
exec {
|
|
49
|
-
commandLine("node", "-p", "require.resolve('react-native/package.json')")
|
|
50
|
-
ignoreExitValue true
|
|
51
|
-
standardOutput = reactNativePackageJsonPathStdout
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
def reactNativeFromProjectNodeModules = file(reactNativePackageJsonPathStdout.toString().trim()).getParentFile();
|
|
69
|
+
def reactNativePath = findNodeModulePath(projectDir, "react-native")
|
|
55
70
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
} catch (e) {
|
|
60
|
-
// Ignore
|
|
71
|
+
if (reactNativePath != null) {
|
|
72
|
+
return file(reactNativePath)
|
|
61
73
|
}
|
|
62
74
|
|
|
63
75
|
throw new Exception(
|
|
@@ -169,10 +181,10 @@ dependencies {
|
|
|
169
181
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
170
182
|
compileOnly "com.squareup.okhttp3:okhttp:3.12.13"
|
|
171
183
|
|
|
172
|
-
implementation "com.datadoghq:dd-sdk-android-rum:2.
|
|
173
|
-
implementation "com.datadoghq:dd-sdk-android-logs:2.
|
|
174
|
-
implementation "com.datadoghq:dd-sdk-android-trace:2.
|
|
175
|
-
implementation "com.datadoghq:dd-sdk-android-webview:2.
|
|
184
|
+
implementation "com.datadoghq:dd-sdk-android-rum:2.5.0"
|
|
185
|
+
implementation "com.datadoghq:dd-sdk-android-logs:2.5.0"
|
|
186
|
+
implementation "com.datadoghq:dd-sdk-android-trace:2.5.0"
|
|
187
|
+
implementation "com.datadoghq:dd-sdk-android-webview:2.5.0"
|
|
176
188
|
testImplementation "org.junit.platform:junit-platform-launcher:1.6.2"
|
|
177
189
|
testImplementation "org.junit.jupiter:junit-jupiter-api:5.6.2"
|
|
178
190
|
testImplementation "org.junit.jupiter:junit-jupiter-engine:5.6.2"
|
|
@@ -183,7 +195,7 @@ dependencies {
|
|
|
183
195
|
testImplementation "com.github.xgouchet.Elmyr:inject:1.3.1"
|
|
184
196
|
testImplementation "com.github.xgouchet.Elmyr:junit5:1.3.1"
|
|
185
197
|
testImplementation "com.github.xgouchet.Elmyr:jvm:1.3.1"
|
|
186
|
-
testImplementation "
|
|
198
|
+
testImplementation "org.mockito.kotlin:mockito-kotlin:5.1.0"
|
|
187
199
|
testImplementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
|
188
200
|
unmock 'org.robolectric:android-all:4.4_r1-robolectric-r2'
|
|
189
201
|
}
|
|
@@ -197,6 +209,10 @@ unMock {
|
|
|
197
209
|
}
|
|
198
210
|
|
|
199
211
|
tasks.withType(Test) {
|
|
212
|
+
tasks.withType(KotlinCompile) {
|
|
213
|
+
kotlinOptions.jvmTarget = JavaVersion.VERSION_11
|
|
214
|
+
}
|
|
215
|
+
|
|
200
216
|
useJUnitPlatform {
|
|
201
217
|
includeEngines("spek", "junit-jupiter", "junit-vintage")
|
|
202
218
|
}
|
|
@@ -11,12 +11,6 @@ import com.datadog.android.log.Logger
|
|
|
11
11
|
import com.datadog.tools.unit.GenericAssert.Companion.assertThat
|
|
12
12
|
import com.facebook.react.bridge.Promise
|
|
13
13
|
import com.facebook.react.bridge.ReadableMap
|
|
14
|
-
import com.nhaarman.mockitokotlin2.argumentCaptor
|
|
15
|
-
import com.nhaarman.mockitokotlin2.doReturn
|
|
16
|
-
import com.nhaarman.mockitokotlin2.times
|
|
17
|
-
import com.nhaarman.mockitokotlin2.verify
|
|
18
|
-
import com.nhaarman.mockitokotlin2.verifyZeroInteractions
|
|
19
|
-
import com.nhaarman.mockitokotlin2.whenever
|
|
20
14
|
import fr.xgouchet.elmyr.Forge
|
|
21
15
|
import fr.xgouchet.elmyr.annotation.AdvancedForgery
|
|
22
16
|
import fr.xgouchet.elmyr.annotation.MapForgery
|
|
@@ -31,6 +25,12 @@ import org.junit.jupiter.api.extension.Extensions
|
|
|
31
25
|
import org.mockito.Mock
|
|
32
26
|
import org.mockito.junit.jupiter.MockitoExtension
|
|
33
27
|
import org.mockito.junit.jupiter.MockitoSettings
|
|
28
|
+
import org.mockito.kotlin.argumentCaptor
|
|
29
|
+
import org.mockito.kotlin.doReturn
|
|
30
|
+
import org.mockito.kotlin.times
|
|
31
|
+
import org.mockito.kotlin.verify
|
|
32
|
+
import org.mockito.kotlin.verifyNoInteractions
|
|
33
|
+
import org.mockito.kotlin.whenever
|
|
34
34
|
import org.mockito.quality.Strictness
|
|
35
35
|
|
|
36
36
|
@Extensions(
|
|
@@ -314,7 +314,7 @@ internal class DdLogsTest {
|
|
|
314
314
|
)
|
|
315
315
|
|
|
316
316
|
// Then
|
|
317
|
-
|
|
317
|
+
verifyNoInteractions(mockLogger)
|
|
318
318
|
val exceptionCaptor = argumentCaptor<IllegalStateException>()
|
|
319
319
|
verify(mockPromise, times(8)).reject(exceptionCaptor.capture())
|
|
320
320
|
assertThat(exceptionCaptor.firstValue.message)
|
|
@@ -15,9 +15,6 @@ import com.datadog.android.rum.RumResourceMethod
|
|
|
15
15
|
import com.datadog.tools.unit.forge.BaseConfigurator
|
|
16
16
|
import com.datadog.tools.unit.toReadableMap
|
|
17
17
|
import com.facebook.react.bridge.Promise
|
|
18
|
-
import com.nhaarman.mockitokotlin2.doReturn
|
|
19
|
-
import com.nhaarman.mockitokotlin2.verify
|
|
20
|
-
import com.nhaarman.mockitokotlin2.whenever
|
|
21
18
|
import fr.xgouchet.elmyr.Forge
|
|
22
19
|
import fr.xgouchet.elmyr.annotation.BoolForgery
|
|
23
20
|
import fr.xgouchet.elmyr.annotation.DoubleForgery
|
|
@@ -36,6 +33,9 @@ import org.junit.jupiter.api.extension.Extensions
|
|
|
36
33
|
import org.mockito.Mock
|
|
37
34
|
import org.mockito.junit.jupiter.MockitoExtension
|
|
38
35
|
import org.mockito.junit.jupiter.MockitoSettings
|
|
36
|
+
import org.mockito.kotlin.doReturn
|
|
37
|
+
import org.mockito.kotlin.verify
|
|
38
|
+
import org.mockito.kotlin.whenever
|
|
39
39
|
import org.mockito.quality.Strictness
|
|
40
40
|
|
|
41
41
|
@Extensions(
|
|
@@ -36,20 +36,6 @@ import com.datadog.tools.unit.toReadableMap
|
|
|
36
36
|
import com.facebook.react.bridge.Promise
|
|
37
37
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
38
38
|
import com.facebook.react.bridge.ReadableMap
|
|
39
|
-
import com.nhaarman.mockitokotlin2.any
|
|
40
|
-
import com.nhaarman.mockitokotlin2.argumentCaptor
|
|
41
|
-
import com.nhaarman.mockitokotlin2.doNothing
|
|
42
|
-
import com.nhaarman.mockitokotlin2.doReturn
|
|
43
|
-
import com.nhaarman.mockitokotlin2.doThrow
|
|
44
|
-
import com.nhaarman.mockitokotlin2.eq
|
|
45
|
-
import com.nhaarman.mockitokotlin2.inOrder
|
|
46
|
-
import com.nhaarman.mockitokotlin2.isNull
|
|
47
|
-
import com.nhaarman.mockitokotlin2.mock
|
|
48
|
-
import com.nhaarman.mockitokotlin2.never
|
|
49
|
-
import com.nhaarman.mockitokotlin2.same
|
|
50
|
-
import com.nhaarman.mockitokotlin2.verify
|
|
51
|
-
import com.nhaarman.mockitokotlin2.verifyZeroInteractions
|
|
52
|
-
import com.nhaarman.mockitokotlin2.whenever
|
|
53
39
|
import fr.xgouchet.elmyr.Forge
|
|
54
40
|
import fr.xgouchet.elmyr.annotation.AdvancedForgery
|
|
55
41
|
import fr.xgouchet.elmyr.annotation.BoolForgery
|
|
@@ -79,6 +65,20 @@ import org.mockito.Answers
|
|
|
79
65
|
import org.mockito.Mock
|
|
80
66
|
import org.mockito.junit.jupiter.MockitoExtension
|
|
81
67
|
import org.mockito.junit.jupiter.MockitoSettings
|
|
68
|
+
import org.mockito.kotlin.any
|
|
69
|
+
import org.mockito.kotlin.argumentCaptor
|
|
70
|
+
import org.mockito.kotlin.doNothing
|
|
71
|
+
import org.mockito.kotlin.doReturn
|
|
72
|
+
import org.mockito.kotlin.doThrow
|
|
73
|
+
import org.mockito.kotlin.eq
|
|
74
|
+
import org.mockito.kotlin.inOrder
|
|
75
|
+
import org.mockito.kotlin.isNull
|
|
76
|
+
import org.mockito.kotlin.mock
|
|
77
|
+
import org.mockito.kotlin.never
|
|
78
|
+
import org.mockito.kotlin.same
|
|
79
|
+
import org.mockito.kotlin.verify
|
|
80
|
+
import org.mockito.kotlin.verifyNoInteractions
|
|
81
|
+
import org.mockito.kotlin.whenever
|
|
82
82
|
import org.mockito.quality.Strictness
|
|
83
83
|
|
|
84
84
|
fun mockChoreographerInstance(mock: Choreographer = mock()) {
|
|
@@ -1686,7 +1686,7 @@ internal class DdSdkTest {
|
|
|
1686
1686
|
.hasField("featureConfiguration") {
|
|
1687
1687
|
it.hasFieldEqualTo("vitalsMonitorUpdateFrequency", VitalsUpdateFrequency.NEVER)
|
|
1688
1688
|
}
|
|
1689
|
-
|
|
1689
|
+
verifyNoInteractions(mockChoreographer)
|
|
1690
1690
|
}
|
|
1691
1691
|
|
|
1692
1692
|
@Test
|
|
@@ -8,15 +8,6 @@ package com.datadog.reactnative
|
|
|
8
8
|
|
|
9
9
|
import com.datadog.tools.unit.toReadableMap
|
|
10
10
|
import com.facebook.react.bridge.Promise
|
|
11
|
-
import com.nhaarman.mockitokotlin2.any
|
|
12
|
-
import com.nhaarman.mockitokotlin2.doAnswer
|
|
13
|
-
import com.nhaarman.mockitokotlin2.doReturn
|
|
14
|
-
import com.nhaarman.mockitokotlin2.mock
|
|
15
|
-
import com.nhaarman.mockitokotlin2.never
|
|
16
|
-
import com.nhaarman.mockitokotlin2.times
|
|
17
|
-
import com.nhaarman.mockitokotlin2.verify
|
|
18
|
-
import com.nhaarman.mockitokotlin2.verifyNoMoreInteractions
|
|
19
|
-
import com.nhaarman.mockitokotlin2.whenever
|
|
20
11
|
import fr.xgouchet.elmyr.annotation.AdvancedForgery
|
|
21
12
|
import fr.xgouchet.elmyr.annotation.DoubleForgery
|
|
22
13
|
import fr.xgouchet.elmyr.annotation.LongForgery
|
|
@@ -37,6 +28,15 @@ import org.junit.jupiter.api.extension.Extensions
|
|
|
37
28
|
import org.mockito.Mock
|
|
38
29
|
import org.mockito.junit.jupiter.MockitoExtension
|
|
39
30
|
import org.mockito.junit.jupiter.MockitoSettings
|
|
31
|
+
import org.mockito.kotlin.any
|
|
32
|
+
import org.mockito.kotlin.doAnswer
|
|
33
|
+
import org.mockito.kotlin.doReturn
|
|
34
|
+
import org.mockito.kotlin.mock
|
|
35
|
+
import org.mockito.kotlin.never
|
|
36
|
+
import org.mockito.kotlin.times
|
|
37
|
+
import org.mockito.kotlin.verify
|
|
38
|
+
import org.mockito.kotlin.verifyNoMoreInteractions
|
|
39
|
+
import org.mockito.kotlin.whenever
|
|
40
40
|
import org.mockito.quality.Strictness
|
|
41
41
|
|
|
42
42
|
@Extensions(
|
|
@@ -79,7 +79,7 @@ internal class ActionEventForgeryFactory :
|
|
|
79
79
|
type = ActionEvent.ActionEventSessionType.USER,
|
|
80
80
|
hasReplay = forge.aNullable { aBool() }
|
|
81
81
|
),
|
|
82
|
-
source = forge.aNullable { aValueFrom(ActionEvent.
|
|
82
|
+
source = forge.aNullable { aValueFrom(ActionEvent.ActionEventSource::class.java) },
|
|
83
83
|
ciTest = forge.aNullable {
|
|
84
84
|
ActionEvent.CiTest(anHexadecimalString())
|
|
85
85
|
},
|
|
@@ -87,7 +87,7 @@ internal class ResourceEventForgeryFactory :
|
|
|
87
87
|
type = ResourceEvent.ResourceEventSessionType.USER,
|
|
88
88
|
hasReplay = forge.aNullable { aBool() }
|
|
89
89
|
),
|
|
90
|
-
source = forge.aNullable { aValueFrom(ResourceEvent.
|
|
90
|
+
source = forge.aNullable { aValueFrom(ResourceEvent.ResourceEventSource::class.java) },
|
|
91
91
|
ciTest = forge.aNullable {
|
|
92
92
|
ResourceEvent.CiTest(anHexadecimalString())
|
|
93
93
|
},
|
|
@@ -62,6 +62,7 @@ internal class TelemetryConfigurationEventForgeryFactory :
|
|
|
62
62
|
forge.aNullable { aBool() },
|
|
63
63
|
forge.aNullable { aBool() },
|
|
64
64
|
forge.aNullable { aBool() },
|
|
65
|
+
forge.aNullable { aBool() },
|
|
65
66
|
forge.aNullable { aString() },
|
|
66
67
|
forge.aNullable { aBool() },
|
|
67
68
|
forge.aNullable { aBool() },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DdSdkReactNativeConfiguration.tsx"],"names":["VitalsUpdateFrequency","UploadFrequency","BatchSize","isLegacyFirstPartyHost","firstPartyHost","formatFirstPartyHosts","firstPartyHosts","map","host","match","propagatorTypes","PropagatorType","DATADOG","TRACECONTEXT","DEFAULTS","nativeCrashReportEnabled","sessionSamplingRate","resourceTracingSamplingRate","site","longTaskThresholdMs","nativeLongTaskThresholdMs","nativeViewTracking","nativeInteractionTracking","getFirstPartyHosts","getAdditionalConfig","trackingConsent","TrackingConsent","GRANTED","telemetrySampleRate","vitalsUpdateFrequency","AVERAGE","logEventMapper","errorEventMapper","resourceEventMapper","actionEventMapper","trackFrustrations","uploadFrequency","batchSize","MEDIUM","trackBackgroundEvents","DdSdkReactNativeConfiguration","constructor","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","undefined","addDefaultValuesToAutoInstrumentationConfiguration","features","setConfigurationAttribute","attribute","configuration","value","name","buildConfigurationFromPartialConfiguration","remainingConfiguration","SdkConfiguration","Object","keys","forEach","actionNameAttribute","DatadogProviderConfiguration","InitializationMode","SYNC"],"mappings":";;;;;;;AAQA;;AAMA;;;;IAEYA,qB;;;WAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;GAAAA,qB,qCAAAA,qB;;IAOAC,e;;;WAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;GAAAA,e,+BAAAA,e;;IAeAC,S;;;WAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;GAAAA,S,yBAAAA,S;;AAsBZ,MAAMC,sBAAsB,GACxBC,cAD2B,IAEc;AACzC,SAAO,OAAOA,cAAP,KAA0B,QAAjC;AACH,CAJD;AAMA;AACA;AACA;AACA;;;AACO,MAAMC,qBAAqB,GAC9BC,eADiC,IAEd;AACnB,SAAOA,eAAe,CAACC,GAAhB,CAAoBC,IAAI,IAAI;AAC/B,QAAIL,sBAAsB,CAACK,IAAD,CAA1B,EAAkC;AAC9B,aAAO;AACHC,QAAAA,KAAK,EAAED,IADJ;AAEHE,QAAAA,eAAe,EAAE,CACbC,sBAAeC,OADF,EAEbD,sBAAeE,YAFF;AAFd,OAAP;AAOH;;AACD,WAAOL,IAAP;AACH,GAXM,CAAP;AAYH,CAfM;;;AAiBP,MAAMM,QAAQ,GAAG;AACbC,EAAAA,wBAAwB,EAAE,KADb;A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kBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAAClB;AAFpB,GADqB,EAKrB0B,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,qBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAACjB;AAFpB,GADqB,EAKrByB,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,mBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAAChB;AAFpB,GADqB,EAKrBwB,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,qBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAACY;AAFpB,GADqB,EAKrBJ,gBALqB,CAAzB;AAQA,SAAOA,gBAAP;AACH,CA7EM;;;;AA+EA,MAAMK,4BAAN,SAA2CvB,6BAA3C,CAAyE;AAAA;AAAA;;AAAA,gDAC5BwB,kBAAkB,CAACC,IADS;AAAA;;AAAA;;;IAIpED,kB;;;WAAAA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;GAAAA,kB,kCAAAA,kB","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport type { ProxyConfiguration } from './ProxyConfiguration';\nimport type { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\nimport type { LogEventMapper } from './logs/types';\nimport type { ActionEventMapper } from './rum/eventMappers/actionEventMapper';\nimport type { ErrorEventMapper } from './rum/eventMappers/errorEventMapper';\nimport type { ResourceEventMapper } from './rum/eventMappers/resourceEventMapper';\nimport type { FirstPartyHost } from './rum/types';\nimport { PropagatorType } from './rum/types';\n\nexport enum VitalsUpdateFrequency {\n FREQUENT = 'FREQUENT',\n AVERAGE = 'AVERAGE',\n RARE = 'RARE',\n NEVER = 'NEVER'\n}\n\nexport enum UploadFrequency {\n /**\n * Upload data every 1000ms.\n */\n FREQUENT = 'FREQUENT',\n /**\n * Upload data every 5000ms.\n */\n AVERAGE = 'AVERAGE',\n /**\n * Upload data every 10000ms.\n */\n RARE = 'RARE'\n}\n\nexport enum BatchSize {\n /**\n * Upload less frequent, larger batches of data\n */\n LARGE = 'LARGE',\n /**\n * Use default size for batches of data\n */\n MEDIUM = 'MEDIUM',\n /**\n * Upload more frequent, smaller batches of data\n */\n SMALL = 'SMALL'\n}\n\nexport type FirstPartyHostsConfiguration = (\n | FirstPartyHost\n | LegacyFirstPartyHost\n)[];\n\nexport type LegacyFirstPartyHost = string;\n\nconst isLegacyFirstPartyHost = (\n firstPartyHost: FirstPartyHost | LegacyFirstPartyHost\n): firstPartyHost is LegacyFirstPartyHost => {\n return typeof firstPartyHost === 'string';\n};\n\n/**\n * Defaults legacy first party hosts format to Datadog first party hosts to keep\n * retro-compatibility before OTel support was introduced.\n */\nexport const formatFirstPartyHosts = (\n firstPartyHosts: FirstPartyHostsConfiguration\n): FirstPartyHost[] => {\n return firstPartyHosts.map(host => {\n if (isLegacyFirstPartyHost(host)) {\n return {\n match: host,\n propagatorTypes: [\n PropagatorType.DATADOG,\n PropagatorType.TRACECONTEXT\n ]\n };\n }\n return host;\n });\n};\n\nconst DEFAULTS = {\n nativeCrashReportEnabled: false,\n sessionSamplingRate: 100.0,\n resourceTracingSamplingRate: 20.0,\n site: 'US1',\n longTaskThresholdMs: 0,\n nativeLongTaskThresholdMs: 200,\n nativeViewTracking: false,\n nativeInteractionTracking: false,\n getFirstPartyHosts: () => [],\n getAdditionalConfig: () => ({}),\n trackingConsent: TrackingConsent.GRANTED,\n telemetrySampleRate: 20.0,\n vitalsUpdateFrequency: VitalsUpdateFrequency.AVERAGE,\n logEventMapper: null,\n errorEventMapper: null,\n resourceEventMapper: null,\n actionEventMapper: null,\n trackFrustrations: true,\n uploadFrequency: UploadFrequency.AVERAGE,\n batchSize: BatchSize.MEDIUM,\n trackBackgroundEvents: false\n};\n\n/**\n * The SDK configuration class.\n * It will be used to configure the SDK functionality at initialization.\n */\nexport class DdSdkReactNativeConfiguration {\n /**\n * Enables crash reporting for native plaforms (iOS, Android). Default `false`.\n */\n public nativeCrashReportEnabled: boolean =\n DEFAULTS.nativeCrashReportEnabled;\n /**\n * @deprecated `sampleRate` has been replaced by `sessionSamplingRate` to avoid confusion with `resourceTracingSamplingRate` and will be removed in a future release.\n */\n public sampleRate?: number;\n /**\n * Percentage of sampled RUM sessions. Range `0`-`100`.\n */\n public sessionSamplingRate: number = DEFAULTS.sessionSamplingRate;\n /**\n * Percentage of tracing integrations for network calls between your app and your backend. Range `0`-`100`.\n */\n public resourceTracingSamplingRate: number =\n DEFAULTS.resourceTracingSamplingRate;\n public site: string = DEFAULTS.site;\n /**\n * Verbosity for internal SDK logging.\n * Set to `SdkVerbosity.DEBUG` to debug your SDK implementation.\n */\n public verbosity: SdkVerbosity | undefined = undefined;\n /**\n * Enables native views tracking.\n * Set to `true` if you use a custom navigation system relying on native views.\n */\n public nativeViewTracking: boolean = DEFAULTS.nativeViewTracking;\n /**\n * Enables native interaction tracking.\n * Set to `true` if you want to track interactions on native screens.\n */\n public nativeInteractionTracking: boolean =\n DEFAULTS.nativeInteractionTracking;\n public proxyConfig?: ProxyConfiguration = undefined;\n public serviceName?: string = undefined;\n /**\n * List of your backends hosts to enable tracing with.\n * Regular expressions are NOT supported.\n *\n * Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`.\n */\n public firstPartyHosts: FirstPartyHostsConfiguration = DEFAULTS.getFirstPartyHosts();\n /**\n * Overrides the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * Make sure you set it correctly, as it will have to match the one specified during the upload of your source maps and other mapping files.\n */\n public version?: string;\n /**\n * Add a suffix to the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * A dash (`-`) will be automatically added between the version and the suffix\n */\n public versionSuffix?: string;\n\n /**\n * The sampling rate for Internal Telemetry (info related to the work of the\n * SDK internals).\n *\n * The sampling rate must be a value between 0 and 100. A value of 0 means no\n * telemetry will be sent, 100 means all telemetry will be sent. When\n * `telemetrySampleRate` is not set, the default value from the iOS and\n * Android SDK is used, which is 20.\n */\n public telemetrySampleRate: number = DEFAULTS.telemetrySampleRate;\n\n /**\n * The threshold for native long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables native long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `200`.\n */\n public nativeLongTaskThresholdMs: number | false =\n DEFAULTS.nativeLongTaskThresholdMs;\n\n /**\n * The threshold for javascript long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables javascript long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `0`\n */\n public longTaskThresholdMs: number | false = DEFAULTS.longTaskThresholdMs;\n\n /**\n * Sets the preferred frequency for collecting mobile vitals.\n */\n public vitalsUpdateFrequency: VitalsUpdateFrequency =\n DEFAULTS.vitalsUpdateFrequency;\n\n /**\n * Enables tracking of frustration signals (error taps). Defaults to `true`.\n */\n public trackFrustrations: boolean = DEFAULTS.trackFrustrations;\n\n /**\n * Sets the preferred frequency for uploading batches of data.\n */\n public uploadFrequency: UploadFrequency = DEFAULTS.uploadFrequency;\n\n /**\n * Defines the Datadog SDK policy when batching data together before uploading it to Datadog servers.\n * Smaller batches mean smaller but more network requests, whereas larger batches mean fewer but larger network requests.\n */\n public batchSize: BatchSize = DEFAULTS.batchSize;\n\n /**\n * Enables tracking of RUM event when no RUM View is active.\n *\n * By default, background events are not tracked. Enabling this feature might increase the\n * number of sessions tracked and impact your billing.\n */\n public trackBackgroundEvents: boolean = DEFAULTS.trackBackgroundEvents;\n\n /**\n * Specifies a custom prop to name RUM actions on elements having an `onPress` prop.\n *\n * For example if you set it to `testID`, the value of the `testID` prop is used as a custom action name:\n *\n * ```js\n * <TouchableOpacity testID=\"Dismiss notification\" onPress={() => dismiss()}>\n * ```\n *\n * `dd-action-name` is favored when both attributes are present on an element.\n */\n public actionNameAttribute?: string;\n\n public logEventMapper: LogEventMapper | null = DEFAULTS.logEventMapper;\n\n public errorEventMapper: ErrorEventMapper | null =\n DEFAULTS.errorEventMapper;\n\n public resourceEventMapper: ResourceEventMapper | null =\n DEFAULTS.resourceEventMapper;\n\n public actionEventMapper: ActionEventMapper | null =\n DEFAULTS.actionEventMapper;\n\n public additionalConfig: {\n [k: string]: any;\n } = DEFAULTS.getAdditionalConfig();\n\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly trackInteractions: boolean = false,\n readonly trackResources: boolean = false,\n readonly trackErrors: boolean = false,\n readonly trackingConsent: TrackingConsent = DEFAULTS.trackingConsent\n ) {}\n}\n\n/**\n * Auto Instrumentation configuration passed to DatadogProvider.\n * Does not include default values.\n */\nexport type AutoInstrumentationConfiguration = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts?: FirstPartyHostsConfiguration;\n readonly resourceTracingSamplingRate?: number;\n readonly trackErrors: boolean;\n readonly logEventMapper?: LogEventMapper | null;\n readonly errorEventMapper?: ErrorEventMapper | null;\n readonly resourceEventMapper?: ResourceEventMapper | null;\n readonly actionEventMapper?: ActionEventMapper | null;\n readonly actionNameAttribute?: string;\n};\n\n/**\n * Parameters needed to start auto instrumentation. Includes default values.\n */\nexport type AutoInstrumentationParameters = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts: FirstPartyHostsConfiguration;\n readonly resourceTracingSamplingRate: number;\n readonly trackErrors: boolean;\n readonly logEventMapper: LogEventMapper | null;\n readonly errorEventMapper: ErrorEventMapper | null;\n readonly resourceEventMapper: ResourceEventMapper | null;\n readonly actionEventMapper: ActionEventMapper | null;\n readonly actionNameAttribute?: string;\n};\n\n/**\n * We could use `Proxy` instead of this function, but `Proxy` is not available on\n * the older android jsc that can still be used.\n */\nexport const addDefaultValuesToAutoInstrumentationConfiguration = (\n features: AutoInstrumentationConfiguration\n): AutoInstrumentationParameters => {\n return {\n ...features,\n firstPartyHosts:\n features.firstPartyHosts || DEFAULTS.getFirstPartyHosts(),\n resourceTracingSamplingRate:\n features.resourceTracingSamplingRate === undefined\n ? DEFAULTS.resourceTracingSamplingRate\n : features.resourceTracingSamplingRate,\n logEventMapper:\n features.logEventMapper === undefined\n ? DEFAULTS.logEventMapper\n : features.logEventMapper,\n errorEventMapper:\n features.errorEventMapper === undefined\n ? DEFAULTS.errorEventMapper\n : features.errorEventMapper,\n resourceEventMapper:\n features.resourceEventMapper === undefined\n ? DEFAULTS.resourceEventMapper\n : features.resourceEventMapper,\n actionEventMapper:\n features.actionEventMapper === undefined\n ? DEFAULTS.actionEventMapper\n : features.actionEventMapper\n };\n};\n\nexport type PartialInitializationConfiguration = {\n readonly clientToken: string;\n readonly env: string;\n readonly applicationId: string;\n readonly sessionSamplingRate?: number;\n readonly site?: string;\n readonly verbosity?: SdkVerbosity | undefined;\n readonly nativeViewTracking?: boolean;\n readonly nativeInteractionTracking?: boolean;\n readonly proxyConfig?: ProxyConfiguration;\n readonly serviceName?: string;\n readonly version?: string;\n versionSuffix?: string;\n readonly additionalConfig?: { [k: string]: any };\n readonly trackingConsent?: TrackingConsent;\n readonly longTaskThresholdMs?: number | false;\n readonly nativeLongTaskThresholdMs?: number | false;\n readonly nativeCrashReportEnabled?: boolean;\n readonly telemetrySampleRate?: number;\n readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;\n readonly trackFrustrations?: boolean;\n readonly uploadFrequency?: UploadFrequency;\n readonly batchSize?: BatchSize;\n readonly trackBackgroundEvents?: boolean;\n};\n\nconst setConfigurationAttribute = <\n AttributeName extends keyof DdSdkReactNativeConfiguration\n>(\n attribute: {\n value?: DdSdkReactNativeConfiguration[AttributeName];\n name: AttributeName;\n },\n configuration: DdSdkReactNativeConfiguration\n) => {\n if (attribute.value !== undefined) {\n configuration[attribute.name] = attribute.value;\n }\n};\n\nexport const buildConfigurationFromPartialConfiguration = (\n features: AutoInstrumentationConfiguration,\n configuration: PartialInitializationConfiguration\n): DdSdkReactNativeConfiguration => {\n const {\n clientToken,\n env,\n applicationId,\n ...remainingConfiguration\n } = configuration;\n const SdkConfiguration = new DdSdkReactNativeConfiguration(\n clientToken,\n env,\n applicationId,\n features.trackInteractions,\n features.trackResources,\n features.trackErrors,\n configuration.trackingConsent\n );\n\n (Object.keys(\n remainingConfiguration\n ) as (keyof typeof remainingConfiguration)[]).forEach(name => {\n setConfigurationAttribute(\n { value: remainingConfiguration[name], name },\n SdkConfiguration\n );\n });\n\n setConfigurationAttribute(\n {\n name: 'resourceTracingSamplingRate',\n value: features.resourceTracingSamplingRate\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n { name: 'firstPartyHosts', value: features.firstPartyHosts },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'logEventMapper',\n value: features.logEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'errorEventMapper',\n value: features.errorEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'resourceEventMapper',\n value: features.resourceEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'actionEventMapper',\n value: features.actionEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'actionNameAttribute',\n value: features.actionNameAttribute\n },\n SdkConfiguration\n );\n\n return SdkConfiguration;\n};\n\nexport class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {\n public initializationMode: InitializationMode = InitializationMode.SYNC;\n}\n\nexport enum InitializationMode {\n SYNC = 'SYNC',\n ASYNC = 'ASYNC'\n}\n\nexport type InitializationModeForTelemetry =\n | 'LEGACY'\n | 'SYNC'\n | 'ASYNC'\n | 'PARTIAL';\n"]}
|
|
1
|
+
{"version":3,"sources":["DdSdkReactNativeConfiguration.tsx"],"names":["VitalsUpdateFrequency","UploadFrequency","BatchSize","isLegacyFirstPartyHost","firstPartyHost","formatFirstPartyHosts","firstPartyHosts","map","host","match","propagatorTypes","PropagatorType","DATADOG","TRACECONTEXT","DEFAULTS","nativeCrashReportEnabled","sessionSamplingRate","resourceTracingSamplingRate","site","longTaskThresholdMs","nativeLongTaskThresholdMs","nativeViewTracking","nativeInteractionTracking","getFirstPartyHosts","getAdditionalConfig","trackingConsent","TrackingConsent","GRANTED","telemetrySampleRate","vitalsUpdateFrequency","AVERAGE","logEventMapper","errorEventMapper","resourceEventMapper","actionEventMapper","trackFrustrations","uploadFrequency","batchSize","MEDIUM","trackBackgroundEvents","DdSdkReactNativeConfiguration","constructor","clientToken","env","applicationId","trackInteractions","trackResources","trackErrors","undefined","addDefaultValuesToAutoInstrumentationConfiguration","features","setConfigurationAttribute","attribute","configuration","value","name","buildConfigurationFromPartialConfiguration","remainingConfiguration","SdkConfiguration","Object","keys","forEach","actionNameAttribute","DatadogProviderConfiguration","InitializationMode","SYNC"],"mappings":";;;;;;;AAQA;;AAMA;;;;IAEYA,qB;;;WAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;AAAAA,EAAAA,qB;GAAAA,qB,qCAAAA,qB;;IAOAC,e;;;WAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;GAAAA,e,+BAAAA,e;;IAeAC,S;;;WAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;GAAAA,S,yBAAAA,S;;AAsBZ,MAAMC,sBAAsB,GACxBC,cAD2B,IAEc;AACzC,SAAO,OAAOA,cAAP,KAA0B,QAAjC;AACH,CAJD;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AAAA,KAAK,EAAEJ,QAAQ,CAACjC;AAFpB,GADqB,EAKrByC,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AAAEI,IAAAA,IAAI,EAAE,iBAAR;AAA2BD,IAAAA,KAAK,EAAEJ,QAAQ,CAAC5C;AAA3C,GADqB,EAErBoD,gBAFqB,CAAzB;AAIAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,gBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAACnB;AAFpB,GADqB,EAKrB2B,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,kBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAAClB;AAFpB,GADqB,EAKrB0B,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,qBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAACjB;AAFpB,GADqB,EAKrByB,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,mBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAAChB;AAFpB,GADqB,EAKrBwB,gBALqB,CAAzB;AAOAP,EAAAA,yBAAyB,CACrB;AACII,IAAAA,IAAI,EAAE,qBADV;AAEID,IAAAA,KAAK,EAAEJ,QAAQ,CAACY;AAFpB,GADqB,EAKrBJ,gBALqB,CAAzB;AAQA,SAAOA,gBAAP;AACH,CA7EM;;;;AA+EA,MAAMK,4BAAN,SAA2CvB,6BAA3C,CAAyE;AAAA;AAAA;;AAAA,gDAC5BwB,kBAAkB,CAACC,IADS;AAAA;;AAAA;;;IAIpED,kB;;;WAAAA,kB;AAAAA,EAAAA,kB;AAAAA,EAAAA,kB;GAAAA,kB,kCAAAA,kB","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport type { ProxyConfiguration } from './ProxyConfiguration';\nimport type { SdkVerbosity } from './SdkVerbosity';\nimport { TrackingConsent } from './TrackingConsent';\nimport type { LogEventMapper } from './logs/types';\nimport type { ActionEventMapper } from './rum/eventMappers/actionEventMapper';\nimport type { ErrorEventMapper } from './rum/eventMappers/errorEventMapper';\nimport type { ResourceEventMapper } from './rum/eventMappers/resourceEventMapper';\nimport type { FirstPartyHost } from './rum/types';\nimport { PropagatorType } from './rum/types';\n\nexport enum VitalsUpdateFrequency {\n FREQUENT = 'FREQUENT',\n AVERAGE = 'AVERAGE',\n RARE = 'RARE',\n NEVER = 'NEVER'\n}\n\nexport enum UploadFrequency {\n /**\n * Upload data every 1000ms.\n */\n FREQUENT = 'FREQUENT',\n /**\n * Upload data every 5000ms.\n */\n AVERAGE = 'AVERAGE',\n /**\n * Upload data every 10000ms.\n */\n RARE = 'RARE'\n}\n\nexport enum BatchSize {\n /**\n * Upload less frequent, larger batches of data\n */\n LARGE = 'LARGE',\n /**\n * Use default size for batches of data\n */\n MEDIUM = 'MEDIUM',\n /**\n * Upload more frequent, smaller batches of data\n */\n SMALL = 'SMALL'\n}\n\nexport type FirstPartyHostsConfiguration = (\n | FirstPartyHost\n | LegacyFirstPartyHost\n)[];\n\nexport type LegacyFirstPartyHost = string;\n\nconst isLegacyFirstPartyHost = (\n firstPartyHost: FirstPartyHost | LegacyFirstPartyHost\n): firstPartyHost is LegacyFirstPartyHost => {\n return typeof firstPartyHost === 'string';\n};\n\n/**\n * Defaults legacy first party hosts format to Datadog first party hosts to keep\n * retro-compatibility before OTel support was introduced.\n */\nexport const formatFirstPartyHosts = (\n firstPartyHosts: FirstPartyHostsConfiguration\n): FirstPartyHost[] => {\n return firstPartyHosts.map(host => {\n if (isLegacyFirstPartyHost(host)) {\n return {\n match: host,\n propagatorTypes: [\n PropagatorType.DATADOG,\n PropagatorType.TRACECONTEXT\n ]\n };\n }\n return host;\n });\n};\n\nconst DEFAULTS = {\n nativeCrashReportEnabled: false,\n sessionSamplingRate: 100.0,\n resourceTracingSamplingRate: 20.0,\n site: 'US1',\n longTaskThresholdMs: 0,\n nativeLongTaskThresholdMs: 200,\n nativeViewTracking: false,\n nativeInteractionTracking: false,\n getFirstPartyHosts: () => [],\n getAdditionalConfig: () => ({}),\n trackingConsent: TrackingConsent.GRANTED,\n telemetrySampleRate: 20.0,\n vitalsUpdateFrequency: VitalsUpdateFrequency.AVERAGE,\n logEventMapper: null,\n errorEventMapper: null,\n resourceEventMapper: null,\n actionEventMapper: null,\n trackFrustrations: true,\n uploadFrequency: UploadFrequency.AVERAGE,\n batchSize: BatchSize.MEDIUM,\n trackBackgroundEvents: false\n};\n\n/**\n * The SDK configuration class.\n * It will be used to configure the SDK functionality at initialization.\n */\nexport class DdSdkReactNativeConfiguration {\n /**\n * Enables crash reporting for native platforms (iOS, Android). Default `false`.\n */\n public nativeCrashReportEnabled: boolean =\n DEFAULTS.nativeCrashReportEnabled;\n /**\n * @deprecated `sampleRate` has been replaced by `sessionSamplingRate` to avoid confusion with `resourceTracingSamplingRate` and will be removed in a future release.\n */\n public sampleRate?: number;\n /**\n * Percentage of sampled RUM sessions. Range `0`-`100`.\n */\n public sessionSamplingRate: number = DEFAULTS.sessionSamplingRate;\n /**\n * Percentage of tracing integrations for network calls between your app and your backend. Range `0`-`100`.\n */\n public resourceTracingSamplingRate: number =\n DEFAULTS.resourceTracingSamplingRate;\n public site: string = DEFAULTS.site;\n /**\n * Verbosity for internal SDK logging.\n * Set to `SdkVerbosity.DEBUG` to debug your SDK implementation.\n */\n public verbosity: SdkVerbosity | undefined = undefined;\n /**\n * Enables native views tracking.\n * Set to `true` if you use a custom navigation system relying on native views.\n */\n public nativeViewTracking: boolean = DEFAULTS.nativeViewTracking;\n /**\n * Enables native interaction tracking.\n * Set to `true` if you want to track interactions on native screens.\n */\n public nativeInteractionTracking: boolean =\n DEFAULTS.nativeInteractionTracking;\n public proxyConfig?: ProxyConfiguration = undefined;\n public serviceName?: string = undefined;\n /**\n * List of your backends hosts to enable tracing with.\n * Regular expressions are NOT supported.\n *\n * Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`.\n */\n public firstPartyHosts: FirstPartyHostsConfiguration = DEFAULTS.getFirstPartyHosts();\n /**\n * Overrides the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * Make sure you set it correctly, as it will have to match the one specified during the upload of your source maps and other mapping files.\n */\n public version?: string;\n /**\n * Add a suffix to the reported version of the app.\n * Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.\n * Other special characters are converted to underscores.\n *\n * See https://docs.datadoghq.com/getting_started/tagging/#define-tags for more information on the format.\n *\n * A dash (`-`) will be automatically added between the version and the suffix\n */\n public versionSuffix?: string;\n\n /**\n * The sampling rate for Internal Telemetry (info related to the work of the\n * SDK internals).\n *\n * The sampling rate must be a value between 0 and 100. A value of 0 means no\n * telemetry will be sent, 100 means all telemetry will be sent. When\n * `telemetrySampleRate` is not set, the default value from the iOS and\n * Android SDK is used, which is 20.\n */\n public telemetrySampleRate: number = DEFAULTS.telemetrySampleRate;\n\n /**\n * The threshold for native long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables native long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `200`.\n */\n public nativeLongTaskThresholdMs: number | false =\n DEFAULTS.nativeLongTaskThresholdMs;\n\n /**\n * The threshold for javascript long tasks reporting in milliseconds.\n *\n * - Setting it to `0` or `false` disables javascript long task reporting.\n * - Values below `100` will be raised to `100`.\n * - Values above `5000` will be lowered to `5000`.\n *\n * Default value is `0`\n */\n public longTaskThresholdMs: number | false = DEFAULTS.longTaskThresholdMs;\n\n /**\n * Sets the preferred frequency for collecting mobile vitals.\n */\n public vitalsUpdateFrequency: VitalsUpdateFrequency =\n DEFAULTS.vitalsUpdateFrequency;\n\n /**\n * Enables tracking of frustration signals (error taps). Defaults to `true`.\n */\n public trackFrustrations: boolean = DEFAULTS.trackFrustrations;\n\n /**\n * Sets the preferred frequency for uploading batches of data.\n */\n public uploadFrequency: UploadFrequency = DEFAULTS.uploadFrequency;\n\n /**\n * Defines the Datadog SDK policy when batching data together before uploading it to Datadog servers.\n * Smaller batches mean smaller but more network requests, whereas larger batches mean fewer but larger network requests.\n */\n public batchSize: BatchSize = DEFAULTS.batchSize;\n\n /**\n * Enables tracking of RUM event when no RUM View is active.\n *\n * By default, background events are not tracked. Enabling this feature might increase the\n * number of sessions tracked and impact your billing.\n */\n public trackBackgroundEvents: boolean = DEFAULTS.trackBackgroundEvents;\n\n /**\n * Specifies a custom prop to name RUM actions on elements having an `onPress` prop.\n *\n * For example if you set it to `testID`, the value of the `testID` prop is used as a custom action name:\n *\n * ```js\n * <TouchableOpacity testID=\"Dismiss notification\" onPress={() => dismiss()}>\n * ```\n *\n * `dd-action-name` is favored when both attributes are present on an element.\n */\n public actionNameAttribute?: string;\n\n public logEventMapper: LogEventMapper | null = DEFAULTS.logEventMapper;\n\n public errorEventMapper: ErrorEventMapper | null =\n DEFAULTS.errorEventMapper;\n\n public resourceEventMapper: ResourceEventMapper | null =\n DEFAULTS.resourceEventMapper;\n\n public actionEventMapper: ActionEventMapper | null =\n DEFAULTS.actionEventMapper;\n\n public additionalConfig: {\n [k: string]: any;\n } = DEFAULTS.getAdditionalConfig();\n\n constructor(\n readonly clientToken: string,\n readonly env: string,\n readonly applicationId: string,\n readonly trackInteractions: boolean = false,\n readonly trackResources: boolean = false,\n readonly trackErrors: boolean = false,\n readonly trackingConsent: TrackingConsent = DEFAULTS.trackingConsent\n ) {}\n}\n\n/**\n * Auto Instrumentation configuration passed to DatadogProvider.\n * Does not include default values.\n */\nexport type AutoInstrumentationConfiguration = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts?: FirstPartyHostsConfiguration;\n readonly resourceTracingSamplingRate?: number;\n readonly trackErrors: boolean;\n readonly logEventMapper?: LogEventMapper | null;\n readonly errorEventMapper?: ErrorEventMapper | null;\n readonly resourceEventMapper?: ResourceEventMapper | null;\n readonly actionEventMapper?: ActionEventMapper | null;\n readonly actionNameAttribute?: string;\n};\n\n/**\n * Parameters needed to start auto instrumentation. Includes default values.\n */\nexport type AutoInstrumentationParameters = {\n readonly trackInteractions: boolean;\n readonly trackResources: boolean;\n readonly firstPartyHosts: FirstPartyHostsConfiguration;\n readonly resourceTracingSamplingRate: number;\n readonly trackErrors: boolean;\n readonly logEventMapper: LogEventMapper | null;\n readonly errorEventMapper: ErrorEventMapper | null;\n readonly resourceEventMapper: ResourceEventMapper | null;\n readonly actionEventMapper: ActionEventMapper | null;\n readonly actionNameAttribute?: string;\n};\n\n/**\n * We could use `Proxy` instead of this function, but `Proxy` is not available on\n * the older android jsc that can still be used.\n */\nexport const addDefaultValuesToAutoInstrumentationConfiguration = (\n features: AutoInstrumentationConfiguration\n): AutoInstrumentationParameters => {\n return {\n ...features,\n firstPartyHosts:\n features.firstPartyHosts || DEFAULTS.getFirstPartyHosts(),\n resourceTracingSamplingRate:\n features.resourceTracingSamplingRate === undefined\n ? DEFAULTS.resourceTracingSamplingRate\n : features.resourceTracingSamplingRate,\n logEventMapper:\n features.logEventMapper === undefined\n ? DEFAULTS.logEventMapper\n : features.logEventMapper,\n errorEventMapper:\n features.errorEventMapper === undefined\n ? DEFAULTS.errorEventMapper\n : features.errorEventMapper,\n resourceEventMapper:\n features.resourceEventMapper === undefined\n ? DEFAULTS.resourceEventMapper\n : features.resourceEventMapper,\n actionEventMapper:\n features.actionEventMapper === undefined\n ? DEFAULTS.actionEventMapper\n : features.actionEventMapper\n };\n};\n\nexport type PartialInitializationConfiguration = {\n readonly clientToken: string;\n readonly env: string;\n readonly applicationId: string;\n readonly sessionSamplingRate?: number;\n readonly site?: string;\n readonly verbosity?: SdkVerbosity | undefined;\n readonly nativeViewTracking?: boolean;\n readonly nativeInteractionTracking?: boolean;\n readonly proxyConfig?: ProxyConfiguration;\n readonly serviceName?: string;\n readonly version?: string;\n versionSuffix?: string;\n readonly additionalConfig?: { [k: string]: any };\n readonly trackingConsent?: TrackingConsent;\n readonly longTaskThresholdMs?: number | false;\n readonly nativeLongTaskThresholdMs?: number | false;\n readonly nativeCrashReportEnabled?: boolean;\n readonly telemetrySampleRate?: number;\n readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;\n readonly trackFrustrations?: boolean;\n readonly uploadFrequency?: UploadFrequency;\n readonly batchSize?: BatchSize;\n readonly trackBackgroundEvents?: boolean;\n};\n\nconst setConfigurationAttribute = <\n AttributeName extends keyof DdSdkReactNativeConfiguration\n>(\n attribute: {\n value?: DdSdkReactNativeConfiguration[AttributeName];\n name: AttributeName;\n },\n configuration: DdSdkReactNativeConfiguration\n) => {\n if (attribute.value !== undefined) {\n configuration[attribute.name] = attribute.value;\n }\n};\n\nexport const buildConfigurationFromPartialConfiguration = (\n features: AutoInstrumentationConfiguration,\n configuration: PartialInitializationConfiguration\n): DdSdkReactNativeConfiguration => {\n const {\n clientToken,\n env,\n applicationId,\n ...remainingConfiguration\n } = configuration;\n const SdkConfiguration = new DdSdkReactNativeConfiguration(\n clientToken,\n env,\n applicationId,\n features.trackInteractions,\n features.trackResources,\n features.trackErrors,\n configuration.trackingConsent\n );\n\n (Object.keys(\n remainingConfiguration\n ) as (keyof typeof remainingConfiguration)[]).forEach(name => {\n setConfigurationAttribute(\n { value: remainingConfiguration[name], name },\n SdkConfiguration\n );\n });\n\n setConfigurationAttribute(\n {\n name: 'resourceTracingSamplingRate',\n value: features.resourceTracingSamplingRate\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n { name: 'firstPartyHosts', value: features.firstPartyHosts },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'logEventMapper',\n value: features.logEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'errorEventMapper',\n value: features.errorEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'resourceEventMapper',\n value: features.resourceEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'actionEventMapper',\n value: features.actionEventMapper\n },\n SdkConfiguration\n );\n setConfigurationAttribute(\n {\n name: 'actionNameAttribute',\n value: features.actionNameAttribute\n },\n SdkConfiguration\n );\n\n return SdkConfiguration;\n};\n\nexport class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {\n public initializationMode: InitializationMode = InitializationMode.SYNC;\n}\n\nexport enum InitializationMode {\n SYNC = 'SYNC',\n ASYNC = 'ASYNC'\n}\n\nexport type InitializationModeForTelemetry =\n | 'LEGACY'\n | 'SYNC'\n | 'ASYNC'\n | 'PARTIAL';\n"]}
|
|
@@ -70,7 +70,7 @@ class DdLogsWrapper {
|
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
|
|
73
|
-
_defineProperty(this, "
|
|
73
|
+
_defineProperty(this, "printLogDroppedByMapper", (message, status) => {
|
|
74
74
|
_InternalLog.InternalLog.log(`${status} log dropped by log mapper: "${message}"`, _SdkVerbosity.SdkVerbosity.DEBUG);
|
|
75
75
|
});
|
|
76
76
|
|
|
@@ -86,7 +86,7 @@ class DdLogsWrapper {
|
|
|
86
86
|
});
|
|
87
87
|
|
|
88
88
|
if (!event) {
|
|
89
|
-
this.
|
|
89
|
+
this.printLogDroppedByMapper(message, status);
|
|
90
90
|
return generateEmptyPromise();
|
|
91
91
|
}
|
|
92
92
|
|
|
@@ -117,7 +117,7 @@ class DdLogsWrapper {
|
|
|
117
117
|
});
|
|
118
118
|
|
|
119
119
|
if (!event) {
|
|
120
|
-
this.
|
|
120
|
+
this.printLogDroppedByMapper(message, status);
|
|
121
121
|
return generateEmptyPromise();
|
|
122
122
|
}
|
|
123
123
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DdLogs.ts"],"names":["SDK_NOT_INITIALIZED_MESSAGE","generateEmptyPromise","Promise","resolve","isLogWithError","args","DdLogsWrapper","require","default","undefined","logWithError","log","message","status","__DEV__","console","warn","DATADOG_MESSAGE_PREFIX","InternalLog","SdkVerbosity","DEBUG","context","event","logEventMapper","applyEventMapper","printlogDroppedByMapper","printLogTracked","nativeLogs","error","printLogDroppedSdkNotInitialized","errorKind","errorMessage","stacktrace","registerLogEventMapper","unregisterLogEventMapper","DdLogs"],"mappings":";;;;;;;AAMA;;AACA;;AAGA;;;;AASA,MAAMA,2BAA2B,GAAG,sCAApC;;AAEA,MAAMC,oBAAoB,GAAG,MAAM,IAAIC,OAAJ,CAAkBC,OAAO,IAAIA,OAAO,EAApC,CAAnC;AAEA;AACA;AACA;AACA;;;AACA,MAAMC,cAAc,GAChBC,IADmB,IAEa;AAChC,SACI,OAAOA,IAAI,CAAC,CAAD,CAAX,KAAmB,QAAnB,IACA,OAAOA,IAAI,CAAC,CAAD,CAAX,KAAmB,QADnB,IAEA,OAAOA,IAAI,CAAC,CAAD,CAAX,KAAmB,QAFnB,IAGA,OAAOA,IAAI,CAAC,CAAD,CAAX,KAAmB,QAJvB;AAMH,CATD;;AAWA,MAAMC,aAAN,CAA0C;AAAA;AAAA,wCAECC,OAAO,CAAC,uBAAD,CAAP,CAClCC,OAHiC;;AAAA,4CAIb,sCAAoBC,SAApB,CAJa;;AAAA,mCAM9B,CAAC,GAAGJ,IAAJ,KAAkE;AACtE,UAAID,cAAc,CAACC,IAAD,CAAlB,EAA0B;AACtB,eAAO,KAAKK,YAAL,CACHL,IAAI,CAAC,CAAD,CADD,EAEHA,IAAI,CAAC,CAAD,CAFD,EAGHA,IAAI,CAAC,CAAD,CAHD,EAIHA,IAAI,CAAC,CAAD,CAJD,EAKHA,IAAI,CAAC,CAAD,CAAJ,IAAW,EALR,EAMH,OANG,CAAP;AAQH;;AACD,aAAO,KAAKM,GAAL,CAASN,IAAI,CAAC,CAAD,CAAb,EAAkBA,IAAI,CAAC,C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AACH;;AAEDW,EAAAA,wBAAwB,GAAG;AACvB,SAAKX,cAAL,GAAsB,sCAAoBd,SAApB,CAAtB;AACH;;AA/KqC;;AAkLnC,MAAM0B,MAAM,GAAG,IAAI7B,aAAJ,EAAf","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { DATADOG_MESSAGE_PREFIX, InternalLog } from '../InternalLog';\nimport { SdkVerbosity } from '../SdkVerbosity';\nimport type { DdNativeLogsType } from '../nativeModulesTypes';\n\nimport { generateEventMapper } from './eventMapper';\nimport type {\n DdLogsType,\n LogArguments,\n LogEventMapper,\n LogWithErrorArguments,\n NativeLogWithError\n} from './types';\n\nconst SDK_NOT_INITIALIZED_MESSAGE = 'DD_INTERNAL_LOG_SENT_BEFORE_SDK_INIT';\n\nconst generateEmptyPromise = () => new Promise<void>(resolve => resolve());\n\n/**\n * We consider that if either one of `errorKind`, `errorMessage` or `stacktrace` is a string,\n * then the log contains an error.\n */\nconst isLogWithError = (\n args: LogArguments | LogWithErrorArguments\n): args is LogWithErrorArguments => {\n return (\n typeof args[1] === 'string' ||\n typeof args[2] === 'string' ||\n typeof args[3] === 'string' ||\n typeof args[4] === 'object'\n );\n};\n\nclass DdLogsWrapper implements DdLogsType {\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n private nativeLogs: DdNativeLogsType = require('../specs/NativeDdLogs')\n .default;\n private logEventMapper = generateEventMapper(undefined);\n\n debug = (...args: LogArguments | LogWithErrorArguments): Promise<void> => {\n if (isLogWithError(args)) {\n return this.logWithError(\n args[0],\n args[1],\n args[2],\n args[3],\n args[4] || {},\n 'debug'\n );\n }\n return this.log(args[0], args[1] || {}, 'debug');\n };\n\n info = (...args: LogArguments | LogWithErrorArguments): Promise<void> => {\n if (isLogWithError(args)) {\n return this.logWithError(\n args[0],\n args[1],\n args[2],\n args[3],\n args[4] || {},\n 'info'\n );\n }\n return this.log(args[0], args[1] || {}, 'info');\n };\n\n warn = (...args: LogArguments | LogWithErrorArguments): Promise<void> => {\n if (isLogWithError(args)) {\n return this.logWithError(\n args[0],\n args[1],\n args[2],\n args[3],\n args[4] || {},\n 'warn'\n );\n }\n return this.log(args[0], args[1] || {}, 'warn');\n };\n\n error = (...args: LogArguments | LogWithErrorArguments): Promise<void> => {\n if (isLogWithError(args)) {\n return this.logWithError(\n args[0],\n args[1],\n args[2],\n args[3],\n args[4] || {},\n 'error'\n );\n }\n return this.log(args[0], args[1] || {}, 'error');\n };\n\n /**\n * Since the InternalLog does not have a verbosity set yet in this case,\n * we use console.warn to warn the user in dev mode.\n */\n private printLogDroppedSdkNotInitialized = (\n message: string,\n status: 'debug' | 'info' | 'warn' | 'error'\n ) => {\n if (__DEV__) {\n console.warn(\n `${DATADOG_MESSAGE_PREFIX} Dropping ${status} log as the SDK is not initialized yet: \"${message}\"`\n );\n }\n };\n\n private printlogDroppedByMapper = (\n message: string,\n status: 'debug' | 'info' | 'warn' | 'error'\n ) => {\n InternalLog.log(\n `${status} log dropped by log mapper: \"${message}\"`,\n SdkVerbosity.DEBUG\n );\n };\n\n private printLogTracked = (\n message: string,\n status: 'debug' | 'info' | 'warn' | 'error'\n ) => {\n InternalLog.log(\n `Tracking ${status} log \"${message}\"`,\n SdkVerbosity.DEBUG\n );\n };\n\n private log = async (\n message: string,\n context: object,\n status: 'debug' | 'info' | 'warn' | 'error'\n ): Promise<void> => {\n const event = this.logEventMapper.applyEventMapper({\n message,\n context,\n status\n });\n if (!event) {\n this.printlogDroppedByMapper(message, status);\n return generateEmptyPromise();\n }\n\n this.printLogTracked(event.message, status);\n try {\n return await this.nativeLogs[status](event.message, event.context);\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (error.message === SDK_NOT_INITIALIZED_MESSAGE) {\n this.printLogDroppedSdkNotInitialized(message, status);\n return generateEmptyPromise();\n }\n\n throw error;\n }\n };\n\n private logWithError = async (\n message: string,\n errorKind: string | undefined,\n errorMessage: string | undefined,\n stacktrace: string | undefined,\n context: object,\n status: 'debug' | 'info' | 'warn' | 'error'\n ): Promise<void> => {\n const event = this.logEventMapper.applyEventMapper({\n message,\n errorKind,\n errorMessage,\n stacktrace,\n context,\n status\n });\n if (!event) {\n this.printlogDroppedByMapper(message, status);\n return generateEmptyPromise();\n }\n\n this.printLogTracked(event.message, status);\n try {\n return await this.nativeLogs[`${status}WithError`](\n event.message,\n (event as NativeLogWithError).errorKind,\n (event as NativeLogWithError).errorMessage,\n (event as NativeLogWithError).stacktrace,\n { ...event.context, '_dd.error.source_type': 'react-native' }\n );\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (error.message === SDK_NOT_INITIALIZED_MESSAGE) {\n this.printLogDroppedSdkNotInitialized(message, status);\n return generateEmptyPromise();\n }\n\n throw error;\n }\n };\n\n registerLogEventMapper(logEventMapper: LogEventMapper) {\n this.logEventMapper = generateEventMapper(logEventMapper);\n }\n\n unregisterLogEventMapper() {\n this.logEventMapper = generateEventMapper(undefined);\n }\n}\n\nexport const DdLogs = new DdLogsWrapper();\n"]}
|
|
1
|
+
{"version":3,"sources":["DdLogs.ts"],"names":["SDK_NOT_INITIALIZED_MESSAGE","generateEmptyPromise","Promise","resolve","isLogWithError","args","DdLogsWrapper","require","default","undefined","logWithError","log","message","status","__DEV__","console","warn","DATADOG_MESSAGE_PREFIX","InternalLog","SdkVerbosity","DEBUG","context","event","logEventMapper","applyEventMapper","printLogDroppedByMapper","printLogTracked","nativeLogs","error","printLogDroppedSdkNotInitialized","errorKind","errorMessage","stacktrace","registerLogEventMapper","unregisterLogEventMapper","DdLogs"],"mappings":";;;;;;;AAMA;;AACA;;AAGA;;;;AASA,MAAMA,2BAA2B,GAAG,sCAApC;;AAEA,MAAMC,oBAAoB,GAAG,MAAM,IAAIC,OAAJ,CAAkBC,OAAO,IAAIA,OA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AAM/CR,QAAAA;AAN+C,OAArC,CAAd;;AAQA,UAAI,CAACS,KAAL,EAAY;AACR,aAAKG,uBAAL,CAA6Bb,OAA7B,EAAsCC,MAAtC;AACA,eAAOZ,oBAAoB,EAA3B;AACH;;AAED,WAAKyB,eAAL,CAAqBJ,KAAK,CAACV,OAA3B,EAAoCC,MAApC;;AACA,UAAI;AACA,eAAO,MAAM,KAAKc,UAAL,CAAiB,GAAEd,MAAO,WAA1B,EACTS,KAAK,CAACV,OADG,EAERU,KAAD,CAA8BQ,SAFrB,EAGRR,KAAD,CAA8BS,YAHrB,EAIRT,KAAD,CAA8BU,UAJrB,EAKT,EAAE,GAAGV,KAAK,CAACD,OAAX;AAAoB,mCAAyB;AAA7C,SALS,CAAb;AAOH,OARD,CAQE,OAAOO,KAAP,EAAc;AACZ;AACA;AACA,YAAIA,KAAK,CAAChB,OAAN,KAAkBZ,2BAAtB,EAAmD;AAC/C,eAAK6B,gCAAL,CAAsCjB,OAAtC,EAA+CC,MAA/C;AACA,iBAAOZ,oBAAoB,EAA3B;AACH;;AAED,cAAM2B,KAAN;AACH;AACJ,KAvKqC;AAAA;;AAyKtCK,EAAAA,sBAAsB,CAACV,cAAD,EAAiC;AACnD,SAAKA,cAAL,GAAsB,sCAAoBA,cAApB,CAAtB;AACH;;AAEDW,EAAAA,wBAAwB,GAAG;AACvB,SAAKX,cAAL,GAAsB,sCAAoBd,SAApB,CAAtB;AACH;;AA/KqC;;AAkLnC,MAAM0B,MAAM,GAAG,IAAI7B,aAAJ,EAAf","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport { DATADOG_MESSAGE_PREFIX, InternalLog } from '../InternalLog';\nimport { SdkVerbosity } from '../SdkVerbosity';\nimport type { DdNativeLogsType } from '../nativeModulesTypes';\n\nimport { generateEventMapper } from './eventMapper';\nimport type {\n DdLogsType,\n LogArguments,\n LogEventMapper,\n LogWithErrorArguments,\n NativeLogWithError\n} from './types';\n\nconst SDK_NOT_INITIALIZED_MESSAGE = 'DD_INTERNAL_LOG_SENT_BEFORE_SDK_INIT';\n\nconst generateEmptyPromise = () => new Promise<void>(resolve => resolve());\n\n/**\n * We consider that if either one of `errorKind`, `errorMessage` or `stacktrace` is a string,\n * then the log contains an error.\n */\nconst isLogWithError = (\n args: LogArguments | LogWithErrorArguments\n): args is LogWithErrorArguments => {\n return (\n typeof args[1] === 'string' ||\n typeof args[2] === 'string' ||\n typeof args[3] === 'string' ||\n typeof args[4] === 'object'\n );\n};\n\nclass DdLogsWrapper implements DdLogsType {\n // eslint-disable-next-line global-require, @typescript-eslint/no-var-requires\n private nativeLogs: DdNativeLogsType = require('../specs/NativeDdLogs')\n .default;\n private logEventMapper = generateEventMapper(undefined);\n\n debug = (...args: LogArguments | LogWithErrorArguments): Promise<void> => {\n if (isLogWithError(args)) {\n return this.logWithError(\n args[0],\n args[1],\n args[2],\n args[3],\n args[4] || {},\n 'debug'\n );\n }\n return this.log(args[0], args[1] || {}, 'debug');\n };\n\n info = (...args: LogArguments | LogWithErrorArguments): Promise<void> => {\n if (isLogWithError(args)) {\n return this.logWithError(\n args[0],\n args[1],\n args[2],\n args[3],\n args[4] || {},\n 'info'\n );\n }\n return this.log(args[0], args[1] || {}, 'info');\n };\n\n warn = (...args: LogArguments | LogWithErrorArguments): Promise<void> => {\n if (isLogWithError(args)) {\n return this.logWithError(\n args[0],\n args[1],\n args[2],\n args[3],\n args[4] || {},\n 'warn'\n );\n }\n return this.log(args[0], args[1] || {}, 'warn');\n };\n\n error = (...args: LogArguments | LogWithErrorArguments): Promise<void> => {\n if (isLogWithError(args)) {\n return this.logWithError(\n args[0],\n args[1],\n args[2],\n args[3],\n args[4] || {},\n 'error'\n );\n }\n return this.log(args[0], args[1] || {}, 'error');\n };\n\n /**\n * Since the InternalLog does not have a verbosity set yet in this case,\n * we use console.warn to warn the user in dev mode.\n */\n private printLogDroppedSdkNotInitialized = (\n message: string,\n status: 'debug' | 'info' | 'warn' | 'error'\n ) => {\n if (__DEV__) {\n console.warn(\n `${DATADOG_MESSAGE_PREFIX} Dropping ${status} log as the SDK is not initialized yet: \"${message}\"`\n );\n }\n };\n\n private printLogDroppedByMapper = (\n message: string,\n status: 'debug' | 'info' | 'warn' | 'error'\n ) => {\n InternalLog.log(\n `${status} log dropped by log mapper: \"${message}\"`,\n SdkVerbosity.DEBUG\n );\n };\n\n private printLogTracked = (\n message: string,\n status: 'debug' | 'info' | 'warn' | 'error'\n ) => {\n InternalLog.log(\n `Tracking ${status} log \"${message}\"`,\n SdkVerbosity.DEBUG\n );\n };\n\n private log = async (\n message: string,\n context: object,\n status: 'debug' | 'info' | 'warn' | 'error'\n ): Promise<void> => {\n const event = this.logEventMapper.applyEventMapper({\n message,\n context,\n status\n });\n if (!event) {\n this.printLogDroppedByMapper(message, status);\n return generateEmptyPromise();\n }\n\n this.printLogTracked(event.message, status);\n try {\n return await this.nativeLogs[status](event.message, event.context);\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (error.message === SDK_NOT_INITIALIZED_MESSAGE) {\n this.printLogDroppedSdkNotInitialized(message, status);\n return generateEmptyPromise();\n }\n\n throw error;\n }\n };\n\n private logWithError = async (\n message: string,\n errorKind: string | undefined,\n errorMessage: string | undefined,\n stacktrace: string | undefined,\n context: object,\n status: 'debug' | 'info' | 'warn' | 'error'\n ): Promise<void> => {\n const event = this.logEventMapper.applyEventMapper({\n message,\n errorKind,\n errorMessage,\n stacktrace,\n context,\n status\n });\n if (!event) {\n this.printLogDroppedByMapper(message, status);\n return generateEmptyPromise();\n }\n\n this.printLogTracked(event.message, status);\n try {\n return await this.nativeLogs[`${status}WithError`](\n event.message,\n (event as NativeLogWithError).errorKind,\n (event as NativeLogWithError).errorMessage,\n (event as NativeLogWithError).stacktrace,\n { ...event.context, '_dd.error.source_type': 'react-native' }\n );\n } catch (error) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (error.message === SDK_NOT_INITIALIZED_MESSAGE) {\n this.printLogDroppedSdkNotInitialized(message, status);\n return generateEmptyPromise();\n }\n\n throw error;\n }\n };\n\n registerLogEventMapper(logEventMapper: LogEventMapper) {\n this.logEventMapper = generateEventMapper(logEventMapper);\n }\n\n unregisterLogEventMapper() {\n this.logEventMapper = generateEventMapper(undefined);\n }\n}\n\nexport const DdLogs = new DdLogsWrapper();\n"]}
|
package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js
CHANGED
|
@@ -58,11 +58,11 @@ class DdRumUserInteractionTracking {
|
|
|
58
58
|
|
|
59
59
|
try {
|
|
60
60
|
const jsxRuntime = (0, _getJsxRuntime.getJsxRuntime)();
|
|
61
|
-
const
|
|
62
|
-
this.originalJsx =
|
|
61
|
+
const originalJsx = jsxRuntime.jsx;
|
|
62
|
+
this.originalJsx = originalJsx;
|
|
63
63
|
|
|
64
64
|
jsxRuntime.jsx = (...args) => {
|
|
65
|
-
return this.patchCreateElementFunction(
|
|
65
|
+
return this.patchCreateElementFunction(originalJsx, args);
|
|
66
66
|
};
|
|
67
67
|
} catch (e) {
|
|
68
68
|
_DdSdk.DdSdk.telemetryDebug((0, _errorUtils.getErrorMessage)(e));
|
package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DdRumUserInteractionTracking.tsx"],"names":["DdRumUserInteractionTracking","startTracking","actionNameAttribute","isTracking","InternalLog","log","SdkVerbosity","WARN","eventsInterceptor","DdEventsInterceptor","original","React","createElement","args","patchCreateElementFunction","jsxRuntime","
|
|
1
|
+
{"version":3,"sources":["DdRumUserInteractionTracking.tsx"],"names":["DdRumUserInteractionTracking","startTracking","actionNameAttribute","isTracking","InternalLog","log","SdkVerbosity","WARN","eventsInterceptor","DdEventsInterceptor","original","React","createElement","args","patchCreateElementFunction","jsxRuntime","originalJsx","jsx","e","DdSdk","telemetryDebug","originalMemo","memo","component","propsAreEqual","prev","next","onPress","_prevOnPress","partialPrevProps","prevProps","__DATADOG_INTERNAL_ORIGINAL_ON_PRESS__","_nextOnPress","partialNextProps","nextProps","INFO","stopTracking","originalCreateElement","NoOpEventsInterceptor","originalFunction","element","props","rest","originalOnPress","interceptOnPress"],"mappings":";;;;;;;AAMA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;;;;;AAEA;AACA;AACA;AACA;AACO,MAAMA,4BAAN,CAAmC;AAgCtC;AACJ;AACA;AACA;AACA;AACwB,SAAbC,aAAa,CAAC;AACjBC,IAAAA;AADiB,MAEiB,EAFlB,EAE4B;AAC5C;AACA,QAAIF,4BAA4B,CAACG,UAAjC,EAA6C;AACzCC,+BAAYC,GAAZ,CACI,8CADJ,EAEIC,2BAAaC,IAFjB;;AAIA;AACH;;AACDP,IAAAA,4BAA4B,CAACQ,iBAA7B,GAAiD,IAAIC,wCAAJ,CAC7C;AAAEP,MAAAA;AAAF,KAD6C,CAAjD;AAIA,UAAMQ,QAAQ,GAAGC,eAAMC,aAAvB;;AACAD,mBAAMC,aAAN,GAAsB,CAClB,GAAGC,IADe,KAEZ;AACN,aAAO,KAAKC,0BAAL,CAAgCJ,QAAhC,EAA0CG,IAA1C,CAAP;AACH,KAJD;;AAMA,QAAI;AACA,YAAME,UAAU,GAAG,mCAAnB;AACA,YAAMC,WAAW,GAAGD,UAAU,CAACE,GAA/B;AACA,WAAKD,WAAL,GAAmBA,WAAnB;;AACAD,MAAAA,UAAU,CAACE,GAAX,GAAiB,CACb,GAAGJ,IADU,KAE4B;AACzC,eAAO,KAAKC,0BAAL,CAAgCE,WAAhC,EAA6CH,IAA7C,CAAP;AACH,OAJD;AAKH,KATD,CASE,OAAOK,CAAP,EAAU;AACRC,mBAAMC,cAAN,CAAqB,iCAAgBF,CAAhB,CAArB;AACH;;AAED,UAA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;AACAA,MAAAA,UAAU,CAACE,GAAX,GAAiB,KAAKD,WAAtB;AACA,WAAKA,WAAL,GAAmB,IAAnB;AACH;AACJ;;AAxHqC;;;;gBAA7BhB,4B,gBACmB,K;;gBADnBA,4B,uBAE6C,IAAIsC,8BAAJ,E;;gBAF7CtC,4B,2BAG8BW,eAAMC,a;;gBAHpCZ,4B,kBAIqBW,eAAMW,I;;gBAJ3BtB,4B,iBAKoB,I;;gBALpBA,4B,gCAOmC,CACxCuC,gBADwC,EAExC,CAACC,OAAD,EAAUC,KAAV,EAAiB,GAAGC,IAApB,CAFwC,KAGC;AACzC,MACID,KAAK,IACL,OAAQA,KAAD,CAAmCd,OAA1C,KAAsD,UAF1D,EAGE;AACE,UAAMgB,eAAe,GAAIF,KAAD,EAAmC;AACtDd,IAAAA,OADL;;AAECc,IAAAA,KAAD,CAAmCd,OAAnC,GAA6C,CAAC,GAAGd,IAAJ,KAAoB;AAC7Db,MAAAA,4BAA4B,CAACQ,iBAA7B,CAA+CoC,gBAA/C,CACI,GAAG/B,IADP;AAGA,aAAO8B,eAAe,CAAC,GAAG9B,IAAJ,CAAtB;AACH,KALD,CAHF,CASE;;;AACC4B,IAAAA,KAAD,CAGGV,sCAHH,GAG4CY,eAH5C;AAIH;;AACD,SAAOJ,gBAAgB,CAACC,OAAD,EAAUC,KAAV,EAAiB,GAAGC,IAApB,CAAvB;AACH,C","sourcesContent":["/*\n * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.\n * This product includes software developed at Datadog (https://www.datadoghq.com/).\n * Copyright 2016-Present Datadog, Inc.\n */\n\nimport React from 'react';\n\nimport { InternalLog } from '../../../InternalLog';\nimport { SdkVerbosity } from '../../../SdkVerbosity';\nimport { DdSdk } from '../../../sdk/DdSdk';\nimport { getErrorMessage } from '../../../utils/errorUtils';\n\nimport { DdEventsInterceptor } from './DdEventsInterceptor';\nimport type EventsInterceptor from './EventsInterceptor';\nimport NoOpEventsInterceptor from './NoOpEventsInterceptor';\nimport { areObjectShallowEqual } from './ShallowObjectEqualityChecker';\nimport { getJsxRuntime } from './getJsxRuntime';\n\n/**\n * Provides RUM auto-instrumentation feature to track user interaction as RUM events.\n * For now we are only covering the \"onPress\" events.\n */\nexport class DdRumUserInteractionTracking {\n private static isTracking = false;\n private static eventsInterceptor: EventsInterceptor = new NoOpEventsInterceptor();\n private static originalCreateElement = React.createElement;\n private static originalMemo = React.memo;\n private static originalJsx = null;\n\n private static patchCreateElementFunction = (\n originalFunction: typeof React.createElement,\n [element, props, ...rest]: Parameters<typeof React.createElement>\n ): ReturnType<typeof React.createElement> => {\n if (\n props &&\n typeof (props as Record<string, unknown>).onPress === 'function'\n ) {\n const originalOnPress = (props as Record<string, unknown>) // eslint-disable-next-line @typescript-eslint/ban-types\n .onPress as Function;\n (props as Record<string, unknown>).onPress = (...args: any[]) => {\n DdRumUserInteractionTracking.eventsInterceptor.interceptOnPress(\n ...args\n );\n return originalOnPress(...args);\n };\n // we store the original onPress prop so we can keep memoization working\n (props as Record<\n string,\n unknown\n >).__DATADOG_INTERNAL_ORIGINAL_ON_PRESS__ = originalOnPress;\n }\n return originalFunction(element, props, ...rest);\n };\n\n /**\n * Starts tracking user interactions and sends a RUM Action event every time a new interaction was detected.\n * Please note that we are only considering as valid - for - tracking only the user interactions that have\n * a visible output (either an UI state change or a Resource request)\n */\n static startTracking({\n actionNameAttribute\n }: { actionNameAttribute?: string } = {}): void {\n // extra safety to avoid wrapping more than 1 time this function\n if (DdRumUserInteractionTracking.isTracking) {\n InternalLog.log(\n 'Datadog SDK is already tracking interactions',\n SdkVerbosity.WARN\n );\n return;\n }\n DdRumUserInteractionTracking.eventsInterceptor = new DdEventsInterceptor(\n { actionNameAttribute }\n );\n\n const original = React.createElement;\n React.createElement = (\n ...args: Parameters<typeof React.createElement>\n ): any => {\n return this.patchCreateElementFunction(original, args);\n };\n\n try {\n const jsxRuntime = getJsxRuntime();\n const originalJsx = jsxRuntime.jsx;\n this.originalJsx = originalJsx;\n jsxRuntime.jsx = (\n ...args: Parameters<typeof React.createElement>\n ): ReturnType<typeof React.createElement> => {\n return this.patchCreateElementFunction(originalJsx, args);\n };\n } catch (e) {\n DdSdk.telemetryDebug(getErrorMessage(e));\n }\n\n const originalMemo = React.memo;\n\n React.memo = (\n component: any,\n propsAreEqual?: (prevProps: any, newProps: any) => boolean\n ) => {\n return originalMemo(component, (prev, next) => {\n if (!next.onPress || !prev.onPress) {\n return propsAreEqual\n ? propsAreEqual(prev, next)\n : areObjectShallowEqual(prev, next);\n }\n // we replace \"our\" onPress from the props by the original for comparison\n const { onPress: _prevOnPress, ...partialPrevProps } = prev;\n const prevProps = {\n ...partialPrevProps,\n onPress: prev.__DATADOG_INTERNAL_ORIGINAL_ON_PRESS__\n };\n\n const { onPress: _nextOnPress, ...partialNextProps } = next;\n const nextProps = {\n ...partialNextProps,\n onPress: next.__DATADOG_INTERNAL_ORIGINAL_ON_PRESS__\n };\n\n // if no comparison function is provided we do shallow comparison\n return propsAreEqual\n ? propsAreEqual(prevProps, nextProps)\n : areObjectShallowEqual(nextProps, prevProps);\n });\n };\n\n DdRumUserInteractionTracking.isTracking = true;\n InternalLog.log(\n 'Datadog SDK is tracking interactions',\n SdkVerbosity.INFO\n );\n }\n\n static stopTracking() {\n React.createElement = this.originalCreateElement;\n React.memo = this.originalMemo;\n DdRumUserInteractionTracking.isTracking = false;\n if (this.originalJsx) {\n const jsxRuntime = getJsxRuntime();\n jsxRuntime.jsx = this.originalJsx;\n this.originalJsx = null;\n }\n }\n}\n"]}
|
|
@@ -20,25 +20,24 @@ exports.filterDevResource = void 0;
|
|
|
20
20
|
*
|
|
21
21
|
* An example URL is http://192.168.1.20:8081/logs or http://10.46.29.155:19000/logs
|
|
22
22
|
*/
|
|
23
|
-
const EXPO_DEV_LOGS_REGEX = new RegExp('^http://((10|172|192).[0-9]+.[0-9]+.[0-9]+|localhost):[0-9]
|
|
23
|
+
const EXPO_DEV_LOGS_REGEX = new RegExp('^http://((10|172|192).[0-9]+.[0-9]+.[0-9]+|localhost|127.0.0.1):808[0-9]/logs$');
|
|
24
24
|
/**
|
|
25
25
|
* This call is made every time the RN packager reloads the js in dev mode.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
const RN_PACKAGER_SYMBOLICATE_REGEX = new RegExp('^http://localhost:[0-9]
|
|
29
|
-
const
|
|
28
|
+
const RN_PACKAGER_SYMBOLICATE_REGEX = new RegExp('^http://localhost:808[0-9]/symbolicate$');
|
|
29
|
+
const internalDevResourceBlocklist = [EXPO_DEV_LOGS_REGEX, RN_PACKAGER_SYMBOLICATE_REGEX];
|
|
30
30
|
/**
|
|
31
31
|
* Filters RN symbolicate calls and Expo logs calls that happen only in dev.
|
|
32
32
|
* @param resource RUMResource
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
35
|
const filterDevResource = resource => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return null;
|
|
36
|
+
if (__DEV__) {
|
|
37
|
+
for (const resourceRegex of internalDevResourceBlocklist) {
|
|
38
|
+
if (resourceRegex.test(resource.request.url)) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
42
41
|
}
|
|
43
42
|
}
|
|
44
43
|
|