@datadog/mobile-react-native 1.3.0 → 1.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 +2 -2
- package/android/build.gradle +58 -64
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdk.kt +36 -2
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +14 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +162 -16
- package/android/src/test/kotlin/com/datadog/tools/unit/MapExt.kt +7 -0
- package/ios/Sources/DdSdk.swift +2 -2
- package/ios/Sources/RNDdSdkConfiguration.swift +42 -0
- package/lib/commonjs/DdSdkReactNative.js +2 -2
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +26 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +9 -0
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/domain/distributedTracing.js +59 -41
- package/lib/commonjs/rum/instrumentation/resourceTracking/domain/distributedTracing.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/domain/distributedTracingHeaders.js +136 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/domain/distributedTracingHeaders.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/domain/firstPartyHosts.js +39 -6
- package/lib/commonjs/rum/instrumentation/resourceTracking/domain/firstPartyHosts.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/domain/interfaces/RequestProxy.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js +3 -3
- package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/XHRProxy.js +12 -21
- package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/XHRProxy.js.map +1 -1
- package/lib/commonjs/rum/types.js +19 -1
- package/lib/commonjs/rum/types.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/DdSdkReactNative.js +3 -3
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +22 -0
- package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/module/index.js +3 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +9 -0
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +2 -2
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/domain/distributedTracing.js +57 -35
- package/lib/module/rum/instrumentation/resourceTracking/domain/distributedTracing.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/domain/distributedTracingHeaders.js +115 -0
- package/lib/module/rum/instrumentation/resourceTracking/domain/distributedTracingHeaders.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/domain/firstPartyHosts.js +37 -3
- package/lib/module/rum/instrumentation/resourceTracking/domain/firstPartyHosts.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/domain/interfaces/RequestProxy.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js +3 -3
- package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/implementation/XHRProxy.js +10 -15
- package/lib/module/rum/instrumentation/resourceTracking/implementation/XHRProxy.js.map +1 -1
- package/lib/module/rum/types.js +16 -0
- package/lib/module/rum/types.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 +11 -3
- package/lib/typescript/index.d.ts +3 -3
- package/lib/typescript/rum/eventMappers/resourceEventMapper.d.ts +0 -1
- package/lib/typescript/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.d.ts +1 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts +2 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/domain/distributedTracing.d.ts +32 -6
- package/lib/typescript/rum/instrumentation/resourceTracking/domain/distributedTracingHeaders.d.ts +21 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/domain/firstPartyHosts.d.ts +4 -2
- package/lib/typescript/rum/instrumentation/resourceTracking/domain/interfaces/RequestProxy.d.ts +6 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/domain/interfaces/RumResource.d.ts +0 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/implementation/XHRProxy.d.ts +0 -6
- package/lib/typescript/rum/instrumentation/resourceTracking/implementation/responseSize.d.ts +0 -1
- package/lib/typescript/rum/types.d.ts +17 -0
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/DdSdkReactNative.tsx +8 -4
- package/src/DdSdkReactNativeConfiguration.tsx +36 -3
- package/src/__tests__/DdSdkReactNative.test.tsx +16 -4
- package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +7 -6
- package/src/__tests__/rum/instrumentation/DdRumErrorTracking.test.tsx +2 -1
- package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +130 -114
- package/src/index.tsx +6 -3
- package/src/rum/__tests__/DdRum.test.ts +17 -1
- package/src/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.tsx +8 -0
- package/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.tsx +6 -3
- package/src/rum/instrumentation/resourceTracking/__tests__/DdRumResourceTracking.test.ts +15 -3
- package/src/rum/instrumentation/resourceTracking/domain/__tests__/distributedTracing.test.ts +64 -24
- package/src/rum/instrumentation/resourceTracking/domain/__tests__/firstPartyHosts.test.ts +19 -7
- package/src/rum/instrumentation/resourceTracking/domain/distributedTracing.tsx +82 -40
- package/src/rum/instrumentation/resourceTracking/domain/distributedTracingHeaders.ts +141 -0
- package/src/rum/instrumentation/resourceTracking/domain/firstPartyHosts.ts +43 -7
- package/src/rum/instrumentation/resourceTracking/domain/interfaces/RequestProxy.ts +8 -1
- package/src/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.ts +4 -4
- package/src/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/__tests__/ResourceReporter.test.ts +2 -1
- package/src/rum/instrumentation/resourceTracking/implementation/XHRProxy.ts +8 -23
- package/src/rum/instrumentation/resourceTracking/implementation/__tests__/XHRProxy.test.ts +257 -74
- package/src/rum/types.ts +19 -0
- package/src/sdk/DatadogProvider/Buffer/__tests__/BufferSingleton.test.ts +2 -1
- package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +5 -4
- package/src/sdk/DatadogProvider/__tests__/initializationModes.test.tsx +6 -2
- package/src/version.ts +1 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getTracingHeaders = exports.B3_MULTI_SAMPLED_HEADER_KEY = exports.B3_MULTI_SPAN_ID_HEADER_KEY = exports.B3_MULTI_TRACE_ID_HEADER_KEY = exports.B3_HEADER_KEY = exports.TRACECONTEXT_HEADER_KEY = exports.PARENT_ID_HEADER_KEY = exports.TRACE_ID_HEADER_KEY = exports.ORIGIN_RUM = exports.ORIGIN_HEADER_KEY = exports.SAMPLING_PRIORITY_HEADER_KEY = void 0;
|
|
7
|
+
|
|
8
|
+
var _types = require("../../../types");
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
12
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
13
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
14
|
+
*/
|
|
15
|
+
const SAMPLING_PRIORITY_HEADER_KEY = 'x-datadog-sampling-priority';
|
|
16
|
+
/**
|
|
17
|
+
* Datadog headers
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
exports.SAMPLING_PRIORITY_HEADER_KEY = SAMPLING_PRIORITY_HEADER_KEY;
|
|
21
|
+
const ORIGIN_HEADER_KEY = 'x-datadog-origin';
|
|
22
|
+
exports.ORIGIN_HEADER_KEY = ORIGIN_HEADER_KEY;
|
|
23
|
+
const ORIGIN_RUM = 'rum';
|
|
24
|
+
exports.ORIGIN_RUM = ORIGIN_RUM;
|
|
25
|
+
const TRACE_ID_HEADER_KEY = 'x-datadog-trace-id';
|
|
26
|
+
exports.TRACE_ID_HEADER_KEY = TRACE_ID_HEADER_KEY;
|
|
27
|
+
const PARENT_ID_HEADER_KEY = 'x-datadog-parent-id';
|
|
28
|
+
/**
|
|
29
|
+
* OTel headers
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
exports.PARENT_ID_HEADER_KEY = PARENT_ID_HEADER_KEY;
|
|
33
|
+
const TRACECONTEXT_HEADER_KEY = 'traceparent';
|
|
34
|
+
exports.TRACECONTEXT_HEADER_KEY = TRACECONTEXT_HEADER_KEY;
|
|
35
|
+
const B3_HEADER_KEY = 'b3';
|
|
36
|
+
exports.B3_HEADER_KEY = B3_HEADER_KEY;
|
|
37
|
+
const B3_MULTI_TRACE_ID_HEADER_KEY = 'X-B3-TraceId';
|
|
38
|
+
exports.B3_MULTI_TRACE_ID_HEADER_KEY = B3_MULTI_TRACE_ID_HEADER_KEY;
|
|
39
|
+
const B3_MULTI_SPAN_ID_HEADER_KEY = 'X-B3-SpanId';
|
|
40
|
+
exports.B3_MULTI_SPAN_ID_HEADER_KEY = B3_MULTI_SPAN_ID_HEADER_KEY;
|
|
41
|
+
const B3_MULTI_SAMPLED_HEADER_KEY = 'X-B3-Sampled';
|
|
42
|
+
exports.B3_MULTI_SAMPLED_HEADER_KEY = B3_MULTI_SAMPLED_HEADER_KEY;
|
|
43
|
+
|
|
44
|
+
const getTracingHeaders = tracingAttributes => {
|
|
45
|
+
const headers = [];
|
|
46
|
+
|
|
47
|
+
if (tracingAttributes.tracingStrategy === 'DISCARD') {
|
|
48
|
+
return headers;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
tracingAttributes.propagatorTypes.forEach(propagator => {
|
|
52
|
+
switch (propagator) {
|
|
53
|
+
case _types.PropagatorType.DATADOG:
|
|
54
|
+
{
|
|
55
|
+
headers.push({
|
|
56
|
+
header: ORIGIN_HEADER_KEY,
|
|
57
|
+
value: ORIGIN_RUM
|
|
58
|
+
}, {
|
|
59
|
+
header: SAMPLING_PRIORITY_HEADER_KEY,
|
|
60
|
+
value: tracingAttributes.samplingPriorityHeader
|
|
61
|
+
}, {
|
|
62
|
+
header: TRACE_ID_HEADER_KEY,
|
|
63
|
+
value: tracingAttributes.traceId.toString(10)
|
|
64
|
+
}, {
|
|
65
|
+
header: PARENT_ID_HEADER_KEY,
|
|
66
|
+
value: tracingAttributes.spanId.toString(10)
|
|
67
|
+
});
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
case _types.PropagatorType.TRACECONTEXT:
|
|
72
|
+
{
|
|
73
|
+
headers.push({
|
|
74
|
+
header: TRACECONTEXT_HEADER_KEY,
|
|
75
|
+
value: generateTraceContextHeader({
|
|
76
|
+
version: '00',
|
|
77
|
+
traceId: tracingAttributes.traceId,
|
|
78
|
+
parentId: tracingAttributes.spanId,
|
|
79
|
+
isSampled: tracingAttributes.samplingPriorityHeader === '1'
|
|
80
|
+
})
|
|
81
|
+
});
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
case _types.PropagatorType.B3:
|
|
86
|
+
{
|
|
87
|
+
headers.push({
|
|
88
|
+
header: B3_HEADER_KEY,
|
|
89
|
+
value: generateB3Header({
|
|
90
|
+
traceId: tracingAttributes.traceId,
|
|
91
|
+
spanId: tracingAttributes.spanId,
|
|
92
|
+
isSampled: tracingAttributes.samplingPriorityHeader === '1'
|
|
93
|
+
})
|
|
94
|
+
});
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
case _types.PropagatorType.B3MULTI:
|
|
99
|
+
{
|
|
100
|
+
headers.push({
|
|
101
|
+
header: B3_MULTI_TRACE_ID_HEADER_KEY,
|
|
102
|
+
value: tracingAttributes.traceId.toPaddedString(16, 32)
|
|
103
|
+
}, {
|
|
104
|
+
header: B3_MULTI_SPAN_ID_HEADER_KEY,
|
|
105
|
+
value: tracingAttributes.spanId.toPaddedString(16, 16)
|
|
106
|
+
}, {
|
|
107
|
+
header: B3_MULTI_SAMPLED_HEADER_KEY,
|
|
108
|
+
value: tracingAttributes.samplingPriorityHeader
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
return headers;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
exports.getTracingHeaders = getTracingHeaders;
|
|
117
|
+
|
|
118
|
+
const generateTraceContextHeader = ({
|
|
119
|
+
version,
|
|
120
|
+
traceId,
|
|
121
|
+
parentId,
|
|
122
|
+
isSampled
|
|
123
|
+
}) => {
|
|
124
|
+
const flags = isSampled ? '01' : '00';
|
|
125
|
+
return `${version}-${traceId.toPaddedString(16, 32)}-${parentId.toPaddedString(16, 16)}-${flags}`;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const generateB3Header = ({
|
|
129
|
+
traceId,
|
|
130
|
+
spanId,
|
|
131
|
+
isSampled
|
|
132
|
+
}) => {
|
|
133
|
+
const flags = isSampled ? '1' : '0';
|
|
134
|
+
return `${traceId.toPaddedString(16, 32)}-${spanId.toPaddedString(16, 16)}-${flags}`;
|
|
135
|
+
};
|
|
136
|
+
//# sourceMappingURL=distributedTracingHeaders.js.map
|
package/lib/commonjs/rum/instrumentation/resourceTracking/domain/distributedTracingHeaders.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["distributedTracingHeaders.ts"],"names":["SAMPLING_PRIORITY_HEADER_KEY","ORIGIN_HEADER_KEY","ORIGIN_RUM","TRACE_ID_HEADER_KEY","PARENT_ID_HEADER_KEY","TRACECONTEXT_HEADER_KEY","B3_HEADER_KEY","B3_MULTI_TRACE_ID_HEADER_KEY","B3_MULTI_SPAN_ID_HEADER_KEY","B3_MULTI_SAMPLED_HEADER_KEY","getTracingHeaders","tracingAttributes","headers","tracingStrategy","propagatorTypes","forEach","propagator","PropagatorType","DATADOG","push","header","value","samplingPriorityHeader","traceId","toString","spanId","TRACECONTEXT","generateTraceContextHeader","version","parentId","isSampled","B3","generateB3Header","B3MULTI","toPaddedString","flags"],"mappings":";;;;;;;AAMA;;AANA;AACA;AACA;AACA;AACA;AAUO,MAAMA,4BAA4B,GAAG,6BAArC;AACP;AACA;AACA;;;AACO,MAAMC,iBAAiB,GAAG,kBAA1B;;AACA,MAAMC,UAAU,GAAG,KAAnB;;AACA,MAAMC,mBAAmB,GAAG,oBAA5B;;AACA,MAAMC,oBAAoB,GAAG,qBAA7B;AACP;AACA;AACA;;;AACO,MAAMC,uBAAuB,GAAG,aAAhC;;AACA,MAAMC,aAAa,GAAG,IAAtB;;AACA,MAAMC,4BAA4B,GAAG,cAArC;;AACA,MAAMC,2BAA2B,GAAG,aAApC;;AACA,MAAMC,2BAA2B,GAAG,cAApC;;;AAEA,MAAMC,iBAAiB,GAC1BC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nB;AACF,QAAMK,KAAK,GAAGL,SAAS,GAAG,GAAH,GAAS,GAAhC;AACA,SAAQ,GAAEP,OAAO,CAACW,cAAR,CAAuB,EAAvB,EAA2B,EAA3B,CAA+B,IAAGT,MAAM,CAACS,cAAP,CACxC,EADwC,EAExC,EAFwC,CAG1C,IAAGC,KAAM,EAHX;AAIH,CAdD","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 { PropagatorType } from '../../../types';\n\nimport type {\n DdRumResourceTracingAttributes,\n SpanId,\n TraceId\n} from './distributedTracing';\n\nexport const SAMPLING_PRIORITY_HEADER_KEY = 'x-datadog-sampling-priority';\n/**\n * Datadog headers\n */\nexport const ORIGIN_HEADER_KEY = 'x-datadog-origin';\nexport const ORIGIN_RUM = 'rum';\nexport const TRACE_ID_HEADER_KEY = 'x-datadog-trace-id';\nexport const PARENT_ID_HEADER_KEY = 'x-datadog-parent-id';\n/**\n * OTel headers\n */\nexport const TRACECONTEXT_HEADER_KEY = 'traceparent';\nexport const B3_HEADER_KEY = 'b3';\nexport const B3_MULTI_TRACE_ID_HEADER_KEY = 'X-B3-TraceId';\nexport const B3_MULTI_SPAN_ID_HEADER_KEY = 'X-B3-SpanId';\nexport const B3_MULTI_SAMPLED_HEADER_KEY = 'X-B3-Sampled';\n\nexport const getTracingHeaders = (\n tracingAttributes: DdRumResourceTracingAttributes\n): { header: string; value: string }[] => {\n const headers: { header: string; value: string }[] = [];\n if (tracingAttributes.tracingStrategy === 'DISCARD') {\n return headers;\n }\n tracingAttributes.propagatorTypes.forEach(propagator => {\n switch (propagator) {\n case PropagatorType.DATADOG: {\n headers.push(\n {\n header: ORIGIN_HEADER_KEY,\n value: ORIGIN_RUM\n },\n {\n header: SAMPLING_PRIORITY_HEADER_KEY,\n value: tracingAttributes.samplingPriorityHeader\n },\n {\n header: TRACE_ID_HEADER_KEY,\n value: tracingAttributes.traceId.toString(10)\n },\n {\n header: PARENT_ID_HEADER_KEY,\n value: tracingAttributes.spanId.toString(10)\n }\n );\n break;\n }\n case PropagatorType.TRACECONTEXT: {\n headers.push({\n header: TRACECONTEXT_HEADER_KEY,\n value: generateTraceContextHeader({\n version: '00',\n traceId: tracingAttributes.traceId,\n parentId: tracingAttributes.spanId,\n isSampled:\n tracingAttributes.samplingPriorityHeader === '1'\n })\n });\n break;\n }\n case PropagatorType.B3: {\n headers.push({\n header: B3_HEADER_KEY,\n value: generateB3Header({\n traceId: tracingAttributes.traceId,\n spanId: tracingAttributes.spanId,\n isSampled:\n tracingAttributes.samplingPriorityHeader === '1'\n })\n });\n break;\n }\n case PropagatorType.B3MULTI: {\n headers.push(\n {\n header: B3_MULTI_TRACE_ID_HEADER_KEY,\n value: tracingAttributes.traceId.toPaddedString(16, 32)\n },\n {\n header: B3_MULTI_SPAN_ID_HEADER_KEY,\n value: tracingAttributes.spanId.toPaddedString(16, 16)\n },\n {\n header: B3_MULTI_SAMPLED_HEADER_KEY,\n value: tracingAttributes.samplingPriorityHeader\n }\n );\n }\n }\n });\n\n return headers;\n};\n\nconst generateTraceContextHeader = ({\n version,\n traceId,\n parentId,\n isSampled\n}: {\n version: string;\n traceId: TraceId;\n parentId: SpanId;\n isSampled: boolean;\n}) => {\n const flags = isSampled ? '01' : '00';\n return `${version}-${traceId.toPaddedString(\n 16,\n 32\n )}-${parentId.toPaddedString(16, 16)}-${flags}`;\n};\n\nconst generateB3Header = ({\n traceId,\n spanId,\n isSampled\n}: {\n traceId: TraceId;\n spanId: SpanId;\n isSampled: boolean;\n}) => {\n const flags = isSampled ? '1' : '0';\n return `${traceId.toPaddedString(16, 32)}-${spanId.toPaddedString(\n 16,\n 16\n )}-${flags}`;\n};\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.getPropagatorsForHost = exports.firstPartyHostsRegexMapBuilder = exports.NO_MATCH_REGEX = void 0;
|
|
7
7
|
|
|
8
8
|
var _InternalLog = require("../../../../InternalLog");
|
|
9
9
|
|
|
@@ -23,6 +23,32 @@ const escapeRegExp = string => {
|
|
|
23
23
|
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
const firstPartyHostsRegexMapBuilder = firstPartyHosts => {
|
|
27
|
+
const hostsMap = {
|
|
28
|
+
datadog: [],
|
|
29
|
+
tracecontext: [],
|
|
30
|
+
b3: [],
|
|
31
|
+
b3multi: []
|
|
32
|
+
};
|
|
33
|
+
firstPartyHosts.forEach(host => {
|
|
34
|
+
host.propagatorTypes.forEach(propagatorType => {
|
|
35
|
+
hostsMap[propagatorType].push(host.match);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
const regexMap = [];
|
|
39
|
+
Object.entries(hostsMap).forEach(([propagatorType, hosts]) => {
|
|
40
|
+
if (hosts.length > 0) {
|
|
41
|
+
regexMap.push({
|
|
42
|
+
propagatorType: propagatorType,
|
|
43
|
+
regex: firstPartyHostsRegexBuilder(hosts)
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return regexMap;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
exports.firstPartyHostsRegexMapBuilder = firstPartyHostsRegexMapBuilder;
|
|
51
|
+
|
|
26
52
|
const firstPartyHostsRegexBuilder = firstPartyHosts => {
|
|
27
53
|
if (firstPartyHosts.length === 0) {
|
|
28
54
|
return NO_MATCH_REGEX;
|
|
@@ -41,11 +67,18 @@ const firstPartyHostsRegexBuilder = firstPartyHosts => {
|
|
|
41
67
|
}
|
|
42
68
|
};
|
|
43
69
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
70
|
+
const getPropagatorsForHost = (hostname, firstPartyHostsRegexMap) => {
|
|
71
|
+
const matchedPropagatorTypes = [];
|
|
72
|
+
firstPartyHostsRegexMap.forEach(({
|
|
73
|
+
regex,
|
|
74
|
+
propagatorType
|
|
75
|
+
}) => {
|
|
76
|
+
if (regex.test(hostname)) {
|
|
77
|
+
matchedPropagatorTypes.push(propagatorType);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return matchedPropagatorTypes.length > 0 ? matchedPropagatorTypes : null;
|
|
48
81
|
};
|
|
49
82
|
|
|
50
|
-
exports.
|
|
83
|
+
exports.getPropagatorsForHost = getPropagatorsForHost;
|
|
51
84
|
//# sourceMappingURL=firstPartyHosts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["firstPartyHosts.ts"],"names":["NO_MATCH_REGEX","RegExp","escapeRegExp","string","replace","
|
|
1
|
+
{"version":3,"sources":["firstPartyHosts.ts"],"names":["NO_MATCH_REGEX","RegExp","escapeRegExp","string","replace","firstPartyHostsRegexMapBuilder","firstPartyHosts","hostsMap","datadog","tracecontext","b3","b3multi","forEach","host","propagatorTypes","propagatorType","push","match","regexMap","Object","entries","hosts","length","regex","firstPartyHostsRegexBuilder","firstPartyHostsRegex","map","join","test","e","InternalLog","log","JSON","stringify","SdkVerbosity","WARN","getPropagatorsForHost","hostname","firstPartyHostsRegexMap","matchedPropagatorTypes"],"mappings":";;;;;;;AAMA;;AACA;;AAPA;AACA;AACA;AACA;AACA;AAUA;AACO,MAAMA,cAAc,GAAG,IAAIC,MAAJ,CAAW,IAAX,CAAvB,C,CAEP;;;;AACA,MAAMC,YAAY,GAAIC,MAAD,IAAoB;AACrC,SAAOA,MAAM,CAACC,OAAP,CAAe,qBAAf,EAAsC,MAAtC,CAAP,CADqC,CACiB;AACzD,CAFD;;AAIO,MAAMC,8BAA8B,GACvCC,eAD0C,IAE/B;AACX,QAAMC,QAA0C,GAAG;AAC/CC,IAAAA,OAAO,EAAE,EADsC;AAE/CC,IAAAA,YAAY,EAAE,EAFi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AJjB;;AAMA,WAAOnC,cAAP;AACH;AACJ,CAvBD;;AAyBO,MAAMoC,qBAAqB,GAAG,CACjCC,QADiC,EAEjCC,uBAFiC,KAGP;AAC1B,QAAMC,sBAAwC,GAAG,EAAjD;AACAD,EAAAA,uBAAuB,CAAC1B,OAAxB,CAAgC,CAAC;AAAEW,IAAAA,KAAF;AAASR,IAAAA;AAAT,GAAD,KAA+B;AAC3D,QAAIQ,KAAK,CAACK,IAAN,CAAWS,QAAX,CAAJ,EAA0B;AACtBE,MAAAA,sBAAsB,CAACvB,IAAvB,CAA4BD,cAA5B;AACH;AACJ,GAJD;AAKA,SAAOwB,sBAAsB,CAACjB,MAAvB,GAAgC,CAAhC,GAAoCiB,sBAApC,GAA6D,IAApE;AACH,CAXM","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 { InternalLog } from '../../../../InternalLog';\nimport { SdkVerbosity } from '../../../../SdkVerbosity';\nimport type { FirstPartyHost, PropagatorType } from '../../../types';\n\nimport type { RegexMap } from './interfaces/RequestProxy';\n\nexport type Hostname = { _type: 'Hostname' } & string;\n\n// This regex does not match anything\nexport const NO_MATCH_REGEX = new RegExp('a^');\n\n// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions\nconst escapeRegExp = (string: string) => {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'); // $& means the whole matched string\n};\n\nexport const firstPartyHostsRegexMapBuilder = (\n firstPartyHosts: FirstPartyHost[]\n): RegexMap => {\n const hostsMap: Record<PropagatorType, string[]> = {\n datadog: [],\n tracecontext: [],\n b3: [],\n b3multi: []\n };\n\n firstPartyHosts.forEach(host => {\n host.propagatorTypes.forEach(propagatorType => {\n hostsMap[propagatorType].push(host.match);\n });\n });\n\n const regexMap: { regex: RegExp; propagatorType: PropagatorType }[] = [];\n Object.entries(hostsMap).forEach(([propagatorType, hosts]) => {\n if (hosts.length > 0) {\n regexMap.push({\n propagatorType: propagatorType as PropagatorType,\n regex: firstPartyHostsRegexBuilder(hosts)\n });\n }\n });\n\n return regexMap;\n};\n\nconst firstPartyHostsRegexBuilder = (firstPartyHosts: string[]): RegExp => {\n if (firstPartyHosts.length === 0) {\n return NO_MATCH_REGEX;\n }\n try {\n // A regexp for matching hosts, e.g. when `hosts` is \"example.com\", it will match\n // \"example.com\", \"api.example.com\", but not \"foo.com\".\n const firstPartyHostsRegex = new RegExp(\n `^(.*\\\\.)*(${firstPartyHosts\n .map(host => `${escapeRegExp(host)}$`)\n .join('|')})`\n );\n firstPartyHostsRegex.test('test_the_regex_is_valid');\n return firstPartyHostsRegex;\n } catch (e) {\n InternalLog.log(\n `Invalid first party hosts list ${JSON.stringify(\n firstPartyHosts\n )}. Regular expressions are not allowed.`,\n SdkVerbosity.WARN\n );\n return NO_MATCH_REGEX;\n }\n};\n\nexport const getPropagatorsForHost = (\n hostname: Hostname,\n firstPartyHostsRegexMap: RegexMap\n): PropagatorType[] | null => {\n const matchedPropagatorTypes: PropagatorType[] = [];\n firstPartyHostsRegexMap.forEach(({ regex, propagatorType }) => {\n if (regex.test(hostname)) {\n matchedPropagatorTypes.push(propagatorType);\n }\n });\n return matchedPropagatorTypes.length > 0 ? matchedPropagatorTypes : null;\n};\n"]}
|
package/lib/commonjs/rum/instrumentation/resourceTracking/domain/interfaces/RequestProxy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["RequestProxy.ts"],"names":["RequestProxy"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"sources":["RequestProxy.ts"],"names":["RequestProxy"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AAcO,MAAeA,YAAf,CAA4B;AAAA;AAAA;;AAAA;AAAA;;AAAA","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 { PropagatorType } from '../../../../types';\n\nexport interface RequestProxyOptions {\n tracingSamplingRate: number;\n firstPartyHostsRegexMap: RegexMap;\n}\n\nexport type RegexMap = {\n regex: RegExp;\n propagatorType: PropagatorType;\n}[];\n\nexport abstract class RequestProxy {\n abstract onTrackingStart: (context: RequestProxyOptions) => void;\n abstract onTrackingStop: () => void;\n}\n"]}
|
|
@@ -37,9 +37,9 @@ class ResourceReporter {
|
|
|
37
37
|
exports.ResourceReporter = ResourceReporter;
|
|
38
38
|
|
|
39
39
|
const formatResourceStartContext = tracingAttributes => {
|
|
40
|
-
return tracingAttributes.
|
|
41
|
-
'_dd.span_id': tracingAttributes.spanId,
|
|
42
|
-
'_dd.trace_id': tracingAttributes.traceId,
|
|
40
|
+
return tracingAttributes.samplingPriorityHeader === '0' ? undefined : {
|
|
41
|
+
'_dd.span_id': tracingAttributes.spanId.toString(10),
|
|
42
|
+
'_dd.trace_id': tracingAttributes.traceId.toString(10),
|
|
43
43
|
'_dd.rule_psr': tracingAttributes.rulePsr
|
|
44
44
|
};
|
|
45
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ResourceReporter.ts"],"names":["ResourceReporter","constructor","resourceMappers","resource","modifiedResource","mapper","mappers","reportResource","formatResourceStartContext","tracingAttributes","
|
|
1
|
+
{"version":3,"sources":["ResourceReporter.ts"],"names":["ResourceReporter","constructor","resourceMappers","resource","modifiedResource","mapper","mappers","reportResource","formatResourceStartContext","tracingAttributes","samplingPriorityHeader","undefined","spanId","toString","traceId","rulePsr","formatResourceStopContext","timings","responseStartTime","startTime","stopTime","DdRum","startResource","key","request","method","url","stopResource","response","statusCode","kind","size","resourceContext"],"mappings":";;;;;;;AAMA;;AAGA;;;;AAIO,MAAMA,gBAAN,CAAuB;AAG1BC,EAAAA,WAAW,CAACC,eAAD,EAAo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QAAQ,CAACyB,QAAT,CAAkBC,UAFtB,EAGI1B,QAAQ,CAACqB,OAAT,CAAiBM,IAHrB,EAII3B,QAAQ,CAACyB,QAAT,CAAkBG,IAJtB,EAKIf,yBAAyB,CAACb,QAAQ,CAACc,OAAV,CAL7B,EAMId,QAAQ,CAACc,OAAT,CAAiBG,QANrB,EAOIjB,QAAQ,CAAC6B,eAPb;AASH,CAlBD","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 { DdRum } from '../../../../DdRum';\nimport type { RUMResource } from '../../domain/interfaces/RumResource';\n\nimport { createTimings } from './resourceTiming';\n\ntype ResourceMapper = (resource: RUMResource) => RUMResource | null;\n\nexport class ResourceReporter {\n private mappers: ResourceMapper[];\n\n constructor(resourceMappers: ResourceMapper[]) {\n this.mappers = resourceMappers;\n }\n\n reportResource = (resource: RUMResource) => {\n let modifiedResource: RUMResource | null = resource;\n\n for (const mapper of this.mappers) {\n modifiedResource = mapper(resource);\n if (modifiedResource === null) {\n return;\n }\n }\n\n reportResource(modifiedResource);\n };\n}\n\nconst formatResourceStartContext = (\n tracingAttributes: RUMResource['tracingAttributes']\n): Record<string, string | number> | undefined => {\n return tracingAttributes.samplingPriorityHeader === '0'\n ? undefined\n : {\n '_dd.span_id': tracingAttributes.spanId.toString(10),\n '_dd.trace_id': tracingAttributes.traceId.toString(10),\n '_dd.rule_psr': tracingAttributes.rulePsr\n };\n};\n\nconst formatResourceStopContext = (\n timings: RUMResource['timings']\n): Record<string, unknown> => {\n return {\n '_dd.resource_timings':\n timings.responseStartTime !== undefined\n ? createTimings(\n timings.startTime,\n timings.responseStartTime,\n timings.stopTime\n )\n : null\n };\n};\n\nconst reportResource = async (resource: RUMResource) => {\n await DdRum.startResource(\n resource.key,\n resource.request.method,\n resource.request.url,\n formatResourceStartContext(resource.tracingAttributes),\n resource.timings.startTime\n );\n\n DdRum.stopResource(\n resource.key,\n resource.response.statusCode,\n resource.request.kind,\n resource.response.size,\n formatResourceStopContext(resource.timings),\n resource.timings.stopTime,\n resource.resourceContext\n );\n};\n"]}
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.XHRProxy =
|
|
6
|
+
exports.XHRProxy = void 0;
|
|
7
7
|
|
|
8
8
|
var _Timer = _interopRequireDefault(require("../../../../Timer"));
|
|
9
9
|
|
|
10
|
+
var _distributedTracingHeaders = require("../domain/distributedTracingHeaders");
|
|
11
|
+
|
|
10
12
|
var _distributedTracing = require("../domain/distributedTracing");
|
|
11
13
|
|
|
12
14
|
var _RequestProxy = require("../domain/interfaces/RequestProxy");
|
|
@@ -19,16 +21,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
19
21
|
|
|
20
22
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
23
|
|
|
22
|
-
const TRACE_ID_HEADER_KEY = 'x-datadog-trace-id';
|
|
23
|
-
exports.TRACE_ID_HEADER_KEY = TRACE_ID_HEADER_KEY;
|
|
24
|
-
const PARENT_ID_HEADER_KEY = 'x-datadog-parent-id';
|
|
25
|
-
exports.PARENT_ID_HEADER_KEY = PARENT_ID_HEADER_KEY;
|
|
26
|
-
const ORIGIN_HEADER_KEY = 'x-datadog-origin';
|
|
27
|
-
exports.ORIGIN_HEADER_KEY = ORIGIN_HEADER_KEY;
|
|
28
|
-
const SAMPLING_PRIORITY_HEADER_KEY = 'x-datadog-sampling-priority';
|
|
29
|
-
exports.SAMPLING_PRIORITY_HEADER_KEY = SAMPLING_PRIORITY_HEADER_KEY;
|
|
30
|
-
const ORIGIN_RUM = 'rum';
|
|
31
|
-
exports.ORIGIN_RUM = ORIGIN_RUM;
|
|
32
24
|
const RESPONSE_START_LABEL = 'response_start';
|
|
33
25
|
|
|
34
26
|
/**
|
|
@@ -71,7 +63,7 @@ const proxyOpen = ({
|
|
|
71
63
|
xhrType
|
|
72
64
|
}, context) => {
|
|
73
65
|
const originalXhrOpen = xhrType.prototype.open;
|
|
74
|
-
const
|
|
66
|
+
const firstPartyHostsRegexMap = context.firstPartyHostsRegexMap;
|
|
75
67
|
const tracingSamplingRate = context.tracingSamplingRate;
|
|
76
68
|
|
|
77
69
|
xhrType.prototype.open = function (method, url) {
|
|
@@ -85,7 +77,7 @@ const proxyOpen = ({
|
|
|
85
77
|
timer: new _Timer.default(),
|
|
86
78
|
tracingAttributes: (0, _distributedTracing.getTracingAttributes)({
|
|
87
79
|
hostname,
|
|
88
|
-
|
|
80
|
+
firstPartyHostsRegexMap,
|
|
89
81
|
tracingSamplingRate
|
|
90
82
|
})
|
|
91
83
|
}; // eslint-disable-next-line prefer-rest-params
|
|
@@ -103,14 +95,13 @@ const proxySend = providers => {
|
|
|
103
95
|
// keep track of start time
|
|
104
96
|
this._datadog_xhr.timer.start();
|
|
105
97
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
this.setRequestHeader(
|
|
112
|
-
|
|
113
|
-
}
|
|
98
|
+
const tracingHeaders = (0, _distributedTracingHeaders.getTracingHeaders)(this._datadog_xhr.tracingAttributes);
|
|
99
|
+
tracingHeaders.forEach(({
|
|
100
|
+
header,
|
|
101
|
+
value
|
|
102
|
+
}) => {
|
|
103
|
+
this.setRequestHeader(header, value);
|
|
104
|
+
});
|
|
114
105
|
}
|
|
115
106
|
|
|
116
107
|
proxyOnReadyStateChange(this, providers); // eslint-disable-next-line prefer-rest-params
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["XHRProxy.ts"],"names":["TRACE_ID_HEADER_KEY","PARENT_ID_HEADER_KEY","ORIGIN_HEADER_KEY","SAMPLING_PRIORITY_HEADER_KEY","ORIGIN_RUM","RESPONSE_START_LABEL","XHRProxy","RequestProxy","constructor","providers","context","originalXhrOpen","xhrType","prototype","open","originalXhrSend","send","proxyRequests","proxyOpen","proxySend","firstPartyHostsRegex","tracingSamplingRate","method","url","hostname","_datadog_xhr","reported","timer","Timer","tracingAttributes","apply","arguments","start","setRequestHeader","samplingPriorityHeader","tracingStrategy","traceId","spanId","proxyOnReadyStateChange","xhrProxy","originalOnreadystatechange","onreadystatechange","readyState","DONE","reportXhr","resourceReporter","HEADERS_RECEIVED","recordTick","responseSize","key","startTime","stop","reportResource","request","kind","response","statusCode","status","size","timings","stopTime","responseStartTime","hasTickFor","timeAt","undefined","resourceContext"],"mappings":";;;;;;;AAMA;;AAEA;;AAEA;;AAGA;;AACA;;;;;;AAEO,MAAMA,mBAAmB,GAAG,oBAA5B;;AACA,MAAMC,oBAAoB,GAAG,qBAA7B;;AACA,MAAMC,iBAAiB,GAAG,kBAA1B;;AACA,MAAMC,4BAA4B,GAAG,6BAArC;;AACA,MAAMC,UAAU,GAAG,KAAnB;;AAEP,MAAMC,oBAAoB,GAAG,gBAA7B;;AAmBA;AACA;AACA;AACO,MAAMC,QAAN,SAAuBC,0BAAvB,CAAoC;AAKvCC,EAAAA,WAAW,CAACC,SAAD,EAA+B;AACtC;;AADsC;;AAAA,6CAKvBC,OAAD,IAAkC;AAChDJ,MAAAA,QAAQ,CAACK,eAAT,GAA2B,KAAKF,SAAL,CAAeG,OAAf,CAAuBC,SAAvB,CAAiCC,IAA5D;AACAR,MAAAA,QAAQ,CAACS,eAAT,GAA2B,KAAKN,SAAL,CAAeG,OAAf,CAAuBC,SAAvB,CAAiCG,IAA5D;AACAC,MAAAA,aAAa,CAAC,KAAKR,SAAN,EAAiBC,OAAjB,CAAb;AACH,KATyC;;AAAA,4CAWzB,MAAM;AACnB,WAAKD,SAAL,CAAeG,OAAf,CAAuBC,SAAvB,CAAiCC,IAAjC,GAAwCR,QAAQ,CAACK,eAAjD;AACA,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iB,KAAR,CAAcoC,MAAd,CAAqB1D,oBAArB,CADa,GAEb2D;AALD,KAZmB;AAmB5BC,IAAAA,eAAe,EAAE1B;AAnBW,GAAhC;AAqBH,CAjCD","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 Timer from '../../../../Timer';\nimport type { DdRumResourceTracingAttributes } from '../domain/distributedTracing';\nimport { getTracingAttributes } from '../domain/distributedTracing';\nimport type { RequestProxyOptions } from '../domain/interfaces/RequestProxy';\nimport { RequestProxy } from '../domain/interfaces/RequestProxy';\n\nimport type { ResourceReporter } from './DatadogRumResource/ResourceReporter';\nimport { URLHostParser } from './URLHostParser';\nimport { calculateResponseSize } from './responseSize';\n\nexport const TRACE_ID_HEADER_KEY = 'x-datadog-trace-id';\nexport const PARENT_ID_HEADER_KEY = 'x-datadog-parent-id';\nexport const ORIGIN_HEADER_KEY = 'x-datadog-origin';\nexport const SAMPLING_PRIORITY_HEADER_KEY = 'x-datadog-sampling-priority';\nexport const ORIGIN_RUM = 'rum';\n\nconst RESPONSE_START_LABEL = 'response_start';\n\ninterface DdRumXhr extends XMLHttpRequest {\n _datadog_xhr: DdRumXhrContext;\n}\n\ninterface DdRumXhrContext {\n method: string;\n url: string;\n reported: boolean;\n timer: Timer;\n tracingAttributes: DdRumResourceTracingAttributes;\n}\n\ninterface XHRProxyProviders {\n xhrType: typeof XMLHttpRequest;\n resourceReporter: ResourceReporter;\n}\n\n/**\n * Proxies XMLHTTPRequest to track resources.\n */\nexport class XHRProxy extends RequestProxy {\n private providers: XHRProxyProviders;\n private static originalXhrOpen: typeof XMLHttpRequest.prototype.open;\n private static originalXhrSend: typeof XMLHttpRequest.prototype.send;\n\n constructor(providers: XHRProxyProviders) {\n super();\n this.providers = providers;\n }\n\n onTrackingStart = (context: RequestProxyOptions) => {\n XHRProxy.originalXhrOpen = this.providers.xhrType.prototype.open;\n XHRProxy.originalXhrSend = this.providers.xhrType.prototype.send;\n proxyRequests(this.providers, context);\n };\n\n onTrackingStop = () => {\n this.providers.xhrType.prototype.open = XHRProxy.originalXhrOpen;\n this.providers.xhrType.prototype.send = XHRProxy.originalXhrSend;\n };\n}\n\nconst proxyRequests = (\n providers: XHRProxyProviders,\n context: RequestProxyOptions\n): void => {\n proxyOpen(providers, context);\n proxySend(providers);\n};\n\nconst proxyOpen = (\n { xhrType }: XHRProxyProviders,\n context: RequestProxyOptions\n): void => {\n const originalXhrOpen = xhrType.prototype.open;\n const firstPartyHostsRegex = context.firstPartyHostsRegex;\n const tracingSamplingRate = context.tracingSamplingRate;\n\n xhrType.prototype.open = function (\n this: DdRumXhr,\n method: string,\n url: string\n ) {\n const hostname = URLHostParser(url);\n // Keep track of the method and url\n // start time is tracked by the `send` method\n this._datadog_xhr = {\n method,\n url,\n reported: false,\n timer: new Timer(),\n tracingAttributes: getTracingAttributes({\n hostname,\n firstPartyHostsRegex,\n tracingSamplingRate\n })\n };\n // eslint-disable-next-line prefer-rest-params\n return originalXhrOpen.apply(this, arguments as any);\n };\n};\n\nconst proxySend = (providers: XHRProxyProviders): void => {\n const xhrType = providers.xhrType;\n const originalXhrSend = xhrType.prototype.send;\n\n xhrType.prototype.send = function (this: DdRumXhr) {\n if (this._datadog_xhr) {\n // keep track of start time\n this._datadog_xhr.timer.start();\n this.setRequestHeader(ORIGIN_HEADER_KEY, ORIGIN_RUM);\n\n const tracingAttributes = this._datadog_xhr.tracingAttributes;\n this.setRequestHeader(\n SAMPLING_PRIORITY_HEADER_KEY,\n tracingAttributes.samplingPriorityHeader\n );\n if (tracingAttributes.tracingStrategy !== 'DISCARD') {\n this.setRequestHeader(\n TRACE_ID_HEADER_KEY,\n tracingAttributes.traceId\n );\n this.setRequestHeader(\n PARENT_ID_HEADER_KEY,\n tracingAttributes.spanId\n );\n }\n }\n\n proxyOnReadyStateChange(this, providers);\n\n // eslint-disable-next-line prefer-rest-params\n return originalXhrSend.apply(this, arguments as any);\n };\n};\n\nconst proxyOnReadyStateChange = (\n xhrProxy: DdRumXhr,\n providers: XHRProxyProviders\n): void => {\n const xhrType = providers.xhrType;\n const originalOnreadystatechange = xhrProxy.onreadystatechange;\n\n xhrProxy.onreadystatechange = function () {\n if (xhrProxy.readyState === xhrType.DONE) {\n if (!xhrProxy._datadog_xhr.reported) {\n reportXhr(xhrProxy, providers.resourceReporter);\n xhrProxy._datadog_xhr.reported = true;\n }\n } else if (xhrProxy.readyState === xhrType.HEADERS_RECEIVED) {\n xhrProxy._datadog_xhr.timer.recordTick(RESPONSE_START_LABEL);\n }\n\n if (originalOnreadystatechange) {\n // eslint-disable-next-line prefer-rest-params\n originalOnreadystatechange.apply(xhrProxy, arguments as any);\n }\n };\n};\n\nconst reportXhr = async (\n xhrProxy: DdRumXhr,\n resourceReporter: ResourceReporter\n): Promise<void> => {\n const responseSize = calculateResponseSize(xhrProxy);\n\n const context = xhrProxy._datadog_xhr;\n\n const key = `${context.timer.startTime}/${context.method}`;\n\n context.timer.stop();\n\n resourceReporter.reportResource({\n key,\n request: {\n method: context.method,\n url: context.url,\n kind: 'xhr'\n },\n tracingAttributes: context.tracingAttributes,\n response: {\n statusCode: xhrProxy.status,\n size: responseSize\n },\n timings: {\n startTime: context.timer.startTime,\n stopTime: context.timer.stopTime,\n responseStartTime: context.timer.hasTickFor(RESPONSE_START_LABEL)\n ? context.timer.timeAt(RESPONSE_START_LABEL)\n : undefined\n },\n resourceContext: xhrProxy\n });\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["XHRProxy.ts"],"names":["RESPONSE_START_LABEL","XHRProxy","RequestProxy","constructor","providers","context","originalXhrOpen","xhrType","prototype","open","originalXhrSend","send","proxyRequests","proxyOpen","proxySend","firstPartyHostsRegexMap","tracingSamplingRate","method","url","hostname","_datadog_xhr","reported","timer","Timer","tracingAttributes","apply","arguments","start","tracingHeaders","forEach","header","value","setRequestHeader","proxyOnReadyStateChange","xhrProxy","originalOnreadystatechange","onreadystatechange","readyState","DONE","reportXhr","resourceReporter","HEADERS_RECEIVED","recordTick","responseSize","key","startTime","stop","reportResource","request","kind","response","statusCode","status","size","timings","stopTime","responseStartTime","hasTickFor","timeAt","undefined","resourceContext"],"mappings":";;;;;;;AAMA;;AACA;;AAEA;;AAEA;;AAGA;;AACA;;;;;;AAEA,MAAMA,oBAAoB,GAAG,gBAA7B;;AAmBA;AACA;AACA;AACO,MAAMC,QAAN,SAAuBC,0BAAvB,CAAoC;AAKvCC,EAAAA,WAAW,CAACC,SAAD,EAA+B;AACtC;;AADsC;;AAAA,6CAKvBC,OAAD,IAAkC;AAChDJ,MAAAA,QAAQ,CAACK,eAAT,GAA2B,KAAKF,SAAL,CAAeG,OAAf,CAAuBC,SAAvB,CAAiCC,IAA5D;AACAR,MAAAA,QAAQ,CAACS,eAAT,GAA2B,KAAKN,SAAL,CAAeG,OAAf,CAAuBC,SAAvB,CAAiCG,IAA5D;AACAC,MAAAA,aAAa,CAAC,KAAKR,SAAN,EAAiBC,OAAjB,CAAb;AACH,KATyC;;AAAA,4CAWzB,MAAM;AACnB,WAAKD,SAAL,CAAeG,OAAf,CAAuBC,SAAvB,CAAiCC,IAAjC,GAAwCR,QAAQ,CAACK,eAAjD;AACA,WAAKF,SAAL,CAAeG,OAAf,CAAuBC,SAAvB,CAAiCG,IAAjC,GAAwCV,QAAQ,CAACS,eAAjD;AACH,KAdyC;;AAEtC,SAAKN,SAAL,GAAiBA,SAAjB;AACH;;AARsC;;;;gBAA9BH,Q;;gBAAAA,Q;;AAsBb,MAAMW,aAAa,GAAG,CAClBR,SADkB,EAElBC,OAFkB,KAGX;AACPQ,EAAAA,SAAS,CAACT,SAAD,EAAYC,OAAZ,CAAT;AACAS,EAAAA,SAAS,CAACV,SAAD,CAAT;AACH,CAND;;AAQA,MAAMS,SAAS,GAAG,CACd;AAAEN,EAAAA;AAAF,CADc,EAEdF,OAFc,KAGP;AACP,QAAMC,eAAe,GAAGC,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AAd;AAEAN,EAAAA,gBAAgB,CAACO,cAAjB,CAAgC;AAC5BH,IAAAA,GAD4B;AAE5BI,IAAAA,OAAO,EAAE;AACL/B,MAAAA,MAAM,EAAEZ,OAAO,CAACY,MADX;AAELC,MAAAA,GAAG,EAAEb,OAAO,CAACa,GAFR;AAGL+B,MAAAA,IAAI,EAAE;AAHD,KAFmB;AAO5BzB,IAAAA,iBAAiB,EAAEnB,OAAO,CAACmB,iBAPC;AAQ5B0B,IAAAA,QAAQ,EAAE;AACNC,MAAAA,UAAU,EAAEjB,QAAQ,CAACkB,MADf;AAENC,MAAAA,IAAI,EAAEV;AAFA,KARkB;AAY5BW,IAAAA,OAAO,EAAE;AACLT,MAAAA,SAAS,EAAExC,OAAO,CAACiB,KAAR,CAAcuB,SADpB;AAELU,MAAAA,QAAQ,EAAElD,OAAO,CAACiB,KAAR,CAAciC,QAFnB;AAGLC,MAAAA,iBAAiB,EAAEnD,OAAO,CAACiB,KAAR,CAAcmC,UAAd,CAAyBzD,oBAAzB,IACbK,OAAO,CAACiB,KAAR,CAAcoC,MAAd,CAAqB1D,oBAArB,CADa,GAEb2D;AALD,KAZmB;AAmB5BC,IAAAA,eAAe,EAAE1B;AAnBW,GAAhC;AAqBH,CAjCD","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 Timer from '../../../../Timer';\nimport { getTracingHeaders } from '../domain/distributedTracingHeaders';\nimport type { DdRumResourceTracingAttributes } from '../domain/distributedTracing';\nimport { getTracingAttributes } from '../domain/distributedTracing';\nimport type { RequestProxyOptions } from '../domain/interfaces/RequestProxy';\nimport { RequestProxy } from '../domain/interfaces/RequestProxy';\n\nimport type { ResourceReporter } from './DatadogRumResource/ResourceReporter';\nimport { URLHostParser } from './URLHostParser';\nimport { calculateResponseSize } from './responseSize';\n\nconst RESPONSE_START_LABEL = 'response_start';\n\ninterface DdRumXhr extends XMLHttpRequest {\n _datadog_xhr: DdRumXhrContext;\n}\n\ninterface DdRumXhrContext {\n method: string;\n url: string;\n reported: boolean;\n timer: Timer;\n tracingAttributes: DdRumResourceTracingAttributes;\n}\n\ninterface XHRProxyProviders {\n xhrType: typeof XMLHttpRequest;\n resourceReporter: ResourceReporter;\n}\n\n/**\n * Proxies XMLHTTPRequest to track resources.\n */\nexport class XHRProxy extends RequestProxy {\n private providers: XHRProxyProviders;\n private static originalXhrOpen: typeof XMLHttpRequest.prototype.open;\n private static originalXhrSend: typeof XMLHttpRequest.prototype.send;\n\n constructor(providers: XHRProxyProviders) {\n super();\n this.providers = providers;\n }\n\n onTrackingStart = (context: RequestProxyOptions) => {\n XHRProxy.originalXhrOpen = this.providers.xhrType.prototype.open;\n XHRProxy.originalXhrSend = this.providers.xhrType.prototype.send;\n proxyRequests(this.providers, context);\n };\n\n onTrackingStop = () => {\n this.providers.xhrType.prototype.open = XHRProxy.originalXhrOpen;\n this.providers.xhrType.prototype.send = XHRProxy.originalXhrSend;\n };\n}\n\nconst proxyRequests = (\n providers: XHRProxyProviders,\n context: RequestProxyOptions\n): void => {\n proxyOpen(providers, context);\n proxySend(providers);\n};\n\nconst proxyOpen = (\n { xhrType }: XHRProxyProviders,\n context: RequestProxyOptions\n): void => {\n const originalXhrOpen = xhrType.prototype.open;\n const firstPartyHostsRegexMap = context.firstPartyHostsRegexMap;\n const tracingSamplingRate = context.tracingSamplingRate;\n\n xhrType.prototype.open = function (\n this: DdRumXhr,\n method: string,\n url: string\n ) {\n const hostname = URLHostParser(url);\n // Keep track of the method and url\n // start time is tracked by the `send` method\n this._datadog_xhr = {\n method,\n url,\n reported: false,\n timer: new Timer(),\n tracingAttributes: getTracingAttributes({\n hostname,\n firstPartyHostsRegexMap,\n tracingSamplingRate\n })\n };\n // eslint-disable-next-line prefer-rest-params\n return originalXhrOpen.apply(this, arguments as any);\n };\n};\n\nconst proxySend = (providers: XHRProxyProviders): void => {\n const xhrType = providers.xhrType;\n const originalXhrSend = xhrType.prototype.send;\n\n xhrType.prototype.send = function (this: DdRumXhr) {\n if (this._datadog_xhr) {\n // keep track of start time\n this._datadog_xhr.timer.start();\n\n const tracingHeaders = getTracingHeaders(\n this._datadog_xhr.tracingAttributes\n );\n tracingHeaders.forEach(({ header, value }) => {\n this.setRequestHeader(header, value);\n });\n }\n\n proxyOnReadyStateChange(this, providers);\n\n // eslint-disable-next-line prefer-rest-params\n return originalXhrSend.apply(this, arguments as any);\n };\n};\n\nconst proxyOnReadyStateChange = (\n xhrProxy: DdRumXhr,\n providers: XHRProxyProviders\n): void => {\n const xhrType = providers.xhrType;\n const originalOnreadystatechange = xhrProxy.onreadystatechange;\n\n xhrProxy.onreadystatechange = function () {\n if (xhrProxy.readyState === xhrType.DONE) {\n if (!xhrProxy._datadog_xhr.reported) {\n reportXhr(xhrProxy, providers.resourceReporter);\n xhrProxy._datadog_xhr.reported = true;\n }\n } else if (xhrProxy.readyState === xhrType.HEADERS_RECEIVED) {\n xhrProxy._datadog_xhr.timer.recordTick(RESPONSE_START_LABEL);\n }\n\n if (originalOnreadystatechange) {\n // eslint-disable-next-line prefer-rest-params\n originalOnreadystatechange.apply(xhrProxy, arguments as any);\n }\n };\n};\n\nconst reportXhr = async (\n xhrProxy: DdRumXhr,\n resourceReporter: ResourceReporter\n): Promise<void> => {\n const responseSize = calculateResponseSize(xhrProxy);\n\n const context = xhrProxy._datadog_xhr;\n\n const key = `${context.timer.startTime}/${context.method}`;\n\n context.timer.stop();\n\n resourceReporter.reportResource({\n key,\n request: {\n method: context.method,\n url: context.url,\n kind: 'xhr'\n },\n tracingAttributes: context.tracingAttributes,\n response: {\n statusCode: xhrProxy.status,\n size: responseSize\n },\n timings: {\n startTime: context.timer.startTime,\n stopTime: context.timer.stopTime,\n responseStartTime: context.timer.hasTickFor(RESPONSE_START_LABEL)\n ? context.timer.timeAt(RESPONSE_START_LABEL)\n : undefined\n },\n resourceContext: xhrProxy\n });\n};\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.ErrorSource = exports.RumActionType = void 0;
|
|
6
|
+
exports.PropagatorType = exports.ErrorSource = exports.RumActionType = void 0;
|
|
7
7
|
|
|
8
8
|
/*
|
|
9
9
|
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
@@ -30,6 +30,14 @@ exports.RumActionType = RumActionType;
|
|
|
30
30
|
})(RumActionType || (exports.RumActionType = RumActionType = {}));
|
|
31
31
|
|
|
32
32
|
let ErrorSource;
|
|
33
|
+
/**
|
|
34
|
+
* Type of instrumentation on the host.
|
|
35
|
+
* - DATADOG: Datadog’s propagator (`x-datadog-*`)
|
|
36
|
+
* - TRACECONTEXT: W3C Trace Context (`traceparent`)
|
|
37
|
+
* - B3: B3 single header (`b3`)
|
|
38
|
+
* - B3MULTI: B3 multiple headers (`X-B3-*`)
|
|
39
|
+
*/
|
|
40
|
+
|
|
33
41
|
exports.ErrorSource = ErrorSource;
|
|
34
42
|
|
|
35
43
|
(function (ErrorSource) {
|
|
@@ -39,4 +47,14 @@ exports.ErrorSource = ErrorSource;
|
|
|
39
47
|
ErrorSource["WEBVIEW"] = "WEBVIEW";
|
|
40
48
|
ErrorSource["CUSTOM"] = "CUSTOM";
|
|
41
49
|
})(ErrorSource || (exports.ErrorSource = ErrorSource = {}));
|
|
50
|
+
|
|
51
|
+
let PropagatorType;
|
|
52
|
+
exports.PropagatorType = PropagatorType;
|
|
53
|
+
|
|
54
|
+
(function (PropagatorType) {
|
|
55
|
+
PropagatorType["DATADOG"] = "datadog";
|
|
56
|
+
PropagatorType["TRACECONTEXT"] = "tracecontext";
|
|
57
|
+
PropagatorType["B3"] = "b3";
|
|
58
|
+
PropagatorType["B3MULTI"] = "b3multi";
|
|
59
|
+
})(PropagatorType || (exports.PropagatorType = PropagatorType = {}));
|
|
42
60
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["types.ts"],"names":["RumActionType","ErrorSource"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AA0IA;AACA;AACA;IACYA,a;;;WAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;GAAAA,a,6BAAAA,a;;IA0BAC,W
|
|
1
|
+
{"version":3,"sources":["types.ts"],"names":["RumActionType","ErrorSource","PropagatorType"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AA0IA;AACA;AACA;IACYA,a;;;WAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;GAAAA,a,6BAAAA,a;;IA0BAC,W;AAQZ;AACA;AACA;AACA;AACA;AACA;AACA;;;;WAdYA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;AAAAA,EAAAA,W;GAAAA,W,2BAAAA,W;;IAeAC,c;;;WAAAA,c;AAAAA,EAAAA,c;AAAAA,EAAAA,c;AAAAA,EAAAA,c;AAAAA,EAAAA,c;GAAAA,c,8BAAAA,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\n/**\n * The entry point to use Datadog's RUM feature.\n */\nexport type DdRumType = {\n /**\n * Start tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param name: The view name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view started (in milliseconds). If not provided, current timestamp will be used.\n */\n startView(\n key: string,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM View.\n * @param key: The view unique key identifier.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the view stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopView(\n key: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action started (in milliseconds). If not provided, current timestamp will be used.\n */\n startAction(\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking the ongoing RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopAction(\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking the ongoing RUM Action.\n *\n * Warning: using this function signature can lead to inconsistent behaviors on iOS and Android when multiple actions are started in parallel.\n *\n * @deprecated add the `type` and `name` of the action as first two arguments.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopAction(context?: object, timestampMs?: number): Promise<void>;\n\n /**\n * Add a RUM Action.\n * @param type: The action type (tap, scroll, swipe, back, custom).\n * @param name: The action name.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the action occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addAction(\n type: RumActionType,\n name: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Start tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param method: The resource method (GET, POST, …).\n * @param url: The resource url.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource started (in milliseconds). If not provided, current timestamp will be used.\n */\n startResource(\n key: string,\n method: string,\n url: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Stop tracking a RUM Resource.\n * @param key: The resource unique key identifier.\n * @param statusCode: The resource status code.\n * @param kind: The resource's kind (xhr, document, image, css, font, …).\n * @param size: The resource size in bytes. If size is unknown, use -1.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the resource stopped (in milliseconds). If not provided, current timestamp will be used.\n */\n stopResource(\n key: string,\n statusCode: number,\n kind: ResourceKind,\n size?: number,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Add a RUM Error.\n * @param message: The error message.\n * @param source: The error source (network, source, console, webview, custom).\n * @param stacktrace: The error stacktrace.\n * @param context: The additional context to send.\n * @param timestampMs: The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.\n */\n addError(\n message: string,\n source: ErrorSource,\n stacktrace: string,\n context?: object,\n timestampMs?: number\n ): Promise<void>;\n\n /**\n * Adds a specific timing in the active View. The timing duration will be computed as the difference between the time the View was started and the time this function was called.\n * @param name: The name of the new custom timing attribute. Timings can be nested up to 8 levels deep. Names using more than 8 levels will be sanitized by SDK.\n */\n addTiming(name: string): Promise<void>;\n};\n\n/**\n * Describe the type of a RUM Action.\n */\nexport enum RumActionType {\n /** User tapped on a widget. */\n TAP = 'TAP',\n /** User scrolled a view. */\n SCROLL = 'SCROLL',\n /** User swiped on a view. */\n SWIPE = 'SWIPE',\n /** User pressed hardware back button (Android only). */\n BACK = 'BACK',\n /** A custom action. */\n CUSTOM = 'CUSTOM'\n}\n\nexport type ResourceKind =\n | 'image'\n | 'xhr'\n | 'beacon'\n | 'css'\n | 'document'\n | 'fetch'\n | 'font'\n | 'js'\n | 'media'\n | 'other'\n | 'native';\n\nexport enum ErrorSource {\n NETWORK = 'NETWORK',\n SOURCE = 'SOURCE',\n CONSOLE = 'CONSOLE',\n WEBVIEW = 'WEBVIEW',\n CUSTOM = 'CUSTOM'\n}\n\n/**\n * Type of instrumentation on the host.\n * - DATADOG: Datadog’s propagator (`x-datadog-*`)\n * - TRACECONTEXT: W3C Trace Context (`traceparent`)\n * - B3: B3 single header (`b3`)\n * - B3MULTI: B3 multiple headers (`X-B3-*`)\n */\nexport enum PropagatorType {\n DATADOG = 'datadog',\n TRACECONTEXT = 'tracecontext',\n B3 = 'b3',\n B3MULTI = 'b3multi'\n}\n\nexport type FirstPartyHost = {\n match: string;\n propagatorTypes: PropagatorType[];\n};\n"]}
|
package/lib/commonjs/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '1.
|
|
1
|
+
{"version":3,"sources":["version.ts"],"names":["version"],"mappings":";;;;;;AAAA;AACO,MAAMA,OAAO,GAAG,OAAhB","sourcesContent":["// generated by genversion\nexport const version = '1.4.0';\n"]}
|
|
@@ -6,7 +6,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
6
6
|
* Copyright 2016-Present Datadog, Inc.
|
|
7
7
|
*/
|
|
8
8
|
import { InteractionManager } from 'react-native';
|
|
9
|
-
import { DdSdkReactNativeConfiguration, buildConfigurationFromPartialConfiguration, addDefaultValuesToAutoInstrumentationConfiguration, InitializationMode } from './DdSdkReactNativeConfiguration';
|
|
9
|
+
import { DdSdkReactNativeConfiguration, buildConfigurationFromPartialConfiguration, addDefaultValuesToAutoInstrumentationConfiguration, InitializationMode, formatFirstPartyHosts } from './DdSdkReactNativeConfiguration';
|
|
10
10
|
import { InternalLog } from './InternalLog';
|
|
11
11
|
import { ProxyType } from './ProxyConfiguration';
|
|
12
12
|
import { SdkVerbosity } from './SdkVerbosity';
|
|
@@ -132,7 +132,7 @@ export class DdSdkReactNative {
|
|
|
132
132
|
if (configuration.trackResources) {
|
|
133
133
|
DdRumResourceTracking.startTracking({
|
|
134
134
|
tracingSamplingRate: configuration.resourceTracingSamplingRate,
|
|
135
|
-
firstPartyHosts: configuration.firstPartyHosts
|
|
135
|
+
firstPartyHosts: formatFirstPartyHosts(configuration.firstPartyHosts)
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
138
|
|
|
@@ -269,6 +269,6 @@ _defineProperty(DdSdkReactNative, "buildConfiguration", configuration => {
|
|
|
269
269
|
configuration.additionalConfig[DdSdkReactNative.DD_VERSION_SUFFIX] = `-${configuration.versionSuffix}`;
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
-
configuration.additionalConfig['_dd.first_party_hosts'] = configuration.firstPartyHosts;
|
|
272
|
+
configuration.additionalConfig['_dd.first_party_hosts'] = formatFirstPartyHosts(configuration.firstPartyHosts);
|
|
273
273
|
});
|
|
274
274
|
//# sourceMappingURL=DdSdkReactNative.js.map
|