@datadog/mobile-react-native 2.3.6 → 2.4.0
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 +4 -4
- package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
- package/android/src/test/kotlin/com/datadog/tools/unit/MockRumMonitor.kt +2 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/TelemetryConfigurationEventForgeryFactory.kt +15 -0
- package/android/src/test/resources/input/complete-configuration.json +5 -1
- package/datadog-configuration.schema.json +54 -9
- package/ios/Sources/DatadogSDKWrapper.swift +3 -3
- package/ios/Sources/SdkVersion.swift +1 -1
- package/lib/commonjs/DdSdkReactNative.js +2 -1
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +7 -4
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +14 -9
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +2 -6
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js +182 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +10 -57
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +18 -10
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js +4 -2
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/DdSdkReactNative.js +2 -1
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +7 -4
- package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js +14 -9
- package/lib/module/rum/instrumentation/interactionTracking/DdEventsInterceptor.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +2 -6
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js +169 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +3 -54
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +13 -8
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js +3 -2
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.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 +5 -1
- package/lib/typescript/rum/instrumentation/interactionTracking/DdEventsInterceptor.d.ts +12 -3
- package/lib/typescript/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts +2 -3
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.d.ts +111 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts +1 -24
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts +2 -0
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/DdSdkReactNative.tsx +4 -1
- package/src/DdSdkReactNativeConfiguration.tsx +10 -4
- package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +7 -2
- package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +32 -0
- package/src/rum/instrumentation/interactionTracking/DdEventsInterceptor.tsx +23 -7
- package/src/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.tsx +3 -4
- package/src/rum/instrumentation/resourceTracking/distributedTracing/TracingIdentifier.tsx +227 -0
- package/src/rum/instrumentation/resourceTracking/distributedTracing/__tests__/__utils__/TracingIdentifierUtils.ts +64 -0
- package/src/rum/instrumentation/resourceTracking/distributedTracing/__tests__/distributedTracing.test.ts +314 -42
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.tsx +4 -59
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.ts +33 -19
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.ts +7 -2
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/__tests__/XHRProxy.test.ts +134 -11
- package/src/sdk/FileBasedConfiguration/__tests__/FileBasedConfiguration.test.ts +3 -0
- package/src/version.ts +1 -1
package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/__tests__/XHRProxy.test.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { BufferSingleton } from '../../../../../../sdk/DatadogProvider/Buffer/Bu
|
|
|
12
12
|
import { DdRum } from '../../../../../DdRum';
|
|
13
13
|
import { PropagatorType } from '../../../../../types';
|
|
14
14
|
import { XMLHttpRequestMock } from '../../../__tests__/__utils__/XMLHttpRequestMock';
|
|
15
|
+
import TracingIdentifierUtils from '../../../distributedTracing/__tests__/__utils__/tracingIdentifierUtils';
|
|
15
16
|
import {
|
|
16
17
|
PARENT_ID_HEADER_KEY,
|
|
17
18
|
TRACE_ID_HEADER_KEY,
|
|
@@ -23,7 +24,8 @@ import {
|
|
|
23
24
|
B3_MULTI_SAMPLED_HEADER_KEY,
|
|
24
25
|
ORIGIN_RUM,
|
|
25
26
|
ORIGIN_HEADER_KEY,
|
|
26
|
-
TRACESTATE_HEADER_KEY
|
|
27
|
+
TRACESTATE_HEADER_KEY,
|
|
28
|
+
TAGS_HEADER_KEY
|
|
27
29
|
} from '../../../distributedTracing/distributedTracingHeaders';
|
|
28
30
|
import { firstPartyHostsRegexMapBuilder } from '../../../distributedTracing/firstPartyHosts';
|
|
29
31
|
import {
|
|
@@ -450,7 +452,9 @@ describe('XHRProxy', () => {
|
|
|
450
452
|
|
|
451
453
|
// THEN
|
|
452
454
|
const contextHeader = xhr.requestHeaders[TRACECONTEXT_HEADER_KEY];
|
|
453
|
-
expect(contextHeader).toMatch(
|
|
455
|
+
expect(contextHeader).toMatch(
|
|
456
|
+
/^00-[0-9a-f]{8}[0]{8}[0-9a-f]{16}-[0-9a-f]{16}-01$/
|
|
457
|
+
);
|
|
454
458
|
|
|
455
459
|
// Parent value of the context header is the 3rd part of it
|
|
456
460
|
const parentValue = contextHeader.split('-')[2];
|
|
@@ -458,6 +462,99 @@ describe('XHRProxy', () => {
|
|
|
458
462
|
expect(stateHeader).toBe(`dd=s:1;o:rum;p:${parentValue}`);
|
|
459
463
|
});
|
|
460
464
|
|
|
465
|
+
it('adds correct trace IDs headers for all propagatorTypes', async () => {
|
|
466
|
+
// GIVEN
|
|
467
|
+
const method = 'GET';
|
|
468
|
+
const url = 'https://api.example.com:443/v2/user';
|
|
469
|
+
xhrProxy.onTrackingStart({
|
|
470
|
+
tracingSamplingRate: 100,
|
|
471
|
+
firstPartyHostsRegexMap: firstPartyHostsRegexMapBuilder([
|
|
472
|
+
{
|
|
473
|
+
match: 'example.com',
|
|
474
|
+
propagatorTypes: [PropagatorType.DATADOG]
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
match: 'example.com',
|
|
478
|
+
propagatorTypes: [PropagatorType.TRACECONTEXT]
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
match: 'example.com',
|
|
482
|
+
propagatorTypes: [PropagatorType.B3]
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
match: 'example.com',
|
|
486
|
+
propagatorTypes: [PropagatorType.B3MULTI]
|
|
487
|
+
}
|
|
488
|
+
])
|
|
489
|
+
});
|
|
490
|
+
|
|
491
|
+
// WHEN
|
|
492
|
+
const xhr = new XMLHttpRequestMock();
|
|
493
|
+
xhr.open(method, url);
|
|
494
|
+
xhr.send();
|
|
495
|
+
xhr.notifyResponseArrived();
|
|
496
|
+
xhr.complete(200, 'ok');
|
|
497
|
+
await flushPromises();
|
|
498
|
+
|
|
499
|
+
// THEN
|
|
500
|
+
|
|
501
|
+
/* =================================================================================
|
|
502
|
+
* Verify that the trace id in the traceparent header is a 128 bit trace ID (hex).
|
|
503
|
+
* ================================================================================= */
|
|
504
|
+
const traceparentHeader =
|
|
505
|
+
xhr.requestHeaders[TRACECONTEXT_HEADER_KEY];
|
|
506
|
+
const traceparentTraceId = traceparentHeader.split('-')[1];
|
|
507
|
+
|
|
508
|
+
expect(traceparentTraceId).toMatch(
|
|
509
|
+
/^[0-9a-f]{8}[0]{8}[0-9a-f]{16}$/
|
|
510
|
+
);
|
|
511
|
+
expect(
|
|
512
|
+
TracingIdentifierUtils.isWithin128Bits(traceparentTraceId, 16)
|
|
513
|
+
);
|
|
514
|
+
|
|
515
|
+
/* =========================================================================
|
|
516
|
+
* Verify that the trace id in the x-datadog-trace-id is a 64 bit decimal.
|
|
517
|
+
* ========================================================================= */
|
|
518
|
+
|
|
519
|
+
// x-datadog-trace-id is a decimal representing the low 64 bits of the 128 bits Trace ID
|
|
520
|
+
const xDatadogTraceId = xhr.requestHeaders[TRACE_ID_HEADER_KEY];
|
|
521
|
+
|
|
522
|
+
expect(TracingIdentifierUtils.isWithin64Bits(xDatadogTraceId));
|
|
523
|
+
|
|
524
|
+
/* ===============================================================
|
|
525
|
+
* Verify that the trace id in x-datadog-tags headers is HEX 16.
|
|
526
|
+
* =============================================================== */
|
|
527
|
+
|
|
528
|
+
// x-datadog-tags is a HEX 16 contains the high 64 bits of the 128 bits Trace ID
|
|
529
|
+
const xDatadogTagsTraceId = xhr.requestHeaders[
|
|
530
|
+
TAGS_HEADER_KEY
|
|
531
|
+
].split('=')[1];
|
|
532
|
+
|
|
533
|
+
expect(xDatadogTagsTraceId).toMatch(/^[a-f0-9]{16}$/);
|
|
534
|
+
expect(
|
|
535
|
+
TracingIdentifierUtils.isWithin64Bits(xDatadogTagsTraceId, 16)
|
|
536
|
+
);
|
|
537
|
+
|
|
538
|
+
/* =========================================================================
|
|
539
|
+
* Verify that the trace id in the b3 header is a 128 bit trace ID (hex).
|
|
540
|
+
* ========================================================================= */
|
|
541
|
+
|
|
542
|
+
const b3Header = xhr.requestHeaders[B3_HEADER_KEY];
|
|
543
|
+
const b3TraceId = b3Header.split('-')[0];
|
|
544
|
+
|
|
545
|
+
expect(b3TraceId).toMatch(/^[0-9a-f]{8}[0]{8}[0-9a-f]{16}$/);
|
|
546
|
+
expect(TracingIdentifierUtils.isWithin128Bits(b3TraceId, 16));
|
|
547
|
+
|
|
548
|
+
/* =================================================================================
|
|
549
|
+
* Verify that the trace id in the X-B3-TraceId header is a 128 bit trace ID (hex).
|
|
550
|
+
* ================================================================================= */
|
|
551
|
+
|
|
552
|
+
const xB3TraceId = xhr.requestHeaders[B3_MULTI_TRACE_ID_HEADER_KEY];
|
|
553
|
+
|
|
554
|
+
expect(xB3TraceId).toMatch(/^[0-9a-f]{8}[0]{8}[0-9a-f]{16}$/);
|
|
555
|
+
expect(TracingIdentifierUtils.isWithin128Bits(xB3TraceId, 16));
|
|
556
|
+
});
|
|
557
|
+
|
|
461
558
|
it('adds tracing headers with matching value when all headers are added', async () => {
|
|
462
559
|
// GIVEN
|
|
463
560
|
const method = 'GET';
|
|
@@ -493,13 +590,33 @@ describe('XHRProxy', () => {
|
|
|
493
590
|
await flushPromises();
|
|
494
591
|
|
|
495
592
|
// THEN
|
|
496
|
-
const datadogTraceValue = xhr.requestHeaders[TRACE_ID_HEADER_KEY];
|
|
497
|
-
const datadogParentValue = xhr.requestHeaders[PARENT_ID_HEADER_KEY];
|
|
498
593
|
|
|
594
|
+
// x-datadog-trace-id is just the low 64 bits (DECIMAL)
|
|
595
|
+
const datadogLowTraceValue =
|
|
596
|
+
xhr.requestHeaders[TRACE_ID_HEADER_KEY];
|
|
597
|
+
|
|
598
|
+
// We convert the low 64 bits to HEX
|
|
599
|
+
const datadogLowTraceValueHex = `${BigInt(datadogLowTraceValue)
|
|
600
|
+
.toString(16)
|
|
601
|
+
.padStart(16, '0')}`;
|
|
602
|
+
|
|
603
|
+
// The high 64 bits are expressed in x-datadog-tags (HEX)
|
|
604
|
+
const datadogHighTraceValueHex = xhr.requestHeaders[
|
|
605
|
+
TAGS_HEADER_KEY
|
|
606
|
+
].split('=')[1]; // High HEX 64 bits
|
|
607
|
+
|
|
608
|
+
// We re-compose the full 128 bit trace-id by joining the strings
|
|
609
|
+
const datadogTraceValue128BitHex = `${datadogHighTraceValueHex}${datadogLowTraceValueHex}`;
|
|
610
|
+
|
|
611
|
+
// We then get the decimal value of the trace-id
|
|
612
|
+
const datadogTraceValue128BitDec = hexToDecimal(
|
|
613
|
+
datadogTraceValue128BitHex
|
|
614
|
+
);
|
|
615
|
+
|
|
616
|
+
const datadogParentValue = xhr.requestHeaders[PARENT_ID_HEADER_KEY];
|
|
499
617
|
const contextHeader = xhr.requestHeaders[TRACECONTEXT_HEADER_KEY];
|
|
500
618
|
const traceContextValue = contextHeader.split('-')[1];
|
|
501
619
|
const parentContextValue = contextHeader.split('-')[2];
|
|
502
|
-
|
|
503
620
|
const b3MultiTraceHeader =
|
|
504
621
|
xhr.requestHeaders[B3_MULTI_TRACE_ID_HEADER_KEY];
|
|
505
622
|
const b3MultiParentHeader =
|
|
@@ -509,13 +626,17 @@ describe('XHRProxy', () => {
|
|
|
509
626
|
const traceB3Value = b3Header.split('-')[0];
|
|
510
627
|
const parentB3Value = b3Header.split('-')[1];
|
|
511
628
|
|
|
512
|
-
expect(hexToDecimal(traceContextValue)).toBe(
|
|
629
|
+
expect(hexToDecimal(traceContextValue)).toBe(
|
|
630
|
+
datadogTraceValue128BitDec
|
|
631
|
+
);
|
|
513
632
|
expect(hexToDecimal(parentContextValue)).toBe(datadogParentValue);
|
|
514
|
-
|
|
515
|
-
expect(hexToDecimal(b3MultiTraceHeader)).toBe(
|
|
633
|
+
//
|
|
634
|
+
expect(hexToDecimal(b3MultiTraceHeader)).toBe(
|
|
635
|
+
datadogTraceValue128BitDec
|
|
636
|
+
);
|
|
516
637
|
expect(hexToDecimal(b3MultiParentHeader)).toBe(datadogParentValue);
|
|
517
638
|
|
|
518
|
-
expect(hexToDecimal(traceB3Value)).toBe(
|
|
639
|
+
expect(hexToDecimal(traceB3Value)).toBe(datadogTraceValue128BitDec);
|
|
519
640
|
expect(hexToDecimal(parentB3Value)).toBe(datadogParentValue);
|
|
520
641
|
});
|
|
521
642
|
|
|
@@ -549,7 +670,7 @@ describe('XHRProxy', () => {
|
|
|
549
670
|
const traceId = xhr.requestHeaders[B3_MULTI_TRACE_ID_HEADER_KEY];
|
|
550
671
|
const spanId = xhr.requestHeaders[B3_MULTI_SPAN_ID_HEADER_KEY];
|
|
551
672
|
const sampled = xhr.requestHeaders[B3_MULTI_SAMPLED_HEADER_KEY];
|
|
552
|
-
expect(traceId).toMatch(/^[0-9a-f]{
|
|
673
|
+
expect(traceId).toMatch(/^[0-9a-f]{8}[0]{8}[0-9a-f]{16}$/);
|
|
553
674
|
expect(spanId).toMatch(/^[0-9a-f]{16}$/);
|
|
554
675
|
expect(sampled).toBe('1');
|
|
555
676
|
});
|
|
@@ -582,7 +703,9 @@ describe('XHRProxy', () => {
|
|
|
582
703
|
|
|
583
704
|
// THEN
|
|
584
705
|
const headerValue = xhr.requestHeaders[B3_HEADER_KEY];
|
|
585
|
-
expect(headerValue).toMatch(
|
|
706
|
+
expect(headerValue).toMatch(
|
|
707
|
+
/^[0-9a-f]{8}[0]{8}[0-9a-f]{16}-[0-9a-f]{16}-1$/
|
|
708
|
+
);
|
|
586
709
|
});
|
|
587
710
|
|
|
588
711
|
it('adds all headers when the host is matched for different propagators', async () => {
|
|
@@ -30,6 +30,7 @@ describe('FileBasedConfiguration', () => {
|
|
|
30
30
|
longTaskThresholdMs: 44,
|
|
31
31
|
verbosity: 'WARN',
|
|
32
32
|
actionNameAttribute: 'action-name-attr',
|
|
33
|
+
useAccessibilityLabel: true,
|
|
33
34
|
resourceTracingSamplingRate: 33,
|
|
34
35
|
firstPartyHosts: [
|
|
35
36
|
{
|
|
@@ -90,6 +91,7 @@ describe('FileBasedConfiguration', () => {
|
|
|
90
91
|
"trackResources": true,
|
|
91
92
|
"trackingConsent": "not_granted",
|
|
92
93
|
"uploadFrequency": "AVERAGE",
|
|
94
|
+
"useAccessibilityLabel": true,
|
|
93
95
|
"verbosity": "warn",
|
|
94
96
|
"vitalsUpdateFrequency": "AVERAGE",
|
|
95
97
|
}
|
|
@@ -140,6 +142,7 @@ describe('FileBasedConfiguration', () => {
|
|
|
140
142
|
"trackResources": false,
|
|
141
143
|
"trackingConsent": "granted",
|
|
142
144
|
"uploadFrequency": "AVERAGE",
|
|
145
|
+
"useAccessibilityLabel": true,
|
|
143
146
|
"verbosity": undefined,
|
|
144
147
|
"vitalsUpdateFrequency": "AVERAGE",
|
|
145
148
|
}
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by genversion
|
|
2
|
-
export const version = '2.
|
|
2
|
+
export const version = '2.4.0';
|