@coralogix/react-native-plugin 0.13.1 → 0.14.1
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/CHANGELOG.md +20 -0
- package/CxSdk.podspec +3 -3
- package/README.md +18 -6
- package/android/build.gradle +6 -1
- package/android/src/main/java/com/cxsdk/CxSdkModule.kt +29 -17
- package/android/src/test/kotlin/com/cxsdk/ExtractOtelIdsTest.kt +10 -3
- package/android/src/test/kotlin/com/cxsdk/InstrumentationMapTest.kt +73 -0
- package/index.cjs.js +36 -42
- package/index.esm.js +36 -42
- package/ios/CxSdk.swift +10 -9
- package/package.json +1 -1
- package/src/model/Types.d.ts +11 -5
- package/src/utils.d.ts +11 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
## 0.14.1 (2026-10-15)
|
|
2
|
+
|
|
3
|
+
### 🩹 Fixes
|
|
4
|
+
|
|
5
|
+
- A sampled-out session now still adds the `traceparent` header to outgoing requests, so backend traces stay correlated; it reports only the SDK's initialization event and the categories listed in `excludeFromSampling`.
|
|
6
|
+
- `sessionSampleRate` is now applied by the native SDK alone and is re-evaluated for every new session, not only at app launch.
|
|
7
|
+
- On Android, `instrumentations: { errors: false }` and `instrumentations: { network: false }` now take effect.
|
|
8
|
+
- On iOS, a `null` value in `instrumentations` or `mobileVitals` no longer causes the other switches in that object to be ignored.
|
|
9
|
+
- A `RegExp` in `traceParentInHeader.options.allowedTracingUrls` now works on iOS and Android. Before, iOS added `traceparent` to every URL and Android ignored the entry.
|
|
10
|
+
|
|
11
|
+
## 0.14.0 (2026-10-14)
|
|
12
|
+
|
|
13
|
+
### 🚀 Features
|
|
14
|
+
|
|
15
|
+
- Network events now include the URL's `subdomain` and `domain`, and `host` keeps a non-default port, matching the browser SDK.
|
|
16
|
+
|
|
17
|
+
### ⬆️ Dependency Updates
|
|
18
|
+
|
|
19
|
+
- Native Android SDK bumped to **2.24.0** and native iOS SDK to **2.20.0**.
|
|
20
|
+
|
|
1
21
|
## 0.13.1 (2026-10-12)
|
|
2
22
|
|
|
3
23
|
### ⬆️ Dependency Updates
|
package/CxSdk.podspec
CHANGED
|
@@ -16,9 +16,9 @@ Pod::Spec.new do |s|
|
|
|
16
16
|
|
|
17
17
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
18
|
|
|
19
|
-
s.dependency 'Coralogix','2.
|
|
20
|
-
s.dependency 'CoralogixInternal','2.
|
|
21
|
-
s.dependency 'SessionReplay','2.
|
|
19
|
+
s.dependency 'Coralogix','2.20.0'
|
|
20
|
+
s.dependency 'CoralogixInternal','2.20.0'
|
|
21
|
+
s.dependency 'SessionReplay','2.20.0'
|
|
22
22
|
|
|
23
23
|
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
24
24
|
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
package/README.md
CHANGED
|
@@ -32,10 +32,17 @@ await CoralogixRum.init({
|
|
|
32
32
|
});
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
an integer.
|
|
35
|
+
The native SDK applies `sessionSampleRate` once per session, including each new
|
|
36
|
+
session after the previous one expires. Set it to a whole percentage in `0`-`100`.
|
|
37
|
+
The plugin rounds a fractional value to an integer, and never rounds a non-zero rate
|
|
38
|
+
down to `0`, because the native bridges read the value as an integer.
|
|
39
|
+
|
|
40
|
+
A sampled-out session still initializes the SDK and, when `traceParentInHeader` is
|
|
41
|
+
enabled, still adds the `traceparent` header to outgoing requests, so backend traces
|
|
42
|
+
stay correlated. It reports only the SDK's own initialization event, a
|
|
43
|
+
`session_replay_init` event if Session Replay starts, and the categories you list in
|
|
44
|
+
`excludeFromSampling`. At a low sample rate, expect these few events from sessions
|
|
45
|
+
that are otherwise not tracked.
|
|
39
46
|
|
|
40
47
|
To provide contextual information or transmit manual logs, utilize the exported functions of `CoralogixRum`.
|
|
41
48
|
Keep in mind that these functions will remain inactive until you've invoked `CoralogixRum.init()`.
|
|
@@ -265,8 +272,8 @@ launches do not report `cold_hybrid`.
|
|
|
265
272
|
|
|
266
273
|
### Exclude From Sampling
|
|
267
274
|
|
|
268
|
-
By default, when a session is sampled out (via `sessionSampleRate`),
|
|
269
|
-
|
|
275
|
+
By default, when a session is sampled out (via `sessionSampleRate`), none of its
|
|
276
|
+
RUM events are reported. Use `excludeFromSampling` to keep reporting specific
|
|
270
277
|
event categories even when the session is sampled out.
|
|
271
278
|
|
|
272
279
|
```javascript
|
|
@@ -282,6 +289,11 @@ await CoralogixRum.init({
|
|
|
282
289
|
Allowed values: `'errors'`, `'logs'`, `'network'`, `'userInteractions'`,
|
|
283
290
|
`'mobileVitals'`, `'customSpan'`, `'customMeasurement'`.
|
|
284
291
|
|
|
292
|
+
`excludeFromSampling` only affects sampled-out sessions; a sampled-in session
|
|
293
|
+
reports everything that is enabled. It never re-enables an instrumentation you
|
|
294
|
+
turned off in `instrumentations`: with `instrumentations: { network: false }`,
|
|
295
|
+
listing `'network'` here has no effect.
|
|
296
|
+
|
|
285
297
|
Inside a [`beforeSend`](#beforesend) callback, `session_context.isSessionSampledIn`
|
|
286
298
|
tells you whether an event came from a sampled-in session or reached you only via
|
|
287
299
|
`excludeFromSampling`, so excluded categories can be filtered further.
|
package/android/build.gradle
CHANGED
|
@@ -67,6 +67,8 @@ android {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
testOptions {
|
|
70
|
+
// android.util.Log and friends are stubs on the JVM; return defaults instead of throwing.
|
|
71
|
+
unitTests.returnDefaultValues = true
|
|
70
72
|
unitTests.all {
|
|
71
73
|
useJUnitPlatform()
|
|
72
74
|
}
|
|
@@ -87,10 +89,13 @@ dependencies {
|
|
|
87
89
|
// 2.22.0 is the first release exposing View.isCoralogixMasked() and
|
|
88
90
|
// View.isInsideCoralogixMaskedSubtree(), which the masked-interaction walk in
|
|
89
91
|
// reportUserInteraction reads instead of reimplementing the SDK's mask rule here.
|
|
90
|
-
implementation "com.coralogix:android-sdk:2.
|
|
92
|
+
implementation "com.coralogix:android-sdk:2.24.0"
|
|
91
93
|
|
|
92
94
|
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
|
|
93
95
|
testImplementation "org.mockito:mockito-core:5.12.0"
|
|
96
|
+
// android-sdk ships OTel at runtime only; compile against the API it brings (BOM 1.47.0).
|
|
97
|
+
compileOnly "io.opentelemetry:opentelemetry-api:1.47.0"
|
|
98
|
+
testImplementation "io.opentelemetry:opentelemetry-api:1.47.0"
|
|
94
99
|
}
|
|
95
100
|
|
|
96
101
|
react {
|
|
@@ -42,6 +42,7 @@ import com.facebook.react.bridge.ReactMethod
|
|
|
42
42
|
import com.facebook.react.bridge.ReadableArray
|
|
43
43
|
import com.facebook.react.bridge.ReadableMap
|
|
44
44
|
import com.facebook.react.bridge.ReadableType
|
|
45
|
+
import io.opentelemetry.api.trace.Span
|
|
45
46
|
import com.facebook.react.bridge.WritableArray
|
|
46
47
|
import com.facebook.react.bridge.WritableMap
|
|
47
48
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
@@ -638,7 +639,7 @@ class CxSdkModule(reactContext: ReactApplicationContext) :
|
|
|
638
639
|
version = getString("version") ?: "",
|
|
639
640
|
userContext = getMap("user_context")?.toUserContext() ?: UserContext(),
|
|
640
641
|
viewContext = ViewContext(getMap("view_context")?.getString("view") ?: ""),
|
|
641
|
-
instrumentations = getMap("instrumentations")?.toInstrumentationMap
|
|
642
|
+
instrumentations = getMap("instrumentations")?.let(::toInstrumentationMap) ?: mapOf(),
|
|
642
643
|
mobileVitalsOptions = getMap("mobileVitals")?.toMobileVitalsOptions() ?: mapOf(),
|
|
643
644
|
ignoreUrls = getArray("ignoreUrls")?.handleStringOrRegexList() ?: listOf(),
|
|
644
645
|
ignoreErrors = getArray("ignoreErrors")?.handleStringOrRegexList() ?: listOf(),
|
|
@@ -844,18 +845,6 @@ class CxSdkModule(reactContext: ReactApplicationContext) :
|
|
|
844
845
|
accountName = getString("account_name")
|
|
845
846
|
)
|
|
846
847
|
|
|
847
|
-
private fun ReadableMap.toInstrumentationMap(): Map<Instrumentation, Boolean> {
|
|
848
|
-
return mapOf(
|
|
849
|
-
Instrumentation.Error to if (hasKey("error")) getBoolean("error") else true,
|
|
850
|
-
Instrumentation.Network to if (hasKey("fetch")) getBoolean("fetch") else true,
|
|
851
|
-
Instrumentation.Custom to if (hasKey("custom")) getBoolean("custom") else true,
|
|
852
|
-
Instrumentation.MobileVitals to if (hasKey("mobile_vitals")) getBoolean("mobile_vitals") else true,
|
|
853
|
-
Instrumentation.Anr to if (hasKey("anr")) getBoolean("anr") else true,
|
|
854
|
-
Instrumentation.Lifecycle to if (hasKey("lifecycle")) getBoolean("lifecycle") else true,
|
|
855
|
-
Instrumentation.UserInteraction to if (hasKey("user_interaction")) getBoolean("user_interaction") else true,
|
|
856
|
-
)
|
|
857
|
-
}
|
|
858
|
-
|
|
859
848
|
private fun ReadableMap.toStringAnyMap(): Map<String, Any?> {
|
|
860
849
|
val result = mutableMapOf<String, Any?>()
|
|
861
850
|
val iterator = keySetIterator()
|
|
@@ -1109,16 +1098,39 @@ class CxSdkModule(reactContext: ReactApplicationContext) :
|
|
|
1109
1098
|
// at the same tree size.
|
|
1110
1099
|
private const val MASK_WALK_NODE_BUDGET = 512
|
|
1111
1100
|
|
|
1101
|
+
// Keyed by the JS `CoralogixOtelWebOptionsInstrumentations` field names, which the iOS
|
|
1102
|
+
// bridge reads as-is. A key that drifts from JS is never found, so its switch silently
|
|
1103
|
+
// stays on: `errors` and `network` were once read as "error" and "fetch".
|
|
1104
|
+
private val INSTRUMENTATION_KEYS = mapOf(
|
|
1105
|
+
"errors" to Instrumentation.Error,
|
|
1106
|
+
"network" to Instrumentation.Network,
|
|
1107
|
+
"custom" to Instrumentation.Custom,
|
|
1108
|
+
"mobile_vitals" to Instrumentation.MobileVitals,
|
|
1109
|
+
"anr" to Instrumentation.Anr,
|
|
1110
|
+
"lifecycle" to Instrumentation.Lifecycle,
|
|
1111
|
+
"user_interaction" to Instrumentation.UserInteraction,
|
|
1112
|
+
)
|
|
1113
|
+
|
|
1114
|
+
internal fun toInstrumentationMap(map: ReadableMap): Map<Instrumentation, Boolean> =
|
|
1115
|
+
INSTRUMENTATION_KEYS.entries.associate { (key, instrumentation) ->
|
|
1116
|
+
// Only an explicit boolean switches an instrumentation; null or a wrong type keeps the default.
|
|
1117
|
+
val explicit = map.hasKey(key) && map.getType(key) == ReadableType.Boolean
|
|
1118
|
+
instrumentation to (!explicit || map.getBoolean(key))
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1112
1121
|
// TODO: replace reflection with a public accessor once the Coralogix Android SDK exposes one —
|
|
1113
1122
|
// 'getSpan$library_release' is a Kotlin-internal name that may be renamed in a future SDK version.
|
|
1114
1123
|
internal fun extractOtelIds(child: CoralogixCustomSpan): Pair<String, String>? =
|
|
1115
1124
|
extractOtelIds(child, "getSpan\$library_release")
|
|
1116
1125
|
|
|
1117
1126
|
internal fun extractOtelIds(child: CoralogixCustomSpan, accessorName: String): Pair<String, String>? = try {
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
val
|
|
1127
|
+
// Only the accessor needs reflection. The span and its context are read through the
|
|
1128
|
+
// public OTel interfaces: their implementations (SdkSpan, AutoValue_ImmutableSpanContext)
|
|
1129
|
+
// are package-private, so reflecting on them is denied wherever access is enforced.
|
|
1130
|
+
val span = child.javaClass.getMethod(accessorName).invoke(child) as? Span ?: return null
|
|
1131
|
+
val ctx = span.spanContext
|
|
1132
|
+
val spanId = ctx.spanId
|
|
1133
|
+
val traceId = ctx.traceId
|
|
1122
1134
|
if (spanId.isNullOrEmpty() || traceId.isNullOrEmpty()) null
|
|
1123
1135
|
else Pair(spanId, traceId)
|
|
1124
1136
|
} catch (e: Throwable) {
|
|
@@ -13,6 +13,13 @@ import kotlin.test.assertNull
|
|
|
13
13
|
|
|
14
14
|
class ExtractOtelIdsTest {
|
|
15
15
|
|
|
16
|
+
// The constructor is Kotlin-internal to android-sdk; it compiles to a public JVM
|
|
17
|
+
// constructor, so build the span the way the SDK would, through reflection.
|
|
18
|
+
private fun customSpan(span: Span): CoralogixCustomSpan =
|
|
19
|
+
CoralogixCustomSpan::class.java.getDeclaredConstructor(Span::class.java)
|
|
20
|
+
.apply { isAccessible = true }
|
|
21
|
+
.newInstance(span)
|
|
22
|
+
|
|
16
23
|
@Test
|
|
17
24
|
fun `extractOtelIds returns correct spanId and traceId via reflection`() {
|
|
18
25
|
val spanId = "1234567890abcdef"
|
|
@@ -23,7 +30,7 @@ class ExtractOtelIdsTest {
|
|
|
23
30
|
SpanContext.create(traceId, spanId, TraceFlags.getDefault(), TraceState.getDefault())
|
|
24
31
|
)
|
|
25
32
|
|
|
26
|
-
val result = CxSdkModule.extractOtelIds(
|
|
33
|
+
val result = CxSdkModule.extractOtelIds(customSpan(mockSpan))
|
|
27
34
|
|
|
28
35
|
assertEquals(Pair(spanId, traceId), result)
|
|
29
36
|
}
|
|
@@ -33,7 +40,7 @@ class ExtractOtelIdsTest {
|
|
|
33
40
|
val mockSpan = mock(Span::class.java)
|
|
34
41
|
`when`(mockSpan.spanContext).thenReturn(null)
|
|
35
42
|
|
|
36
|
-
val result = CxSdkModule.extractOtelIds(
|
|
43
|
+
val result = CxSdkModule.extractOtelIds(customSpan(mockSpan))
|
|
37
44
|
|
|
38
45
|
assertNull(result)
|
|
39
46
|
}
|
|
@@ -42,7 +49,7 @@ class ExtractOtelIdsTest {
|
|
|
42
49
|
fun `extractOtelIds returns null when accessor method does not exist`() {
|
|
43
50
|
val mockSpan = mock(Span::class.java)
|
|
44
51
|
|
|
45
|
-
val result = CxSdkModule.extractOtelIds(
|
|
52
|
+
val result = CxSdkModule.extractOtelIds(customSpan(mockSpan), "nonExistentMethod")
|
|
46
53
|
|
|
47
54
|
assertNull(result)
|
|
48
55
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
package com.cxsdk
|
|
2
|
+
|
|
3
|
+
import com.coralogix.android.sdk.model.Instrumentation
|
|
4
|
+
import com.facebook.react.bridge.ReadableMap
|
|
5
|
+
import com.facebook.react.bridge.ReadableType
|
|
6
|
+
import org.mockito.Mockito.mock
|
|
7
|
+
import org.mockito.Mockito.`when`
|
|
8
|
+
import kotlin.test.Test
|
|
9
|
+
import kotlin.test.assertEquals
|
|
10
|
+
|
|
11
|
+
class InstrumentationMapTest {
|
|
12
|
+
|
|
13
|
+
/** A ReadableMap holding exactly [entries], as the JS bridge would send them. */
|
|
14
|
+
private fun readableMap(vararg entries: Pair<String, Boolean?>): ReadableMap {
|
|
15
|
+
val values = entries.toMap()
|
|
16
|
+
val map = mock(ReadableMap::class.java)
|
|
17
|
+
`when`(map.hasKey(org.mockito.ArgumentMatchers.anyString())).thenAnswer { values.containsKey(it.arguments[0]) }
|
|
18
|
+
`when`(map.getType(org.mockito.ArgumentMatchers.anyString())).thenAnswer {
|
|
19
|
+
if (values[it.arguments[0]] == null) ReadableType.Null else ReadableType.Boolean
|
|
20
|
+
}
|
|
21
|
+
`when`(map.getBoolean(org.mockito.ArgumentMatchers.anyString())).thenAnswer {
|
|
22
|
+
values[it.arguments[0]] ?: throw IllegalStateException("getBoolean on a non-boolean")
|
|
23
|
+
}
|
|
24
|
+
return map
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@Test
|
|
28
|
+
fun `every JS instrumentation key disables its native switch`() {
|
|
29
|
+
val jsKeys = mapOf(
|
|
30
|
+
"errors" to Instrumentation.Error,
|
|
31
|
+
"network" to Instrumentation.Network,
|
|
32
|
+
"custom" to Instrumentation.Custom,
|
|
33
|
+
"mobile_vitals" to Instrumentation.MobileVitals,
|
|
34
|
+
"anr" to Instrumentation.Anr,
|
|
35
|
+
"lifecycle" to Instrumentation.Lifecycle,
|
|
36
|
+
"user_interaction" to Instrumentation.UserInteraction,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
for ((key, instrumentation) in jsKeys) {
|
|
40
|
+
val result = CxSdkModule.toInstrumentationMap(readableMap(key to false))
|
|
41
|
+
|
|
42
|
+
assertEquals(false, result[instrumentation], "'$key: false' did not reach $instrumentation")
|
|
43
|
+
assertEquals(
|
|
44
|
+
jsKeys.values.filter { it != instrumentation }.toSet(),
|
|
45
|
+
result.filterValues { it }.keys,
|
|
46
|
+
"'$key: false' changed other switches",
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@Test
|
|
52
|
+
fun `missing keys default every switch on`() {
|
|
53
|
+
val result = CxSdkModule.toInstrumentationMap(readableMap())
|
|
54
|
+
|
|
55
|
+
assertEquals(7, result.size)
|
|
56
|
+
assertEquals(true, result.values.all { it })
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@Test
|
|
60
|
+
fun `legacy error and fetch keys are not read`() {
|
|
61
|
+
val result = CxSdkModule.toInstrumentationMap(readableMap("error" to false, "fetch" to false))
|
|
62
|
+
|
|
63
|
+
assertEquals(true, result[Instrumentation.Error])
|
|
64
|
+
assertEquals(true, result[Instrumentation.Network])
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@Test
|
|
68
|
+
fun `a null value keeps the default instead of throwing`() {
|
|
69
|
+
val result = CxSdkModule.toInstrumentationMap(readableMap("network" to null))
|
|
70
|
+
|
|
71
|
+
assertEquals(true, result[Instrumentation.Network])
|
|
72
|
+
}
|
|
73
|
+
}
|
package/index.cjs.js
CHANGED
|
@@ -1140,7 +1140,7 @@ function stopJsRefreshRateSampler() {
|
|
|
1140
1140
|
appStateSub = null;
|
|
1141
1141
|
}
|
|
1142
1142
|
|
|
1143
|
-
var version = "0.
|
|
1143
|
+
var version = "0.14.1";
|
|
1144
1144
|
var pkg = {
|
|
1145
1145
|
version: version};
|
|
1146
1146
|
|
|
@@ -1296,17 +1296,6 @@ const getUrlFragments = url => {
|
|
|
1296
1296
|
}
|
|
1297
1297
|
};
|
|
1298
1298
|
|
|
1299
|
-
/**
|
|
1300
|
-
* Rolls the session sampling dice.
|
|
1301
|
-
*
|
|
1302
|
-
* This is the only roll for a config without `excludeFromSampling`: `init` pins the
|
|
1303
|
-
* rate it sends to native to 100 in that case, so native does not roll again. See the
|
|
1304
|
-
* comment in `CoralogixRum.init` for why the exclude case is handled the other way round.
|
|
1305
|
-
*/
|
|
1306
|
-
function isSamplingOn(threshold) {
|
|
1307
|
-
return threshold > 0 && Math.random() * 100 <= threshold;
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
1299
|
/**
|
|
1311
1300
|
* Normalizes `sessionSampleRate` into the shape both native SDKs expect: an
|
|
1312
1301
|
* integer percentage in [0, 100].
|
|
@@ -1315,7 +1304,7 @@ function isSamplingOn(threshold) {
|
|
|
1315
1304
|
* `ReadableMap.getInt` on Android), so a fractional rate such as `0.5` would be
|
|
1316
1305
|
* truncated to `0` on iOS — silently sampling every session out — and can throw
|
|
1317
1306
|
* on Android. Round instead, and never round a caller-requested non-zero rate
|
|
1318
|
-
* down to `0`: `0` is the one value that
|
|
1307
|
+
* down to `0`: `0` is the one value that samples every session out.
|
|
1319
1308
|
*/
|
|
1320
1309
|
function normalizeSessionSampleRate(rate) {
|
|
1321
1310
|
if (typeof rate !== 'number' || !Number.isFinite(rate)) {
|
|
@@ -1349,6 +1338,29 @@ function resolveCoralogixOtelWebConfig(config) {
|
|
|
1349
1338
|
});
|
|
1350
1339
|
}
|
|
1351
1340
|
|
|
1341
|
+
/**
|
|
1342
|
+
* A RegExp cannot cross the RN bridge (it arrives as `{}`): iOS then drops the whole
|
|
1343
|
+
* allowlist, so `traceparent` goes to every URL, and Android drops the entry. Send each
|
|
1344
|
+
* RegExp as a pattern string instead. iOS finds the pattern anywhere in the URL, like
|
|
1345
|
+
* `RegExp.test`, but Android's native matcher requires it to match the whole URL, so the
|
|
1346
|
+
* source is wrapped in `.*(?:…).*` to behave the same on both. Only the `i` flag is
|
|
1347
|
+
* carried over, as `(?i)`.
|
|
1348
|
+
*/
|
|
1349
|
+
function serializeTraceParentInHeader(config) {
|
|
1350
|
+
var _config$options;
|
|
1351
|
+
const allowedTracingUrls = config == null || (_config$options = config.options) == null ? void 0 : _config$options.allowedTracingUrls;
|
|
1352
|
+
if (!config || !allowedTracingUrls) return config;
|
|
1353
|
+
return _extends({}, config, {
|
|
1354
|
+
options: _extends({}, config.options, {
|
|
1355
|
+
allowedTracingUrls: allowedTracingUrls.map(url => url instanceof RegExp ? toNativeUrlPattern(url) : url)
|
|
1356
|
+
})
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
function toNativeUrlPattern(regex) {
|
|
1360
|
+
const caseInsensitive = regex.flags.includes('i') ? '(?i)' : '';
|
|
1361
|
+
return `${caseInsensitive}.*(?:${regex.source}).*`;
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1352
1364
|
let OtelNetworkAttrs = /*#__PURE__*/function (OtelNetworkAttrs) {
|
|
1353
1365
|
OtelNetworkAttrs["METHOD"] = "http.method";
|
|
1354
1366
|
OtelNetworkAttrs["URL"] = "http.url";
|
|
@@ -1737,9 +1749,6 @@ let isInited = false;
|
|
|
1737
1749
|
// Set for the duration of an in-flight `init()` so concurrent callers join it
|
|
1738
1750
|
// instead of starting a second initialization. See `CoralogixRum.init`.
|
|
1739
1751
|
let initPromise;
|
|
1740
|
-
// Whether native, rather than JS, rolled the sampling for this init. Only in that mode can
|
|
1741
|
-
// `CoralogixRum.isInited` be true while native has no RUM behind it.
|
|
1742
|
-
let nativeOwnsSamplingRoll = false;
|
|
1743
1752
|
let fetchInstrumentation;
|
|
1744
1753
|
|
|
1745
1754
|
/**
|
|
@@ -1865,7 +1874,7 @@ async function runInit(options,
|
|
|
1865
1874
|
// which can call `init()` again, and a shared flag would let that nested call answer for
|
|
1866
1875
|
// this one.
|
|
1867
1876
|
progress) {
|
|
1868
|
-
var _options$debug,
|
|
1877
|
+
var _options$debug, _finalOptions$instrum, _finalOptions$mobileV;
|
|
1869
1878
|
// Configure the logger before anything that can warn: the `public_key` check below, and
|
|
1870
1879
|
// resolving the options, which normalizes `sessionSampleRate` and warns about an invalid
|
|
1871
1880
|
// rate. Setting it any later swallowed those warnings on the first init — exactly when
|
|
@@ -1877,21 +1886,11 @@ progress) {
|
|
|
1877
1886
|
}
|
|
1878
1887
|
const resolvedOptions = resolveCoralogixOtelWebConfig(options);
|
|
1879
1888
|
|
|
1880
|
-
// The
|
|
1881
|
-
//
|
|
1882
|
-
//
|
|
1883
|
-
//
|
|
1884
|
-
//
|
|
1885
|
-
// instrumentation off a session that would emit nothing. With `excludeFromSampling`,
|
|
1886
|
-
// only native can honour "sampled out, but still emit these categories", so JS does not
|
|
1887
|
-
// roll and forwards the real rate — pinning to 100 there would sample every session in.
|
|
1888
|
-
const hasExcludeOverrides = ((_resolvedOptions$excl = (_resolvedOptions$excl2 = resolvedOptions.excludeFromSampling) == null ? void 0 : _resolvedOptions$excl2.length) != null ? _resolvedOptions$excl : 0) > 0;
|
|
1889
|
-
if (!hasExcludeOverrides && !isSamplingOn(resolvedOptions.sessionSampleRate)) {
|
|
1890
|
-
logger.debug('CoralogixRum: Session tracking is disabled');
|
|
1891
|
-
return;
|
|
1892
|
-
}
|
|
1893
|
-
nativeOwnsSamplingRoll = hasExcludeOverrides;
|
|
1894
|
-
const nativeSessionSampleRate = hasExcludeOverrides ? resolvedOptions.sessionSampleRate : 100;
|
|
1889
|
+
// The sampling decision belongs to native alone: JS never rolls, and the real rate
|
|
1890
|
+
// crosses the bridge. Native rolls once per session — again on every rotation, which a
|
|
1891
|
+
// one-shot JS roll could never cover — and decides per event what is reported. Init
|
|
1892
|
+
// still runs for a sampled-out session, because that session must keep propagating
|
|
1893
|
+
// `traceparent` and still emit whatever `excludeFromSampling` names.
|
|
1895
1894
|
|
|
1896
1895
|
// Past every bail-out above: this init is really happening, and only from here is there
|
|
1897
1896
|
// an in-flight run for other callers to join. Everything above returns synchronously, so
|
|
@@ -1928,9 +1927,9 @@ progress) {
|
|
|
1928
1927
|
});
|
|
1929
1928
|
}
|
|
1930
1929
|
await CxSdk.initialize(_extends({}, finalOptions, {
|
|
1931
|
-
sessionSampleRate: nativeSessionSampleRate,
|
|
1932
1930
|
frameworkVersion: pkg.version,
|
|
1933
1931
|
networkExtraConfig: finalOptions.networkExtraConfig ? serializeNetworkCaptureRules(finalOptions.networkExtraConfig) : undefined,
|
|
1932
|
+
traceParentInHeader: serializeTraceParentInHeader(finalOptions.traceParentInHeader),
|
|
1934
1933
|
hasBeforeSend: !!finalOptions.beforeSend,
|
|
1935
1934
|
hasTracesExporter: !!finalOptions.tracesExporter,
|
|
1936
1935
|
reportHybridColdStart: ((_finalOptions$instrum = finalOptions.instrumentations) == null ? void 0 : _finalOptions$instrum.mobile_vitals) !== false && ((_finalOptions$mobileV = finalOptions.mobileVitals) == null ? void 0 : _finalOptions$mobileV.cold) !== false
|
|
@@ -1982,7 +1981,7 @@ const CoralogixRum = {
|
|
|
1982
1981
|
const run = runInit(options, progress);
|
|
1983
1982
|
|
|
1984
1983
|
// `runInit` runs synchronously until its first `await`, so this already tells us
|
|
1985
|
-
// whether it bailed out
|
|
1984
|
+
// whether it bailed out on an invalid `public_key`. Such a run is
|
|
1986
1985
|
// finished and must not be memoized: its cleanup below only lands on a later
|
|
1987
1986
|
// microtask, so a valid `init()` in this same tick would otherwise join the aborted
|
|
1988
1987
|
// promise and never initialize at all.
|
|
@@ -2201,14 +2200,9 @@ const SessionReplay = {
|
|
|
2201
2200
|
// so coerce instead of handing a truthy string back through a `Promise<boolean>`.
|
|
2202
2201
|
return !!(await CxSdk.initializeSessionReplay(options));
|
|
2203
2202
|
} catch (e) {
|
|
2204
|
-
//
|
|
2205
|
-
//
|
|
2206
|
-
|
|
2207
|
-
// unhandled rejection. Every other rejection is a real error and stays the caller's.
|
|
2208
|
-
if (!nativeOwnsSamplingRoll) {
|
|
2209
|
-
throw e;
|
|
2210
|
-
}
|
|
2211
|
-
logger.warn('SessionReplay.init: no native RUM for this session (sampled out); replay not started.', e);
|
|
2203
|
+
// A native failure must not surface as an unhandled rejection in an app that calls
|
|
2204
|
+
// init without a catch; report it as `false`, like the guards above.
|
|
2205
|
+
logger.warn('SessionReplay.init: native initialization failed; replay not started.', e);
|
|
2212
2206
|
return false;
|
|
2213
2207
|
}
|
|
2214
2208
|
},
|
package/index.esm.js
CHANGED
|
@@ -1138,7 +1138,7 @@ function stopJsRefreshRateSampler() {
|
|
|
1138
1138
|
appStateSub = null;
|
|
1139
1139
|
}
|
|
1140
1140
|
|
|
1141
|
-
var version = "0.
|
|
1141
|
+
var version = "0.14.1";
|
|
1142
1142
|
var pkg = {
|
|
1143
1143
|
version: version};
|
|
1144
1144
|
|
|
@@ -1294,17 +1294,6 @@ const getUrlFragments = url => {
|
|
|
1294
1294
|
}
|
|
1295
1295
|
};
|
|
1296
1296
|
|
|
1297
|
-
/**
|
|
1298
|
-
* Rolls the session sampling dice.
|
|
1299
|
-
*
|
|
1300
|
-
* This is the only roll for a config without `excludeFromSampling`: `init` pins the
|
|
1301
|
-
* rate it sends to native to 100 in that case, so native does not roll again. See the
|
|
1302
|
-
* comment in `CoralogixRum.init` for why the exclude case is handled the other way round.
|
|
1303
|
-
*/
|
|
1304
|
-
function isSamplingOn(threshold) {
|
|
1305
|
-
return threshold > 0 && Math.random() * 100 <= threshold;
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
1297
|
/**
|
|
1309
1298
|
* Normalizes `sessionSampleRate` into the shape both native SDKs expect: an
|
|
1310
1299
|
* integer percentage in [0, 100].
|
|
@@ -1313,7 +1302,7 @@ function isSamplingOn(threshold) {
|
|
|
1313
1302
|
* `ReadableMap.getInt` on Android), so a fractional rate such as `0.5` would be
|
|
1314
1303
|
* truncated to `0` on iOS — silently sampling every session out — and can throw
|
|
1315
1304
|
* on Android. Round instead, and never round a caller-requested non-zero rate
|
|
1316
|
-
* down to `0`: `0` is the one value that
|
|
1305
|
+
* down to `0`: `0` is the one value that samples every session out.
|
|
1317
1306
|
*/
|
|
1318
1307
|
function normalizeSessionSampleRate(rate) {
|
|
1319
1308
|
if (typeof rate !== 'number' || !Number.isFinite(rate)) {
|
|
@@ -1347,6 +1336,29 @@ function resolveCoralogixOtelWebConfig(config) {
|
|
|
1347
1336
|
});
|
|
1348
1337
|
}
|
|
1349
1338
|
|
|
1339
|
+
/**
|
|
1340
|
+
* A RegExp cannot cross the RN bridge (it arrives as `{}`): iOS then drops the whole
|
|
1341
|
+
* allowlist, so `traceparent` goes to every URL, and Android drops the entry. Send each
|
|
1342
|
+
* RegExp as a pattern string instead. iOS finds the pattern anywhere in the URL, like
|
|
1343
|
+
* `RegExp.test`, but Android's native matcher requires it to match the whole URL, so the
|
|
1344
|
+
* source is wrapped in `.*(?:…).*` to behave the same on both. Only the `i` flag is
|
|
1345
|
+
* carried over, as `(?i)`.
|
|
1346
|
+
*/
|
|
1347
|
+
function serializeTraceParentInHeader(config) {
|
|
1348
|
+
var _config$options;
|
|
1349
|
+
const allowedTracingUrls = config == null || (_config$options = config.options) == null ? void 0 : _config$options.allowedTracingUrls;
|
|
1350
|
+
if (!config || !allowedTracingUrls) return config;
|
|
1351
|
+
return _extends({}, config, {
|
|
1352
|
+
options: _extends({}, config.options, {
|
|
1353
|
+
allowedTracingUrls: allowedTracingUrls.map(url => url instanceof RegExp ? toNativeUrlPattern(url) : url)
|
|
1354
|
+
})
|
|
1355
|
+
});
|
|
1356
|
+
}
|
|
1357
|
+
function toNativeUrlPattern(regex) {
|
|
1358
|
+
const caseInsensitive = regex.flags.includes('i') ? '(?i)' : '';
|
|
1359
|
+
return `${caseInsensitive}.*(?:${regex.source}).*`;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1350
1362
|
let OtelNetworkAttrs = /*#__PURE__*/function (OtelNetworkAttrs) {
|
|
1351
1363
|
OtelNetworkAttrs["METHOD"] = "http.method";
|
|
1352
1364
|
OtelNetworkAttrs["URL"] = "http.url";
|
|
@@ -1735,9 +1747,6 @@ let isInited = false;
|
|
|
1735
1747
|
// Set for the duration of an in-flight `init()` so concurrent callers join it
|
|
1736
1748
|
// instead of starting a second initialization. See `CoralogixRum.init`.
|
|
1737
1749
|
let initPromise;
|
|
1738
|
-
// Whether native, rather than JS, rolled the sampling for this init. Only in that mode can
|
|
1739
|
-
// `CoralogixRum.isInited` be true while native has no RUM behind it.
|
|
1740
|
-
let nativeOwnsSamplingRoll = false;
|
|
1741
1750
|
let fetchInstrumentation;
|
|
1742
1751
|
|
|
1743
1752
|
/**
|
|
@@ -1863,7 +1872,7 @@ async function runInit(options,
|
|
|
1863
1872
|
// which can call `init()` again, and a shared flag would let that nested call answer for
|
|
1864
1873
|
// this one.
|
|
1865
1874
|
progress) {
|
|
1866
|
-
var _options$debug,
|
|
1875
|
+
var _options$debug, _finalOptions$instrum, _finalOptions$mobileV;
|
|
1867
1876
|
// Configure the logger before anything that can warn: the `public_key` check below, and
|
|
1868
1877
|
// resolving the options, which normalizes `sessionSampleRate` and warns about an invalid
|
|
1869
1878
|
// rate. Setting it any later swallowed those warnings on the first init — exactly when
|
|
@@ -1875,21 +1884,11 @@ progress) {
|
|
|
1875
1884
|
}
|
|
1876
1885
|
const resolvedOptions = resolveCoralogixOtelWebConfig(options);
|
|
1877
1886
|
|
|
1878
|
-
// The
|
|
1879
|
-
//
|
|
1880
|
-
//
|
|
1881
|
-
//
|
|
1882
|
-
//
|
|
1883
|
-
// instrumentation off a session that would emit nothing. With `excludeFromSampling`,
|
|
1884
|
-
// only native can honour "sampled out, but still emit these categories", so JS does not
|
|
1885
|
-
// roll and forwards the real rate — pinning to 100 there would sample every session in.
|
|
1886
|
-
const hasExcludeOverrides = ((_resolvedOptions$excl = (_resolvedOptions$excl2 = resolvedOptions.excludeFromSampling) == null ? void 0 : _resolvedOptions$excl2.length) != null ? _resolvedOptions$excl : 0) > 0;
|
|
1887
|
-
if (!hasExcludeOverrides && !isSamplingOn(resolvedOptions.sessionSampleRate)) {
|
|
1888
|
-
logger.debug('CoralogixRum: Session tracking is disabled');
|
|
1889
|
-
return;
|
|
1890
|
-
}
|
|
1891
|
-
nativeOwnsSamplingRoll = hasExcludeOverrides;
|
|
1892
|
-
const nativeSessionSampleRate = hasExcludeOverrides ? resolvedOptions.sessionSampleRate : 100;
|
|
1887
|
+
// The sampling decision belongs to native alone: JS never rolls, and the real rate
|
|
1888
|
+
// crosses the bridge. Native rolls once per session — again on every rotation, which a
|
|
1889
|
+
// one-shot JS roll could never cover — and decides per event what is reported. Init
|
|
1890
|
+
// still runs for a sampled-out session, because that session must keep propagating
|
|
1891
|
+
// `traceparent` and still emit whatever `excludeFromSampling` names.
|
|
1893
1892
|
|
|
1894
1893
|
// Past every bail-out above: this init is really happening, and only from here is there
|
|
1895
1894
|
// an in-flight run for other callers to join. Everything above returns synchronously, so
|
|
@@ -1926,9 +1925,9 @@ progress) {
|
|
|
1926
1925
|
});
|
|
1927
1926
|
}
|
|
1928
1927
|
await CxSdk.initialize(_extends({}, finalOptions, {
|
|
1929
|
-
sessionSampleRate: nativeSessionSampleRate,
|
|
1930
1928
|
frameworkVersion: pkg.version,
|
|
1931
1929
|
networkExtraConfig: finalOptions.networkExtraConfig ? serializeNetworkCaptureRules(finalOptions.networkExtraConfig) : undefined,
|
|
1930
|
+
traceParentInHeader: serializeTraceParentInHeader(finalOptions.traceParentInHeader),
|
|
1932
1931
|
hasBeforeSend: !!finalOptions.beforeSend,
|
|
1933
1932
|
hasTracesExporter: !!finalOptions.tracesExporter,
|
|
1934
1933
|
reportHybridColdStart: ((_finalOptions$instrum = finalOptions.instrumentations) == null ? void 0 : _finalOptions$instrum.mobile_vitals) !== false && ((_finalOptions$mobileV = finalOptions.mobileVitals) == null ? void 0 : _finalOptions$mobileV.cold) !== false
|
|
@@ -1980,7 +1979,7 @@ const CoralogixRum = {
|
|
|
1980
1979
|
const run = runInit(options, progress);
|
|
1981
1980
|
|
|
1982
1981
|
// `runInit` runs synchronously until its first `await`, so this already tells us
|
|
1983
|
-
// whether it bailed out
|
|
1982
|
+
// whether it bailed out on an invalid `public_key`. Such a run is
|
|
1984
1983
|
// finished and must not be memoized: its cleanup below only lands on a later
|
|
1985
1984
|
// microtask, so a valid `init()` in this same tick would otherwise join the aborted
|
|
1986
1985
|
// promise and never initialize at all.
|
|
@@ -2199,14 +2198,9 @@ const SessionReplay = {
|
|
|
2199
2198
|
// so coerce instead of handing a truthy string back through a `Promise<boolean>`.
|
|
2200
2199
|
return !!(await CxSdk.initializeSessionReplay(options));
|
|
2201
2200
|
} catch (e) {
|
|
2202
|
-
//
|
|
2203
|
-
//
|
|
2204
|
-
|
|
2205
|
-
// unhandled rejection. Every other rejection is a real error and stays the caller's.
|
|
2206
|
-
if (!nativeOwnsSamplingRoll) {
|
|
2207
|
-
throw e;
|
|
2208
|
-
}
|
|
2209
|
-
logger.warn('SessionReplay.init: no native RUM for this session (sampled out); replay not started.', e);
|
|
2201
|
+
// A native failure must not surface as an unhandled rejection in an app that calls
|
|
2202
|
+
// init without a catch; report it as `false`, like the guards above.
|
|
2203
|
+
logger.warn('SessionReplay.init: native initialization failed; replay not started.', e);
|
|
2210
2204
|
return false;
|
|
2211
2205
|
}
|
|
2212
2206
|
},
|
package/ios/CxSdk.swift
CHANGED
|
@@ -607,21 +607,22 @@ class CxSdk: RCTEventEmitter {
|
|
|
607
607
|
|
|
608
608
|
let coralogixDomain = self.getCoralogixDomain(domain: domain)
|
|
609
609
|
let labels = parameter["labels"] as? [String: Any] ?? [String: Any]()
|
|
610
|
-
|
|
611
|
-
|
|
610
|
+
// Read the switch maps key by key: casting the whole map to [String: Int] fails on a
|
|
611
|
+
// single null (NSNull) value and would silently drop every switch in it.
|
|
612
|
+
let instrumentations = parameter["instrumentations"] as? [String: Any] ?? [:]
|
|
612
613
|
var instrumentationDict: [CoralogixExporterOptions.InstrumentationType: Bool] = [:]
|
|
613
614
|
for (key, value) in instrumentations {
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
615
|
+
guard let instrumentationKey = instrumentationType(from: key),
|
|
616
|
+
let enabled = (value as? NSNumber)?.boolValue else { continue }
|
|
617
|
+
instrumentationDict[instrumentationKey] = enabled
|
|
617
618
|
}
|
|
618
619
|
|
|
619
|
-
let mobileVitals = parameter["mobileVitals"] as? [String:
|
|
620
|
+
let mobileVitals = parameter["mobileVitals"] as? [String: Any] ?? [:]
|
|
620
621
|
var mobileVitalsDict: [CoralogixExporterOptions.MobileVitalsType: Bool] = [:]
|
|
621
622
|
for (key, value) in mobileVitals {
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
623
|
+
guard let mobileVitalsKey = mobileVitalsType(from: key),
|
|
624
|
+
let enabled = (value as? NSNumber)?.boolValue else { continue }
|
|
625
|
+
mobileVitalsDict[mobileVitalsKey] = enabled
|
|
625
626
|
}
|
|
626
627
|
|
|
627
628
|
let userContext = parameter["user_context"] as? [String: Any]
|
package/package.json
CHANGED
package/src/model/Types.d.ts
CHANGED
|
@@ -125,6 +125,10 @@ export interface NetworkRequestContext {
|
|
|
125
125
|
fragments: string;
|
|
126
126
|
host: string;
|
|
127
127
|
schema: string;
|
|
128
|
+
/** Labels left of `domain` in the URL's hostname, e.g. `blog` for `blog.example.com`. */
|
|
129
|
+
subdomain?: string;
|
|
130
|
+
/** Last two labels of the URL's hostname, e.g. `example.com` for `blog.example.com`. */
|
|
131
|
+
domain?: string;
|
|
128
132
|
status_text: string;
|
|
129
133
|
response_content_length: string;
|
|
130
134
|
duration: number;
|
|
@@ -321,10 +325,10 @@ export interface CoralogixBrowserSdkConfig {
|
|
|
321
325
|
/**
|
|
322
326
|
* Percentage of overall sessions being tracked, defaults to 100%.
|
|
323
327
|
*
|
|
324
|
-
* The rate is applied exactly once
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
+
* The rate is applied exactly once, by the native SDK, which rolls it again on
|
|
329
|
+
* every session rotation. The plugin never rolls it. A sampled-out session still
|
|
330
|
+
* initializes and propagates `traceparent`, and reports only the SDK's own
|
|
331
|
+
* initialization event plus the categories in `excludeFromSampling`.
|
|
328
332
|
*
|
|
329
333
|
* Expressed as a whole percentage in [0, 100]; a fractional value is rounded
|
|
330
334
|
* (never down to 0) because the native bridges read it as an integer.
|
|
@@ -332,7 +336,9 @@ export interface CoralogixBrowserSdkConfig {
|
|
|
332
336
|
sessionSampleRate?: number;
|
|
333
337
|
/**
|
|
334
338
|
* Event categories that bypass session sampling. Events of these categories are
|
|
335
|
-
* emitted even when the session is sampled out.
|
|
339
|
+
* emitted even when the session is sampled out. Has no effect on a sampled-in
|
|
340
|
+
* session, and never re-enables an instrumentation turned off in
|
|
341
|
+
* `instrumentations`. Defaults to `[]`.
|
|
336
342
|
*/
|
|
337
343
|
excludeFromSampling?: ExcludableInstrumentation[];
|
|
338
344
|
/** Collect IP data */
|
package/src/utils.d.ts
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
import { CoralogixBrowserSdkConfig } from './model/Types';
|
|
1
|
+
import { CoralogixBrowserSdkConfig, TraceParentInHeader } from './model/Types';
|
|
2
2
|
export declare const hrTimeToMilliseconds: ([seconds, nanoseconds]: [number, number]) => number;
|
|
3
3
|
export declare const getUrlFragments: (url: string) => string;
|
|
4
|
-
/**
|
|
5
|
-
* Rolls the session sampling dice.
|
|
6
|
-
*
|
|
7
|
-
* This is the only roll for a config without `excludeFromSampling`: `init` pins the
|
|
8
|
-
* rate it sends to native to 100 in that case, so native does not roll again. See the
|
|
9
|
-
* comment in `CoralogixRum.init` for why the exclude case is handled the other way round.
|
|
10
|
-
*/
|
|
11
|
-
export declare function isSamplingOn(threshold: number): boolean;
|
|
12
4
|
/**
|
|
13
5
|
* Normalizes `sessionSampleRate` into the shape both native SDKs expect: an
|
|
14
6
|
* integer percentage in [0, 100].
|
|
@@ -17,7 +9,16 @@ export declare function isSamplingOn(threshold: number): boolean;
|
|
|
17
9
|
* `ReadableMap.getInt` on Android), so a fractional rate such as `0.5` would be
|
|
18
10
|
* truncated to `0` on iOS — silently sampling every session out — and can throw
|
|
19
11
|
* on Android. Round instead, and never round a caller-requested non-zero rate
|
|
20
|
-
* down to `0`: `0` is the one value that
|
|
12
|
+
* down to `0`: `0` is the one value that samples every session out.
|
|
21
13
|
*/
|
|
22
14
|
export declare function normalizeSessionSampleRate(rate: unknown): number;
|
|
23
15
|
export declare function resolveCoralogixOtelWebConfig(config: CoralogixBrowserSdkConfig): CoralogixBrowserSdkConfig;
|
|
16
|
+
/**
|
|
17
|
+
* A RegExp cannot cross the RN bridge (it arrives as `{}`): iOS then drops the whole
|
|
18
|
+
* allowlist, so `traceparent` goes to every URL, and Android drops the entry. Send each
|
|
19
|
+
* RegExp as a pattern string instead. iOS finds the pattern anywhere in the URL, like
|
|
20
|
+
* `RegExp.test`, but Android's native matcher requires it to match the whole URL, so the
|
|
21
|
+
* source is wrapped in `.*(?:…).*` to behave the same on both. Only the `i` flag is
|
|
22
|
+
* carried over, as `(?i)`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function serializeTraceParentInHeader(config: TraceParentInHeader | undefined): TraceParentInHeader | undefined;
|