@datadog/mobile-react-native 2.3.1 → 2.3.3
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 +1 -0
- package/android/build.gradle +2 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkBridgeExt.kt +188 -20
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +30 -13
- package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
- package/android/src/newarch/kotlin/com/datadog/reactnative/DdLogs.kt +3 -2
- package/android/src/newarch/kotlin/com/datadog/reactnative/DdRum.kt +28 -13
- package/android/src/newarch/kotlin/com/datadog/reactnative/DdSdk.kt +3 -2
- package/android/src/newarch/kotlin/com/datadog/reactnative/DdTrace.kt +4 -2
- package/android/src/oldarch/kotlin/com/datadog/reactnative/DdLogs.kt +1 -1
- package/android/src/oldarch/kotlin/com/datadog/reactnative/DdRum.kt +3 -2
- package/android/src/oldarch/kotlin/com/datadog/reactnative/DdTrace.kt +4 -2
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkBridgeExtTest.kt +382 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/MapExt.kt +9 -0
- package/ios/Sources/JSRefreshRateListener.swift +1 -0
- package/ios/Sources/SdkVersion.swift +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.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 +7 -7
- package/lib/typescript/logs/types.d.ts +10 -10
- package/lib/typescript/nativeModulesTypes.d.ts +5 -5
- package/lib/typescript/rum/eventMappers/actionEventMapper.d.ts +4 -4
- package/lib/typescript/rum/eventMappers/errorEventMapper.d.ts +4 -4
- package/lib/typescript/rum/eventMappers/resourceEventMapper.d.ts +4 -4
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts +3 -3
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/interfaces/RumResource.d.ts +1 -1
- package/lib/typescript/rum/types.d.ts +3 -3
- package/lib/typescript/sdk/AttributesSingleton/types.d.ts +1 -1
- package/lib/typescript/sdk/DatadogProvider/DatadogProvider.d.ts +2 -2
- package/lib/typescript/sdk/EventMappers/EventMapper.d.ts +1 -1
- package/lib/typescript/sdk/UserInfoSingleton/types.d.ts +1 -1
- package/lib/typescript/types.d.ts +2 -2
- package/lib/typescript/utils/TimeProvider.d.ts +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +1 -1
- package/src/version.ts +1 -1
package/android/build.gradle
CHANGED
|
@@ -18,6 +18,8 @@ buildscript {
|
|
|
18
18
|
classpath "org.jlleitschuh.gradle:ktlint-gradle:11.5.1"
|
|
19
19
|
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.18.0"
|
|
20
20
|
classpath 'com.github.bjoernq:unmockplugin:0.7.9'
|
|
21
|
+
// Uncomment here and in settings.gradle for getting rid of IDE errors for new architecture:
|
|
22
|
+
// classpath "com.facebook.react:react-native-gradle-plugin"
|
|
21
23
|
}
|
|
22
24
|
}
|
|
23
25
|
|
|
@@ -6,33 +6,91 @@
|
|
|
6
6
|
|
|
7
7
|
package com.datadog.reactnative
|
|
8
8
|
|
|
9
|
+
import android.util.Log
|
|
10
|
+
import com.facebook.react.bridge.Arguments
|
|
11
|
+
import com.facebook.react.bridge.ReadableArray
|
|
12
|
+
import com.facebook.react.bridge.ReadableMap
|
|
13
|
+
import com.facebook.react.bridge.ReadableType
|
|
14
|
+
import com.facebook.react.bridge.WritableArray
|
|
15
|
+
import com.facebook.react.bridge.WritableMap
|
|
9
16
|
import com.facebook.react.bridge.WritableNativeArray
|
|
10
17
|
import com.facebook.react.bridge.WritableNativeMap
|
|
11
18
|
|
|
12
|
-
|
|
13
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Converts the [List] to a [WritableNativeArray].
|
|
21
|
+
*/
|
|
22
|
+
internal fun List<*>.toWritableArray(): WritableArray {
|
|
23
|
+
return this.toWritableArray(
|
|
24
|
+
createWritableMap = { WritableNativeMap() },
|
|
25
|
+
createWritableArray = { WritableNativeArray() }
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Converts the [List] to a [WritableArray].
|
|
31
|
+
* @param createWritableMap a function to provide a concrete instance of new WritableMap(s)
|
|
32
|
+
* @param createWritableArray a function to provide a concrete instance of new WritableArray(s)
|
|
33
|
+
*/
|
|
34
|
+
internal fun List<*>.toWritableArray(
|
|
35
|
+
createWritableMap: () -> WritableMap,
|
|
36
|
+
createWritableArray: () -> WritableArray
|
|
37
|
+
): WritableArray {
|
|
38
|
+
val writableArray = createWritableArray()
|
|
39
|
+
|
|
14
40
|
for (it in iterator()) {
|
|
15
|
-
@Suppress("NotImplementedDeclaration")
|
|
16
41
|
when (it) {
|
|
17
|
-
null ->
|
|
18
|
-
is Int ->
|
|
19
|
-
is Long ->
|
|
20
|
-
is Float ->
|
|
21
|
-
is Double ->
|
|
22
|
-
is String ->
|
|
23
|
-
is
|
|
24
|
-
is
|
|
25
|
-
|
|
42
|
+
null -> writableArray.pushNull()
|
|
43
|
+
is Int -> writableArray.pushInt(it)
|
|
44
|
+
is Long -> writableArray.pushDouble(it.toDouble())
|
|
45
|
+
is Float -> writableArray.pushDouble(it.toDouble())
|
|
46
|
+
is Double -> writableArray.pushDouble(it)
|
|
47
|
+
is String -> writableArray.pushString(it)
|
|
48
|
+
is Boolean -> writableArray.pushBoolean(it)
|
|
49
|
+
is List<*> -> writableArray.pushArray(
|
|
50
|
+
it.toWritableArray(
|
|
51
|
+
createWritableMap,
|
|
52
|
+
createWritableArray
|
|
53
|
+
)
|
|
54
|
+
)
|
|
55
|
+
is Map<*, *> -> writableArray.pushMap(
|
|
56
|
+
it.toWritableMap(
|
|
57
|
+
createWritableMap,
|
|
58
|
+
createWritableArray
|
|
59
|
+
)
|
|
60
|
+
)
|
|
61
|
+
else -> Log.e(
|
|
62
|
+
javaClass.simpleName,
|
|
63
|
+
"toWritableArray(): Unhandled type ${it.javaClass.simpleName} has been ignored"
|
|
64
|
+
)
|
|
26
65
|
}
|
|
27
66
|
}
|
|
28
|
-
|
|
67
|
+
|
|
68
|
+
return writableArray
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Converts the [Map] to a [WritableNativeMap].
|
|
73
|
+
*/
|
|
74
|
+
internal fun Map<*, *>.toWritableMap(): WritableMap {
|
|
75
|
+
return this.toWritableMap(
|
|
76
|
+
createWritableMap = { WritableNativeMap() },
|
|
77
|
+
createWritableArray = { WritableNativeArray() }
|
|
78
|
+
)
|
|
29
79
|
}
|
|
30
80
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Converts the [Map] to a [WritableMap].
|
|
83
|
+
* @param createWritableMap a function to provide a concrete instance for WritableMap(s)
|
|
84
|
+
* @param createWritableArray a function to provide a concrete instance for WritableArray(s)
|
|
85
|
+
*/
|
|
86
|
+
internal fun Map<*, *>.toWritableMap(
|
|
87
|
+
createWritableMap: () -> WritableMap,
|
|
88
|
+
createWritableArray: () -> WritableArray
|
|
89
|
+
): WritableMap {
|
|
90
|
+
val map = createWritableMap()
|
|
91
|
+
|
|
92
|
+
for ((k, v) in iterator()) {
|
|
34
93
|
val key = (k as? String) ?: k.toString()
|
|
35
|
-
@Suppress("NotImplementedDeclaration")
|
|
36
94
|
when (v) {
|
|
37
95
|
null -> map.putNull(key)
|
|
38
96
|
is Int -> map.putInt(key, v)
|
|
@@ -40,10 +98,120 @@ internal fun Map<*, *>.toWritableMap(): WritableNativeMap {
|
|
|
40
98
|
is Float -> map.putDouble(key, v.toDouble())
|
|
41
99
|
is Double -> map.putDouble(key, v)
|
|
42
100
|
is String -> map.putString(key, v)
|
|
43
|
-
is
|
|
44
|
-
is
|
|
45
|
-
|
|
101
|
+
is Boolean -> map.putBoolean(key, v)
|
|
102
|
+
is List<*> -> map.putArray(
|
|
103
|
+
key,
|
|
104
|
+
v.toWritableArray(
|
|
105
|
+
createWritableMap,
|
|
106
|
+
createWritableArray
|
|
107
|
+
)
|
|
108
|
+
)
|
|
109
|
+
is Map<*, *> -> map.putMap(
|
|
110
|
+
key,
|
|
111
|
+
v.toWritableMap(
|
|
112
|
+
createWritableMap,
|
|
113
|
+
createWritableArray
|
|
114
|
+
)
|
|
115
|
+
)
|
|
116
|
+
else -> Log.e(
|
|
117
|
+
javaClass.simpleName,
|
|
118
|
+
"toWritableMap(): Unhandled type ${v.javaClass.simpleName} has been ignored"
|
|
119
|
+
)
|
|
46
120
|
}
|
|
47
121
|
}
|
|
122
|
+
|
|
48
123
|
return map
|
|
49
124
|
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Recursively converts the [ReadableMap] to a [Map] which only contains Kotlin stdlib objects,
|
|
128
|
+
* such as [List], [Map] and the raw types.
|
|
129
|
+
*/
|
|
130
|
+
internal fun ReadableMap.toMap(): Map<String, Any> {
|
|
131
|
+
val map = this.toHashMap()
|
|
132
|
+
val iterator = map.keys.iterator()
|
|
133
|
+
|
|
134
|
+
fun updateMap(key: String, value: Any?) {
|
|
135
|
+
if (value != null) {
|
|
136
|
+
map[key] = value
|
|
137
|
+
} else {
|
|
138
|
+
map.remove(key)
|
|
139
|
+
Log.e(
|
|
140
|
+
javaClass.simpleName,
|
|
141
|
+
"toMap(): Cannot convert nested object for key: $key"
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
while (iterator.hasNext()) {
|
|
147
|
+
val key = iterator.next()
|
|
148
|
+
try {
|
|
149
|
+
when (val type = getType(key)) {
|
|
150
|
+
ReadableType.Map -> updateMap(key, getMap(key)?.toMap())
|
|
151
|
+
ReadableType.Array -> updateMap(key, getArray(key)?.toList())
|
|
152
|
+
ReadableType.Null, ReadableType.Boolean, ReadableType.Number, ReadableType.String -> {}
|
|
153
|
+
else -> {
|
|
154
|
+
map.remove(key)
|
|
155
|
+
Log.e(
|
|
156
|
+
javaClass.simpleName,
|
|
157
|
+
"toMap(): Skipping unhandled type [${type.name}] for key: $key"
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
} catch (err: IllegalArgumentException) {
|
|
162
|
+
map.remove(key)
|
|
163
|
+
Log.e(
|
|
164
|
+
javaClass.simpleName,
|
|
165
|
+
"toMap(): Could not convert object for key: $key",
|
|
166
|
+
err
|
|
167
|
+
)
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return map
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Recursively converts the [ReadableArray] to a [List] which only contains Kotlin stdlib objects,
|
|
176
|
+
* such as [List], [Map] and the raw types.
|
|
177
|
+
* or [List], instead of [ReadableMap] and [ReadableArray] respectively).
|
|
178
|
+
*/
|
|
179
|
+
internal fun ReadableArray.toList(): List<*> {
|
|
180
|
+
val list = mutableListOf<Any?>()
|
|
181
|
+
for (i in 0 until size()) {
|
|
182
|
+
// ReadableArray throws a null pointer exception if getMap(i) or getArray(i) returns null
|
|
183
|
+
@Suppress("TooGenericExceptionCaught")
|
|
184
|
+
try {
|
|
185
|
+
when (val type = getType(i)) {
|
|
186
|
+
ReadableType.Null -> list.add(null)
|
|
187
|
+
ReadableType.Boolean -> list.add(getBoolean(i))
|
|
188
|
+
ReadableType.Number -> list.add(getDouble(i))
|
|
189
|
+
ReadableType.String -> list.add(getString(i))
|
|
190
|
+
ReadableType.Map -> {
|
|
191
|
+
// getMap() return type is nullable in previous RN versions
|
|
192
|
+
@Suppress("USELESS_ELVIS")
|
|
193
|
+
val readableMap = getMap(i) ?: Arguments.createMap()
|
|
194
|
+
list.add(readableMap.toMap())
|
|
195
|
+
}
|
|
196
|
+
ReadableType.Array -> {
|
|
197
|
+
// getArray() return type is nullable in previous RN versions
|
|
198
|
+
@Suppress("USELESS_ELVIS")
|
|
199
|
+
val readableArray = getArray(i) ?: Arguments.createArray()
|
|
200
|
+
list.add(readableArray.toList())
|
|
201
|
+
}
|
|
202
|
+
else -> Log.e(
|
|
203
|
+
javaClass.simpleName,
|
|
204
|
+
"toList(): Unhandled ReadableType: ${type.name}."
|
|
205
|
+
)
|
|
206
|
+
}
|
|
207
|
+
} catch (err: NullPointerException) {
|
|
208
|
+
Log.e(
|
|
209
|
+
javaClass.simpleName,
|
|
210
|
+
"toList(): Could not convert object at index: $i.",
|
|
211
|
+
err
|
|
212
|
+
)
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return list
|
|
217
|
+
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
@file:Suppress("TooManyFunctions")
|
|
8
|
+
|
|
8
9
|
package com.datadog.reactnative
|
|
9
10
|
|
|
10
11
|
import android.util.Log
|
|
@@ -94,13 +95,27 @@ internal fun ReadableMap.asProxyConfig(): Pair<Proxy, ProxyAuthenticator?>? {
|
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
internal fun ReadableArray.asFirstPartyHosts(): Map<String, Set<TracingHeaderType>> {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
98
|
+
return this.toList().mapNotNull {
|
|
99
|
+
if (it == null) {
|
|
100
|
+
null
|
|
101
|
+
} else if (it !is Map<*, *>) {
|
|
102
|
+
Log.e(
|
|
103
|
+
javaClass.simpleName,
|
|
104
|
+
"Ignoring $it (${it.javaClass.simpleName}) because it is not of type Map"
|
|
105
|
+
)
|
|
106
|
+
null
|
|
107
|
+
} else {
|
|
108
|
+
val match = it["match"] as? String
|
|
109
|
+
|
|
110
|
+
@Suppress("UNCHECKED_CAST")
|
|
111
|
+
val propagatorTypes = it["propagatorTypes"] as? List<String>
|
|
112
|
+
|
|
113
|
+
if (match != null && propagatorTypes != null) {
|
|
114
|
+
JSONFirstPartyHost(match, propagatorTypes)
|
|
115
|
+
} else {
|
|
116
|
+
null
|
|
117
|
+
}
|
|
118
|
+
}
|
|
104
119
|
}.asFirstPartyHosts()
|
|
105
120
|
}
|
|
106
121
|
|
|
@@ -239,7 +254,13 @@ internal fun CustomEndpoints.toReadableMap(): ReadableMap {
|
|
|
239
254
|
return map
|
|
240
255
|
}
|
|
241
256
|
|
|
242
|
-
private fun buildProxyConfig(
|
|
257
|
+
private fun buildProxyConfig(
|
|
258
|
+
type: String,
|
|
259
|
+
address: String,
|
|
260
|
+
port: Int,
|
|
261
|
+
username: String?,
|
|
262
|
+
password: String?
|
|
263
|
+
): Pair<Proxy, ProxyAuthenticator?>? {
|
|
243
264
|
val proxyType = when (type.lowercase(Locale.US)) {
|
|
244
265
|
"http", "https" -> Proxy.Type.HTTP
|
|
245
266
|
"socks" -> Proxy.Type.SOCKS
|
|
@@ -250,11 +271,7 @@ private fun buildProxyConfig(type: String, address: String, port: Int, username:
|
|
|
250
271
|
)
|
|
251
272
|
null
|
|
252
273
|
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
if (proxyType == null) {
|
|
256
|
-
return null
|
|
257
|
-
}
|
|
274
|
+
} ?: return null
|
|
258
275
|
|
|
259
276
|
val proxy = Proxy(proxyType, InetSocketAddress(address, port))
|
|
260
277
|
|
|
@@ -15,10 +15,11 @@ import com.facebook.react.bridge.ReadableMap
|
|
|
15
15
|
* The entry point to use Datadog's Logs feature.
|
|
16
16
|
*/
|
|
17
17
|
class DdLogs(
|
|
18
|
-
reactContext: ReactApplicationContext
|
|
18
|
+
reactContext: ReactApplicationContext,
|
|
19
|
+
datadogWrapper: DatadogWrapper = DatadogSDKWrapper()
|
|
19
20
|
) : NativeDdLogsSpec(reactContext) {
|
|
20
21
|
|
|
21
|
-
private val implementation = DdLogsImplementation()
|
|
22
|
+
private val implementation = DdLogsImplementation(datadog = datadogWrapper)
|
|
22
23
|
|
|
23
24
|
override fun getName(): String = DdLogsImplementation.NAME
|
|
24
25
|
|
|
@@ -15,9 +15,12 @@ import com.facebook.react.bridge.ReadableMap
|
|
|
15
15
|
* The entry point to use Datadog's RUM feature.
|
|
16
16
|
*/
|
|
17
17
|
@Suppress("TooManyFunctions")
|
|
18
|
-
class DdRum(
|
|
18
|
+
class DdRum(
|
|
19
|
+
reactContext: ReactApplicationContext,
|
|
20
|
+
datadogWrapper: DatadogWrapper = DatadogSDKWrapper()
|
|
21
|
+
) : NativeDdRumSpec(reactContext) {
|
|
19
22
|
|
|
20
|
-
private val implementation = DdRumImplementation()
|
|
23
|
+
private val implementation = DdRumImplementation(datadog = datadogWrapper)
|
|
21
24
|
|
|
22
25
|
override fun getName(): String = DdRumImplementation.NAME
|
|
23
26
|
|
|
@@ -26,7 +29,8 @@ class DdRum(reactContext: ReactApplicationContext) : NativeDdRumSpec(reactContex
|
|
|
26
29
|
* @param key The view unique key identifier.
|
|
27
30
|
* @param name The view name.
|
|
28
31
|
* @param context The additional context to send.
|
|
29
|
-
* @param timestampMs The timestamp when the view started (in milliseconds). If not provided,
|
|
32
|
+
* @param timestampMs The timestamp when the view started (in milliseconds). If not provided,
|
|
33
|
+
* current timestamp will be used.
|
|
30
34
|
*/
|
|
31
35
|
@ReactMethod
|
|
32
36
|
override fun startView(
|
|
@@ -43,7 +47,8 @@ class DdRum(reactContext: ReactApplicationContext) : NativeDdRumSpec(reactContex
|
|
|
43
47
|
* Stop tracking a RUM View.
|
|
44
48
|
* @param key The view unique key identifier.
|
|
45
49
|
* @param context The additional context to send.
|
|
46
|
-
* @param timestampMs The timestamp when the view stopped (in milliseconds).
|
|
50
|
+
* @param timestampMs The timestamp when the view stopped (in milliseconds).
|
|
51
|
+
* If not provided, current timestamp will be used.
|
|
47
52
|
*/
|
|
48
53
|
@ReactMethod
|
|
49
54
|
override fun stopView(key: String, context: ReadableMap, timestampMs: Double, promise: Promise) {
|
|
@@ -55,7 +60,8 @@ class DdRum(reactContext: ReactApplicationContext) : NativeDdRumSpec(reactContex
|
|
|
55
60
|
* @param type The action type (tap, scroll, swipe, click, custom).
|
|
56
61
|
* @param name The action name.
|
|
57
62
|
* @param context The additional context to send.
|
|
58
|
-
* @param timestampMs The timestamp when the action started (in milliseconds).
|
|
63
|
+
* @param timestampMs The timestamp when the action started (in milliseconds).
|
|
64
|
+
* If not provided, current timestamp will be used.
|
|
59
65
|
*/
|
|
60
66
|
@ReactMethod
|
|
61
67
|
override fun startAction(
|
|
@@ -73,7 +79,8 @@ class DdRum(reactContext: ReactApplicationContext) : NativeDdRumSpec(reactContex
|
|
|
73
79
|
* @param type The action type (tap, scroll, swipe, click, custom).
|
|
74
80
|
* @param name The action name.
|
|
75
81
|
* @param context The additional context to send.
|
|
76
|
-
* @param timestampMs The timestamp when the action stopped (in milliseconds).
|
|
82
|
+
* @param timestampMs The timestamp when the action stopped (in milliseconds).
|
|
83
|
+
* If not provided, current timestamp will be used.
|
|
77
84
|
*/
|
|
78
85
|
@ReactMethod
|
|
79
86
|
override fun stopAction(
|
|
@@ -91,7 +98,8 @@ class DdRum(reactContext: ReactApplicationContext) : NativeDdRumSpec(reactContex
|
|
|
91
98
|
* @param type The action type (tap, scroll, swipe, click, custom).
|
|
92
99
|
* @param name The action name.
|
|
93
100
|
* @param context The additional context to send.
|
|
94
|
-
* @param timestampMs The timestamp when the action occurred (in milliseconds).
|
|
101
|
+
* @param timestampMs The timestamp when the action occurred (in milliseconds).
|
|
102
|
+
* If not provided, current timestamp will be used.
|
|
95
103
|
*/
|
|
96
104
|
@ReactMethod
|
|
97
105
|
override fun addAction(
|
|
@@ -110,7 +118,8 @@ class DdRum(reactContext: ReactApplicationContext) : NativeDdRumSpec(reactContex
|
|
|
110
118
|
* @param method The resource method (GET, POST, …).
|
|
111
119
|
* @param url The resource url.
|
|
112
120
|
* @param context The additional context to send.
|
|
113
|
-
* @param timestampMs The timestamp when the resource started (in milliseconds).
|
|
121
|
+
* @param timestampMs The timestamp when the resource started (in milliseconds).
|
|
122
|
+
* If not provided, current timestamp will be used.
|
|
114
123
|
*/
|
|
115
124
|
@Suppress("LongParameterList")
|
|
116
125
|
@ReactMethod
|
|
@@ -132,7 +141,8 @@ class DdRum(reactContext: ReactApplicationContext) : NativeDdRumSpec(reactContex
|
|
|
132
141
|
* @param kind The resource's kind (xhr, document, image, css, font, …).
|
|
133
142
|
* @param size The resource size in bytes.
|
|
134
143
|
* @param context The additional context to send.
|
|
135
|
-
* @param timestampMs The timestamp when the resource stopped (in milliseconds).
|
|
144
|
+
* @param timestampMs The timestamp when the resource stopped (in milliseconds).
|
|
145
|
+
* If not provided, current timestamp will be used.
|
|
136
146
|
*/
|
|
137
147
|
@Suppress("LongParameterList")
|
|
138
148
|
@ReactMethod
|
|
@@ -154,7 +164,8 @@ class DdRum(reactContext: ReactApplicationContext) : NativeDdRumSpec(reactContex
|
|
|
154
164
|
* @param source The error source (network, source, console, logger, …).
|
|
155
165
|
* @param stacktrace The error stacktrace.
|
|
156
166
|
* @param context The additional context to send.
|
|
157
|
-
* @param timestampMs The timestamp when the error occurred (in milliseconds).
|
|
167
|
+
* @param timestampMs The timestamp when the error occurred (in milliseconds).
|
|
168
|
+
* If not provided, current timestamp will be used.
|
|
158
169
|
*/
|
|
159
170
|
@Suppress("LongParameterList")
|
|
160
171
|
@ReactMethod
|
|
@@ -170,8 +181,11 @@ class DdRum(reactContext: ReactApplicationContext) : NativeDdRumSpec(reactContex
|
|
|
170
181
|
}
|
|
171
182
|
|
|
172
183
|
/**
|
|
173
|
-
* Adds a specific timing in the active View. The timing duration will be computed as the
|
|
174
|
-
*
|
|
184
|
+
* Adds a specific timing in the active View. The timing duration will be computed as the
|
|
185
|
+
* difference between the time the View was started and the time this function was called.
|
|
186
|
+
* @param name The name of the new custom timing attribute.
|
|
187
|
+
* Timings can be nested up to 8 levels deep.
|
|
188
|
+
* Names using more than 8 levels will be sanitized by SDK.
|
|
175
189
|
*/
|
|
176
190
|
@ReactMethod
|
|
177
191
|
override fun addTiming(name: String, promise: Promise) {
|
|
@@ -188,7 +202,8 @@ class DdRum(reactContext: ReactApplicationContext) : NativeDdRumSpec(reactContex
|
|
|
188
202
|
|
|
189
203
|
/**
|
|
190
204
|
* Adds result of evaluating a feature flag to the view.
|
|
191
|
-
* Feature flag evaluations are local to the active view and are cleared when the view
|
|
205
|
+
* Feature flag evaluations are local to the active view and are cleared when the view
|
|
206
|
+
* is stopped.
|
|
192
207
|
* @param name The name of the feature flag
|
|
193
208
|
* @param value The value the feature flag evaluated to, encapsulated in a Map
|
|
194
209
|
*/
|
|
@@ -13,10 +13,11 @@ import com.facebook.react.bridge.ReadableMap
|
|
|
13
13
|
|
|
14
14
|
/** The entry point to initialize Datadog's features. */
|
|
15
15
|
class DdSdk(
|
|
16
|
-
reactContext: ReactApplicationContext
|
|
16
|
+
reactContext: ReactApplicationContext,
|
|
17
|
+
datadogWrapper: DatadogWrapper = DatadogSDKWrapper()
|
|
17
18
|
) : NativeDdSdkSpec(reactContext) {
|
|
18
19
|
|
|
19
|
-
private val implementation = DdSdkImplementation(reactContext)
|
|
20
|
+
private val implementation = DdSdkImplementation(reactContext, datadog = datadogWrapper)
|
|
20
21
|
|
|
21
22
|
override fun getName(): String = DdSdkImplementation.NAME
|
|
22
23
|
|
|
@@ -26,7 +26,8 @@ class DdTrace(
|
|
|
26
26
|
* Start a span, and returns a unique identifier for the span.
|
|
27
27
|
* @param operation The operation name of the span.
|
|
28
28
|
* @param context The additional context to send.
|
|
29
|
-
* @param timestampMs The timestamp when the operation started (in milliseconds).
|
|
29
|
+
* @param timestampMs The timestamp when the operation started (in milliseconds).
|
|
30
|
+
* If not provided, current timestamp will be used.
|
|
30
31
|
*/
|
|
31
32
|
@ReactMethod
|
|
32
33
|
override fun startSpan(operation: String, context: ReadableMap, timestampMs: Double, promise: Promise) {
|
|
@@ -37,7 +38,8 @@ class DdTrace(
|
|
|
37
38
|
* Finish a started span.
|
|
38
39
|
* @param spanId The unique identifier of the span.
|
|
39
40
|
* @param context The additional context to send.
|
|
40
|
-
* @param timestampMs The timestamp when the operation stopped (in milliseconds).
|
|
41
|
+
* @param timestampMs The timestamp when the operation stopped (in milliseconds).
|
|
42
|
+
* If not provided, current timestamp will be used.
|
|
41
43
|
*/
|
|
42
44
|
@ReactMethod
|
|
43
45
|
override fun finishSpan(spanId: String, context: ReadableMap, timestampMs: Double, promise: Promise) {
|
|
@@ -17,7 +17,7 @@ import com.facebook.react.bridge.ReadableMap
|
|
|
17
17
|
*/
|
|
18
18
|
class DdLogs(
|
|
19
19
|
reactContext: ReactApplicationContext,
|
|
20
|
-
datadogWrapper: DatadogWrapper
|
|
20
|
+
datadogWrapper: DatadogWrapper = DatadogSDKWrapper()
|
|
21
21
|
) : ReactContextBaseJavaModule(reactContext) {
|
|
22
22
|
|
|
23
23
|
private val implementation = DdLogsImplementation(datadog = datadogWrapper)
|
|
@@ -18,7 +18,7 @@ import com.facebook.react.bridge.ReadableMap
|
|
|
18
18
|
@Suppress("TooManyFunctions")
|
|
19
19
|
class DdRum(
|
|
20
20
|
reactContext: ReactApplicationContext,
|
|
21
|
-
datadogWrapper: DatadogWrapper
|
|
21
|
+
datadogWrapper: DatadogWrapper = DatadogSDKWrapper()
|
|
22
22
|
) : ReactContextBaseJavaModule(reactContext) {
|
|
23
23
|
|
|
24
24
|
private val implementation = DdRumImplementation(datadog = datadogWrapper)
|
|
@@ -30,7 +30,8 @@ class DdRum(
|
|
|
30
30
|
* @param key The view unique key identifier.
|
|
31
31
|
* @param name The view name.
|
|
32
32
|
* @param context The additional context to send.
|
|
33
|
-
* @param timestampMs The timestamp when the view started (in milliseconds).
|
|
33
|
+
* @param timestampMs The timestamp when the view started (in milliseconds).
|
|
34
|
+
* If not provided, current timestamp will be used.
|
|
34
35
|
*/
|
|
35
36
|
@ReactMethod
|
|
36
37
|
fun startView(
|
|
@@ -27,7 +27,8 @@ class DdTrace(
|
|
|
27
27
|
* Start a span, and returns a unique identifier for the span.
|
|
28
28
|
* @param operation The operation name of the span.
|
|
29
29
|
* @param context The additional context to send.
|
|
30
|
-
* @param timestampMs The timestamp when the operation started (in milliseconds).
|
|
30
|
+
* @param timestampMs The timestamp when the operation started (in milliseconds).
|
|
31
|
+
* If not provided, current timestamp will be used.
|
|
31
32
|
*/
|
|
32
33
|
@ReactMethod
|
|
33
34
|
fun startSpan(operation: String, context: ReadableMap, timestampMs: Double, promise: Promise) {
|
|
@@ -38,7 +39,8 @@ class DdTrace(
|
|
|
38
39
|
* Finish a started span.
|
|
39
40
|
* @param spanId The unique identifier of the span.
|
|
40
41
|
* @param context The additional context to send.
|
|
41
|
-
* @param timestampMs The timestamp when the operation stopped (in milliseconds).
|
|
42
|
+
* @param timestampMs The timestamp when the operation stopped (in milliseconds).
|
|
43
|
+
* If not provided, current timestamp will be used.
|
|
42
44
|
*/
|
|
43
45
|
@ReactMethod
|
|
44
46
|
fun finishSpan(spanId: String, context: ReadableMap, timestampMs: Double, promise: Promise) {
|