@datadog/mobile-react-native 1.4.0 → 1.5.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/DatadogSDKReactNative.podspec +2 -2
- package/android/build.gradle +5 -5
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogSDKWrapper.kt +4 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogWrapper.kt +6 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdk.kt +124 -95
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +2 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +2 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +148 -25
- package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +5 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/DdSdkConfigurationForgeryFactory.kt +2 -1
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/TelemetryConfigurationEventForgeryFactory.kt +10 -0
- package/datadog-sourcemaps.gradle +6 -1
- package/ios/Sources/DdSdk.m +4 -0
- package/ios/Sources/DdSdk.swift +17 -0
- package/ios/Sources/DdSdkConfiguration.swift +6 -0
- package/ios/Sources/RNDdSdkConfiguration.swift +2 -0
- package/jest/mock.js +1 -1
- package/lib/commonjs/DdSdkReactNative.js +7 -7
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +8 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/commonjs/index.js +8 -8
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nativeModulesTypes.js.map +1 -1
- package/lib/commonjs/rum/DdRum.js +3 -3
- package/lib/commonjs/rum/DdRum.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +2 -2
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +4 -4
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/ResourceReporter.js +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/URLHostParser.js +2 -2
- package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/URLHostParser.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/XHRProxy.js +4 -4
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/responseSize.js +2 -2
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -0
- package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js +2 -2
- package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
- package/lib/commonjs/sdk/DdSdk.js +17 -0
- package/lib/commonjs/sdk/DdSdk.js.map +1 -0
- package/lib/commonjs/sdk/EventMappers/EventMapper.js +2 -2
- package/lib/commonjs/sdk/EventMappers/EventMapper.js.map +1 -1
- package/lib/commonjs/{foundation.js → trace/DdTrace.js} +9 -19
- package/lib/commonjs/trace/DdTrace.js.map +1 -0
- package/lib/commonjs/types.js +2 -1
- package/lib/commonjs/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 +2 -2
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +8 -1
- package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeModulesTypes.js.map +1 -1
- package/lib/module/rum/DdRum.js +1 -1
- package/lib/module/rum/DdRum.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +5 -5
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/ResourceReporter.js +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/ResourceReporter.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/URLHostParser.js +2 -2
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/URLHostParser.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/XHRProxy.js +4 -4
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/responseSize.js +2 -2
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -0
- package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js +1 -1
- package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
- package/lib/module/sdk/DdSdk.js +9 -0
- package/lib/module/sdk/DdSdk.js.map +1 -0
- package/lib/module/sdk/EventMappers/EventMapper.js +1 -1
- package/lib/module/sdk/EventMappers/EventMapper.js.map +1 -1
- package/lib/module/{foundation.js → trace/DdTrace.js} +9 -11
- package/lib/module/trace/DdTrace.js.map +1 -0
- package/lib/module/types.js +2 -1
- package/lib/module/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 +5 -0
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/nativeModulesTypes.d.ts +5 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracing.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/ResourceReporter.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/internalDevResourceBlocklist.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/URLHostParser.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/XHRProxy.d.ts +2 -2
- package/lib/typescript/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.d.ts +1 -1
- package/lib/typescript/sdk/DdSdk.d.ts +3 -0
- package/lib/typescript/trace/DdTrace.d.ts +3 -0
- package/lib/typescript/types.d.ts +2 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +76 -76
- package/src/DdSdkReactNative.tsx +2 -1
- package/src/DdSdkReactNativeConfiguration.tsx +8 -1
- package/src/__tests__/DdSdkReactNative.test.tsx +1 -1
- package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +7 -2
- package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +1 -1
- package/src/index.tsx +1 -1
- package/src/nativeModulesTypes.ts +6 -0
- package/src/rum/DdRum.ts +1 -1
- package/src/rum/__tests__/DdRum.test.ts +1 -1
- package/src/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.tsx +1 -1
- package/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.tsx +5 -5
- package/src/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracing.tsx +1 -1
- package/src/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.ts +1 -2
- package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/ResourceReporter.ts +2 -2
- package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/__tests__/ResourceReporter.test.ts +2 -2
- package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/__tests__/__utils__/ResourceMockFactory.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/internalDevResourceBlocklist.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/URLHostParser.ts +3 -3
- package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/XHRProxy.ts +6 -6
- package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/__tests__/XHRProxy.test.ts +9 -9
- package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/responseSize.ts +2 -2
- package/src/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.ts +1 -1
- package/src/sdk/DatadogProvider/Buffer/BoundedBuffer.ts +1 -1
- package/src/sdk/DatadogProvider/Buffer/__tests__/BoundedBuffer.test.ts +1 -1
- package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +2 -1
- package/src/sdk/DdSdk.ts +13 -0
- package/src/sdk/EventMappers/EventMapper.ts +1 -1
- package/src/sdk/EventMappers/__tests__/EventMapper.test.ts +1 -1
- package/src/trace/DdTrace.ts +54 -0
- package/src/types.tsx +1 -0
- package/src/version.ts +1 -1
- package/lib/commonjs/foundation.js.map +0 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/domain/distributedTracing.js.map +0 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/domain/firstPartyHosts.js.map +0 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +0 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/internalDevResourceBlocklist.js.map +0 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/XHRProxy.js.map +0 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/responseSize.js.map +0 -1
- package/lib/module/foundation.js.map +0 -1
- package/lib/module/rum/instrumentation/resourceTracking/domain/distributedTracing.js.map +0 -1
- package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/ResourceReporter.js.map +0 -1
- package/lib/module/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/internalDevResourceBlocklist.js.map +0 -1
- package/lib/module/rum/instrumentation/resourceTracking/implementation/URLHostParser.js.map +0 -1
- package/lib/module/rum/instrumentation/resourceTracking/implementation/XHRProxy.js.map +0 -1
- package/lib/module/rum/instrumentation/resourceTracking/implementation/responseSize.js.map +0 -1
- package/lib/typescript/foundation.d.ts +0 -5
- package/src/foundation.tsx +0 -36
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracing.js +0 -0
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracingHeaders.js +0 -0
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracingHeaders.js.map +0 -0
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.js +0 -0
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/internalDevResourceBlocklist.js +0 -0
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.js +0 -0
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.js.map +0 -0
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.js +0 -0
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.js.map +0 -0
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.js +0 -0
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.js.map +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracing.js +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracingHeaders.js +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracingHeaders.js.map +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.js +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/internalDevResourceBlocklist.js +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.js +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.js.map +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.js +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.js.map +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.js +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.js.map +0 -0
- /package/lib/typescript/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracingHeaders.d.ts +0 -0
- /package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.d.ts +0 -0
- /package/lib/typescript/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/responseSize.d.ts +0 -0
- /package/lib/typescript/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.d.ts +0 -0
- /package/src/rum/instrumentation/resourceTracking/{domain → distributedTracing}/__tests__/distributedTracing.test.ts +0 -0
- /package/src/rum/instrumentation/resourceTracking/{domain → distributedTracing}/__tests__/firstPartyHosts.test.ts +0 -0
- /package/src/rum/instrumentation/resourceTracking/{domain → distributedTracing}/distributedTracingHeaders.ts +0 -0
- /package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/__tests__/internalDevResourceBlocklist.test.ts +0 -0
- /package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/resourceTiming.ts +0 -0
- /package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/__tests__/URLHostParser.test.ts +0 -0
- /package/src/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.ts +0 -0
|
@@ -48,6 +48,7 @@ describe('DdSdkReactNativeConfiguration', () => {
|
|
|
48
48
|
"site": "US1",
|
|
49
49
|
"telemetrySampleRate": 20,
|
|
50
50
|
"trackErrors": false,
|
|
51
|
+
"trackFrustrations": true,
|
|
51
52
|
"trackInteractions": false,
|
|
52
53
|
"trackResources": false,
|
|
53
54
|
"trackingConsent": "granted",
|
|
@@ -93,7 +94,8 @@ describe('DdSdkReactNativeConfiguration', () => {
|
|
|
93
94
|
trackingConsent: TrackingConsent.PENDING,
|
|
94
95
|
nativeCrashReportEnabled: true,
|
|
95
96
|
nativeLongTaskThresholdMs: 345,
|
|
96
|
-
longTaskThresholdMs: 567
|
|
97
|
+
longTaskThresholdMs: 567,
|
|
98
|
+
trackFrustrations: true
|
|
97
99
|
}
|
|
98
100
|
)
|
|
99
101
|
).toMatchInlineSnapshot(`
|
|
@@ -129,6 +131,7 @@ describe('DdSdkReactNativeConfiguration', () => {
|
|
|
129
131
|
"site": "EU",
|
|
130
132
|
"telemetrySampleRate": 20,
|
|
131
133
|
"trackErrors": true,
|
|
134
|
+
"trackFrustrations": true,
|
|
132
135
|
"trackInteractions": true,
|
|
133
136
|
"trackResources": true,
|
|
134
137
|
"trackingConsent": "pending",
|
|
@@ -163,7 +166,8 @@ describe('DdSdkReactNativeConfiguration', () => {
|
|
|
163
166
|
additionalConfig: {},
|
|
164
167
|
nativeCrashReportEnabled: false,
|
|
165
168
|
nativeLongTaskThresholdMs: false,
|
|
166
|
-
longTaskThresholdMs: false
|
|
169
|
+
longTaskThresholdMs: false,
|
|
170
|
+
trackFrustrations: false
|
|
167
171
|
}
|
|
168
172
|
)
|
|
169
173
|
).toMatchInlineSnapshot(`
|
|
@@ -189,6 +193,7 @@ describe('DdSdkReactNativeConfiguration', () => {
|
|
|
189
193
|
"site": "",
|
|
190
194
|
"telemetrySampleRate": 20,
|
|
191
195
|
"trackErrors": false,
|
|
196
|
+
"trackFrustrations": false,
|
|
192
197
|
"trackInteractions": false,
|
|
193
198
|
"trackResources": false,
|
|
194
199
|
"trackingConsent": "granted",
|
|
@@ -17,9 +17,9 @@ import {
|
|
|
17
17
|
} from 'react-native';
|
|
18
18
|
import React from 'react';
|
|
19
19
|
|
|
20
|
-
import { DdSdk } from '../../../foundation';
|
|
21
20
|
import { DdEventsInterceptor } from '../../../rum/instrumentation/interactionTracking/DdEventsInterceptor';
|
|
22
21
|
import { DdRumUserInteractionTracking } from '../../../rum/instrumentation/interactionTracking/DdRumUserInteractionTracking';
|
|
22
|
+
import { DdSdk } from '../../../sdk/DdSdk';
|
|
23
23
|
|
|
24
24
|
const styles = StyleSheet.create({
|
|
25
25
|
button: {
|
package/src/index.tsx
CHANGED
|
@@ -15,11 +15,11 @@ import { InternalLog } from './InternalLog';
|
|
|
15
15
|
import { ProxyConfiguration, ProxyType } from './ProxyConfiguration';
|
|
16
16
|
import { SdkVerbosity } from './SdkVerbosity';
|
|
17
17
|
import { TrackingConsent } from './TrackingConsent';
|
|
18
|
-
import { DdTrace } from './foundation';
|
|
19
18
|
import { DdLogs } from './logs/DdLogs';
|
|
20
19
|
import { DdRum } from './rum/DdRum';
|
|
21
20
|
import { RumActionType, ErrorSource, PropagatorType } from './rum/types';
|
|
22
21
|
import { DatadogProvider } from './sdk/DatadogProvider/DatadogProvider';
|
|
22
|
+
import { DdTrace } from './trace/DdTrace';
|
|
23
23
|
|
|
24
24
|
export {
|
|
25
25
|
DatadogProvider,
|
|
@@ -61,6 +61,12 @@ export type DdNativeSdkType = {
|
|
|
61
61
|
* @param kind error kind
|
|
62
62
|
*/
|
|
63
63
|
telemetryError(message: string, stack: string, kind: string): Promise<void>;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Send webview telemetry logs
|
|
67
|
+
* @param message event description
|
|
68
|
+
*/
|
|
69
|
+
consumeWebviewEvent(message: string): Promise<void>;
|
|
64
70
|
};
|
|
65
71
|
|
|
66
72
|
/**
|
package/src/rum/DdRum.ts
CHANGED
|
@@ -10,9 +10,9 @@ import { NativeModules } from 'react-native';
|
|
|
10
10
|
import { InternalLog } from '../InternalLog';
|
|
11
11
|
import { SdkVerbosity } from '../SdkVerbosity';
|
|
12
12
|
import { TimeProvider } from '../TimeProvider';
|
|
13
|
-
import { DdSdk } from '../foundation';
|
|
14
13
|
import type { DdNativeRumType } from '../nativeModulesTypes';
|
|
15
14
|
import { bufferVoidNativeCall } from '../sdk/DatadogProvider/Buffer/bufferNativeCall';
|
|
15
|
+
import { DdSdk } from '../sdk/DdSdk';
|
|
16
16
|
|
|
17
17
|
import type { ActionEventMapper } from './eventMappers/actionEventMapper';
|
|
18
18
|
import { generateActionEventMapper } from './eventMappers/actionEventMapper';
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
import { NativeModules } from 'react-native';
|
|
9
9
|
|
|
10
|
-
import { DdSdk } from '../../foundation';
|
|
11
10
|
import { BufferSingleton } from '../../sdk/DatadogProvider/Buffer/BufferSingleton';
|
|
11
|
+
import { DdSdk } from '../../sdk/DdSdk';
|
|
12
12
|
import { DdRum } from '../DdRum';
|
|
13
13
|
import type { ActionEventMapper } from '../eventMappers/actionEventMapper';
|
|
14
14
|
import type { ErrorEventMapper } from '../eventMappers/errorEventMapper';
|
|
@@ -9,7 +9,7 @@ import React from 'react';
|
|
|
9
9
|
import { InternalLog } from '../../../InternalLog';
|
|
10
10
|
import { SdkVerbosity } from '../../../SdkVerbosity';
|
|
11
11
|
import { getErrorMessage } from '../../../errorUtils';
|
|
12
|
-
import { DdSdk } from '../../../
|
|
12
|
+
import { DdSdk } from '../../../sdk/DdSdk';
|
|
13
13
|
|
|
14
14
|
import { DdEventsInterceptor } from './DdEventsInterceptor';
|
|
15
15
|
import type EventsInterceptor from './EventsInterceptor';
|
|
@@ -8,11 +8,11 @@ import { InternalLog } from '../../../InternalLog';
|
|
|
8
8
|
import { SdkVerbosity } from '../../../SdkVerbosity';
|
|
9
9
|
import type { FirstPartyHost } from '../../types';
|
|
10
10
|
|
|
11
|
-
import { firstPartyHostsRegexMapBuilder } from './
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
11
|
+
import { firstPartyHostsRegexMapBuilder } from './distributedTracing/firstPartyHosts';
|
|
12
|
+
import { ResourceReporter } from './requestProxy/XHRProxy/DatadogRumResource/ResourceReporter';
|
|
13
|
+
import { filterDevResource } from './requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist';
|
|
14
|
+
import { XHRProxy } from './requestProxy/XHRProxy/XHRProxy';
|
|
15
|
+
import type { RequestProxy } from './requestProxy/interfaces/RequestProxy';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Provides RUM auto-instrumentation feature to track resources (fetch, XHR, axios) as RUM events.
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import type { PropagatorType } from '../../../types';
|
|
8
|
+
import type { RegexMap } from '../requestProxy/interfaces/RequestProxy';
|
|
8
9
|
|
|
9
10
|
import type { Hostname } from './firstPartyHosts';
|
|
10
11
|
import { getPropagatorsForHost } from './firstPartyHosts';
|
|
11
|
-
import type { RegexMap } from './interfaces/RequestProxy';
|
|
12
12
|
|
|
13
13
|
export type DdRumResourceTracingAttributes =
|
|
14
14
|
| {
|
package/src/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.ts
RENAMED
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
import { InternalLog } from '../../../../InternalLog';
|
|
8
8
|
import { SdkVerbosity } from '../../../../SdkVerbosity';
|
|
9
9
|
import type { FirstPartyHost, PropagatorType } from '../../../types';
|
|
10
|
-
|
|
11
|
-
import type { RegexMap } from './interfaces/RequestProxy';
|
|
10
|
+
import type { RegexMap } from '../requestProxy/interfaces/RequestProxy';
|
|
12
11
|
|
|
13
12
|
export type Hostname = { _type: 'Hostname' } & string;
|
|
14
13
|
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Copyright 2016-Present Datadog, Inc.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { DdRum } from '
|
|
8
|
-
import type { RUMResource } from '../../
|
|
7
|
+
import { DdRum } from '../../../../../DdRum';
|
|
8
|
+
import type { RUMResource } from '../../interfaces/RumResource';
|
|
9
9
|
|
|
10
10
|
import { createTimings } from './resourceTiming';
|
|
11
11
|
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
import { NativeModules } from 'react-native';
|
|
8
8
|
|
|
9
|
-
import { BufferSingleton } from '
|
|
10
|
-
import type { RUMResource } from '../../../
|
|
9
|
+
import { BufferSingleton } from '../../../../../../../sdk/DatadogProvider/Buffer/BufferSingleton';
|
|
10
|
+
import type { RUMResource } from '../../../interfaces/RumResource';
|
|
11
11
|
import { ResourceReporter } from '../ResourceReporter';
|
|
12
12
|
|
|
13
13
|
import { ResourceMockFactory } from './__utils__/ResourceMockFactory';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright 2016-Present Datadog, Inc.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type { RUMResource } from '../../../../
|
|
7
|
+
import type { RUMResource } from '../../../../interfaces/RumResource';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* This method returns a new object each time to avoid overriding the same object
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Copyright 2016-Present Datadog, Inc.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type { RUMResource } from '../../
|
|
7
|
+
import type { RUMResource } from '../../interfaces/RumResource';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Expo sends all console.* calls to the packager. As we log all API calls
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* Copyright 2016-Present Datadog, Inc.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { InternalLog } from '
|
|
8
|
-
import { SdkVerbosity } from '
|
|
9
|
-
import type { Hostname } from '
|
|
7
|
+
import { InternalLog } from '../../../../../InternalLog';
|
|
8
|
+
import { SdkVerbosity } from '../../../../../SdkVerbosity';
|
|
9
|
+
import type { Hostname } from '../../distributedTracing/firstPartyHosts';
|
|
10
10
|
|
|
11
11
|
// matches what is between the first "://" and the next "/", ":" or whitespace
|
|
12
12
|
const hostRegex = '^.+://([^:/\\s]+)';
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* Copyright 2016-Present Datadog, Inc.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import Timer from '
|
|
8
|
-
import { getTracingHeaders } from '
|
|
9
|
-
import type { DdRumResourceTracingAttributes } from '
|
|
10
|
-
import { getTracingAttributes } from '
|
|
11
|
-
import type { RequestProxyOptions } from '../
|
|
12
|
-
import { RequestProxy } from '../
|
|
7
|
+
import Timer from '../../../../../Timer';
|
|
8
|
+
import { getTracingHeaders } from '../../distributedTracing/distributedTracingHeaders';
|
|
9
|
+
import type { DdRumResourceTracingAttributes } from '../../distributedTracing/distributedTracing';
|
|
10
|
+
import { getTracingAttributes } from '../../distributedTracing/distributedTracing';
|
|
11
|
+
import type { RequestProxyOptions } from '../interfaces/RequestProxy';
|
|
12
|
+
import { RequestProxy } from '../interfaces/RequestProxy';
|
|
13
13
|
|
|
14
14
|
import type { ResourceReporter } from './DatadogRumResource/ResourceReporter';
|
|
15
15
|
import { URLHostParser } from './URLHostParser';
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
import { Platform, NativeModules } from 'react-native';
|
|
8
8
|
|
|
9
|
-
import { InternalLog } from '
|
|
10
|
-
import { SdkVerbosity } from '
|
|
11
|
-
import { BufferSingleton } from '
|
|
12
|
-
import { DdRum } from '
|
|
13
|
-
import { PropagatorType } from '
|
|
14
|
-
import { XMLHttpRequestMock } from '
|
|
9
|
+
import { InternalLog } from '../../../../../../InternalLog';
|
|
10
|
+
import { SdkVerbosity } from '../../../../../../SdkVerbosity';
|
|
11
|
+
import { BufferSingleton } from '../../../../../../sdk/DatadogProvider/Buffer/BufferSingleton';
|
|
12
|
+
import { DdRum } from '../../../../../DdRum';
|
|
13
|
+
import { PropagatorType } from '../../../../../types';
|
|
14
|
+
import { XMLHttpRequestMock } from '../../../__tests__/__utils__/XMLHttpRequestMock';
|
|
15
15
|
import {
|
|
16
16
|
PARENT_ID_HEADER_KEY,
|
|
17
17
|
TRACE_ID_HEADER_KEY,
|
|
@@ -23,8 +23,8 @@ import {
|
|
|
23
23
|
B3_MULTI_SAMPLED_HEADER_KEY,
|
|
24
24
|
ORIGIN_RUM,
|
|
25
25
|
ORIGIN_HEADER_KEY
|
|
26
|
-
} from '
|
|
27
|
-
import { firstPartyHostsRegexMapBuilder } from '
|
|
26
|
+
} from '../../../distributedTracing/distributedTracingHeaders';
|
|
27
|
+
import { firstPartyHostsRegexMapBuilder } from '../../../distributedTracing/firstPartyHosts';
|
|
28
28
|
import { ResourceReporter } from '../DatadogRumResource/ResourceReporter';
|
|
29
29
|
import { XHRProxy } from '../XHRProxy';
|
|
30
30
|
import {
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
} from '../responseSize';
|
|
34
34
|
|
|
35
35
|
jest.useFakeTimers();
|
|
36
|
-
jest.mock('
|
|
36
|
+
jest.mock('../../../../../../InternalLog');
|
|
37
37
|
const mockedInternalLog = (InternalLog as unknown) as {
|
|
38
38
|
log: jest.MockedFunction<typeof InternalLog.log>;
|
|
39
39
|
};
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Copyright 2016-Present Datadog, Inc.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { InternalLog } from '
|
|
8
|
-
import { SdkVerbosity } from '
|
|
7
|
+
import { InternalLog } from '../../../../../InternalLog';
|
|
8
|
+
import { SdkVerbosity } from '../../../../../SdkVerbosity';
|
|
9
9
|
|
|
10
10
|
const MISSING_RESOURCE_SIZE = -1;
|
|
11
11
|
export const RESOURCE_SIZE_ERROR_MESSAGE =
|
package/src/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.ts
RENAMED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import type { ResourceKind } from '../../../../types';
|
|
8
|
-
import type { DdRumResourceTracingAttributes } from '
|
|
8
|
+
import type { DdRumResourceTracingAttributes } from '../../distributedTracing/distributedTracing';
|
|
9
9
|
|
|
10
10
|
export interface RUMResource {
|
|
11
11
|
key: string;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { InternalLog } from '../../../InternalLog';
|
|
8
8
|
import { SdkVerbosity } from '../../../SdkVerbosity';
|
|
9
9
|
import { getErrorStackTrace } from '../../../errorUtils';
|
|
10
|
-
import { DdSdk } from '../../../
|
|
10
|
+
import { DdSdk } from '../../../sdk/DdSdk';
|
|
11
11
|
|
|
12
12
|
import { DatadogBuffer } from './DatadogBuffer';
|
|
13
13
|
|
|
@@ -9,9 +9,9 @@ import { NativeModules } from 'react-native';
|
|
|
9
9
|
import { InitializationMode } from '../../../DdSdkReactNativeConfiguration';
|
|
10
10
|
import { DdSdkReactNative } from '../../../DdSdkReactNative';
|
|
11
11
|
import { TimeProvider } from '../../../TimeProvider';
|
|
12
|
-
import { DdTrace } from '../../../foundation';
|
|
13
12
|
import { DdRum } from '../../../rum/DdRum';
|
|
14
13
|
import { RumActionType } from '../../../rum/types';
|
|
14
|
+
import { DdTrace } from '../../../trace/DdTrace';
|
|
15
15
|
import { BufferSingleton } from '../Buffer/BufferSingleton';
|
|
16
16
|
import {
|
|
17
17
|
DatadogProvider,
|
|
@@ -81,6 +81,7 @@ describe('DatadogProvider', () => {
|
|
|
81
81
|
"sampleRate": 100,
|
|
82
82
|
"site": "US1",
|
|
83
83
|
"telemetrySampleRate": 20,
|
|
84
|
+
"trackFrustrations": true,
|
|
84
85
|
"trackingConsent": "granted",
|
|
85
86
|
"vitalsUpdateFrequency": "AVERAGE",
|
|
86
87
|
}
|
package/src/sdk/DdSdk.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
3
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { NativeModules } from 'react-native';
|
|
8
|
+
|
|
9
|
+
import type { DdNativeSdkType } from '../nativeModulesTypes';
|
|
10
|
+
|
|
11
|
+
const DdSdk: DdNativeSdkType = NativeModules.DdSdk;
|
|
12
|
+
|
|
13
|
+
export { DdSdk };
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { InternalLog } from '../../InternalLog';
|
|
8
8
|
import { SdkVerbosity } from '../../SdkVerbosity';
|
|
9
|
-
import { DdSdk } from '../../
|
|
9
|
+
import { DdSdk } from '../../sdk/DdSdk';
|
|
10
10
|
import { AttributesSingleton } from '../AttributesSingleton/AttributesSingleton';
|
|
11
11
|
import type { Attributes } from '../AttributesSingleton/types';
|
|
12
12
|
import { UserInfoSingleton } from '../UserInfoSingleton/UserInfoSingleton';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
3
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { NativeModules } from 'react-native';
|
|
8
|
+
|
|
9
|
+
import { InternalLog } from '../InternalLog';
|
|
10
|
+
import { SdkVerbosity } from '../SdkVerbosity';
|
|
11
|
+
import { TimeProvider } from '../TimeProvider';
|
|
12
|
+
import type { DdNativeTraceType } from '../nativeModulesTypes';
|
|
13
|
+
import {
|
|
14
|
+
bufferNativeCallReturningId,
|
|
15
|
+
bufferNativeCallWithId
|
|
16
|
+
} from '../sdk/DatadogProvider/Buffer/bufferNativeCall';
|
|
17
|
+
import type { DdTraceType } from '../types';
|
|
18
|
+
|
|
19
|
+
const timeProvider = new TimeProvider();
|
|
20
|
+
|
|
21
|
+
class DdTraceWrapper implements DdTraceType {
|
|
22
|
+
private nativeTrace: DdNativeTraceType = NativeModules.DdTrace;
|
|
23
|
+
|
|
24
|
+
startSpan(
|
|
25
|
+
operation: string,
|
|
26
|
+
context: object = {},
|
|
27
|
+
timestampMs: number = timeProvider.now()
|
|
28
|
+
): Promise<string> {
|
|
29
|
+
const spanId = bufferNativeCallReturningId(() =>
|
|
30
|
+
this.nativeTrace.startSpan(operation, context, timestampMs)
|
|
31
|
+
);
|
|
32
|
+
InternalLog.log(
|
|
33
|
+
`Starting span “${operation}” #${spanId}`,
|
|
34
|
+
SdkVerbosity.DEBUG
|
|
35
|
+
);
|
|
36
|
+
return spanId;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
finishSpan(
|
|
40
|
+
spanId: string,
|
|
41
|
+
context: object = {},
|
|
42
|
+
timestampMs: number = timeProvider.now()
|
|
43
|
+
): Promise<void> {
|
|
44
|
+
InternalLog.log(`Finishing span #${spanId}`, SdkVerbosity.DEBUG);
|
|
45
|
+
return bufferNativeCallWithId(
|
|
46
|
+
id => this.nativeTrace.finishSpan(id, context, timestampMs),
|
|
47
|
+
spanId
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const DdTrace: DdTraceType = new DdTraceWrapper();
|
|
53
|
+
|
|
54
|
+
export { DdTrace };
|
package/src/types.tsx
CHANGED
|
@@ -21,6 +21,7 @@ export class DdSdkConfiguration {
|
|
|
21
21
|
readonly additionalConfig: object,
|
|
22
22
|
readonly telemetrySampleRate: number,
|
|
23
23
|
readonly vitalsUpdateFrequency: string,
|
|
24
|
+
readonly trackFrustrations: boolean,
|
|
24
25
|
readonly configurationForTelemetry: {
|
|
25
26
|
initializationType: string;
|
|
26
27
|
trackErrors: boolean;
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by genversion
|
|
2
|
-
export const version = '1.
|
|
2
|
+
export const version = '1.5.1';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["foundation.tsx"],"names":["timeProvider","TimeProvider","DdTraceWrapper","NativeModules","DdTrace","startSpan","operation","context","timestampMs","now","spanId","nativeTrace","InternalLog","log","SdkVerbosity","DEBUG","finishSpan","id","DdSdk"],"mappings":";;;;;;;;;;;;;AAMA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;AAEA,MAAMA,YAAY,GAAG,IAAIC,0BAAJ,EAArB;;AAEA,MAAMC,cAAN,CAA4C;AAAA;AAAA,yCAECC,2BAAcC,OAFf;AAAA;;AAIxCC,EAAAA,SAAS,CAACC,SAAD,EAAoBC,OAAe,GAAG,EAAtC,EAA0CC,WAAmB,GAAGR,YAAY,CAACS,GAAb,EAAhE,EAAqG;AAC1G,QAAIC,MAAM,GAAG,mDAA4B,MAAK,KAAKC,WAAL,CAAiBN,SAAjB,CAA2BC,SAA3B,EAAsCC,OAAtC,EAA+CC,WAA/C,CAAjC,CAAb;;AACAI,6BAAYC,GAAZ,CAAgB,oBAAqBP,SAArB,GAAiC,KAAjC,GAAyCI,MAAzD,EAAiEI,2BAAaC,KAA9E;;AACA,WAAOL,MAAP;AACH;;AAEDM,EAAAA,UAAU,CAACN,MAAD,EAAiBH,OAAe,GAAG,EAAnC,EAAuCC,WAAmB,GAAGR,YAAY,CAACS,GAAb,EAA7D,EAAgG;AACtGG,6BAAYC,GAAZ,CAAgB,qBAAsBH,MAAtC,EAA8CI,2BAAaC,KAA3D;;AACA,WAAO,8CAAwBE,EAAD,IAAS,KAAKN,WAAL,CAAiBK,UAAjB,CAA4BC,EAA5B,EAAgCV,OAAhC,EAAyCC,WAAzC,CAAhC,EAAuFE,MAAvF,CAAP;AACH;;AAbuC;;AAgB5C,MAAMQ,KAAsB,GAAGf,2BAAce,KAA7C;;AACA,MAAMd,OAAoB,GAAG,IAAIF,cAAJ,EAA7B","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 { NativeModules } from 'react-native';\nimport { DdSdkConfiguration, DdTraceType } from './types';\nimport {InternalLog} from \"./InternalLog\"\nimport {SdkVerbosity} from \"./SdkVerbosity\";\nimport {TimeProvider} from \"./TimeProvider\";\nimport type { DdNativeSdkType, DdNativeTraceType } from './nativeModulesTypes';\nimport { bufferNativeCallReturningId, bufferNativeCallWithId } from './sdk/DatadogProvider/Buffer/bufferNativeCall';\n\nconst timeProvider = new TimeProvider();\n\nclass DdTraceWrapper implements DdTraceType {\n\n private nativeTrace: DdNativeTraceType = NativeModules.DdTrace;\n\n startSpan(operation: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<string> {\n let spanId = bufferNativeCallReturningId(() =>this.nativeTrace.startSpan(operation, context, timestampMs));\n InternalLog.log(\"Starting span “\" + operation + \"” #\" + spanId, SdkVerbosity.DEBUG);\n return spanId\n }\n\n finishSpan(spanId: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Finishing span #\" + spanId, SdkVerbosity.DEBUG);\n return bufferNativeCallWithId((id) => this.nativeTrace.finishSpan(id, context, timestampMs), spanId);\n }\n}\n\nconst DdSdk: DdNativeSdkType = NativeModules.DdSdk;\nconst DdTrace: DdTraceType = new DdTraceWrapper();\n\nexport { DdSdkConfiguration, DdSdk, DdTrace };\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["distributedTracing.tsx"],"names":["DISCARDED_TRACE_ATTRIBUTES","samplingPriorityHeader","tracingStrategy","getTracingAttributes","hostname","firstPartyHostsRegexMap","tracingSamplingRate","propagatorsForHost","generateTracingAttributesWithSampling","propagatorTypes","isSampled","Math","random","tracingAttributes","traceId","TraceIdentifier","spanId","rulePsr","MAX_32_BITS_NUMBER","MAX_31_BITS_NUMBER","constructor","radix","low","high","str","mod","floor","toString","length","Array","join"],"mappings":";;;;;;;AASA;;;;AAmBA,MAAMA,0BAA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,IAAhB;AACA,UAAIC,GAAG,GAAG,EAAV;;AAEA,aAAOD,IAAI,GAAG,CAAP,IAAYD,GAAG,GAAG,CAAzB,EAA4B;AACxB,cAAMG,GAAG,GAAIF,IAAI,GAAGF,KAAR,IAAkBH,kBAAkB,GAAG,CAAvC,IAA4CI,GAAxD;AACAC,QAAAA,IAAI,GAAGZ,IAAI,CAACe,KAAL,CAAWH,IAAI,GAAGF,KAAlB,CAAP;AACAC,QAAAA,GAAG,GAAGX,IAAI,CAACe,KAAL,CAAWD,GAAG,GAAGJ,KAAjB,CAAN;AACAG,QAAAA,GAAG,GAAG,CAACC,GAAG,GAAGJ,KAAP,EAAcM,QAAd,CAAuBN,KAAvB,IAAgCG,GAAtC;AACH;;AACD,aAAOA,GAAP;AACH,KAlBa;;AAAA,4CA2BG,CAACH,KAAD,EAAgBO,MAAhB,KAAmC;AAChD,YAAMd,OAAO,GAAG,KAAKa,QAAL,CAAcN,KAAd,CAAhB;;AACA,UAAIP,OAAO,CAACc,MAAR,GAAiBA,MAArB,EAA6B;AACzB,eAAOd,OAAP;AACH;;AACD,aAAOe,KAAK,CAACD,MAAM,GAAGd,OAAO,CAACc,MAAjB,GAA0B,CAA3B,CAAL,CAAmCE,IAAnC,CAAwC,GAAxC,IAA+ChB,OAAtD;AACH,KAjCa;;AACV;AACA,SAAKS,IAAL,GAAYZ,IAAI,CAACe,KAAL,CAAWf,IAAI,CAACC,MAAL,KAAgBO,kBAA3B,CAAZ;AACA,SAAKG,GAAL,GAAWX,IAAI,CAACe,KAAL,CAAWf,IAAI,CAACC,MAAL,KAAgBM,kBAA3B,CAAX;AACH;;AARwB","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\nimport type { Hostname } from './firstPartyHosts';\nimport { getPropagatorsForHost } from './firstPartyHosts';\nimport type { RegexMap } from './interfaces/RequestProxy';\n\nexport type DdRumResourceTracingAttributes =\n | {\n tracingStrategy: 'KEEP';\n traceId: TraceId;\n spanId: SpanId;\n samplingPriorityHeader: '1' | '0';\n rulePsr: number;\n propagatorTypes: PropagatorType[];\n }\n | {\n tracingStrategy: 'DISCARD';\n traceId?: void;\n spanId?: void;\n samplingPriorityHeader: '0';\n };\n\nconst DISCARDED_TRACE_ATTRIBUTES: DdRumResourceTracingAttributes = {\n samplingPriorityHeader: '0',\n tracingStrategy: 'DISCARD'\n};\n\nexport const getTracingAttributes = ({\n hostname,\n firstPartyHostsRegexMap,\n tracingSamplingRate\n}: {\n hostname: Hostname | null;\n firstPartyHostsRegexMap: RegexMap;\n tracingSamplingRate: number;\n}): DdRumResourceTracingAttributes => {\n if (hostname === null) {\n return DISCARDED_TRACE_ATTRIBUTES;\n }\n const propagatorsForHost = getPropagatorsForHost(\n hostname,\n firstPartyHostsRegexMap\n );\n if (propagatorsForHost) {\n return generateTracingAttributesWithSampling(\n tracingSamplingRate,\n propagatorsForHost\n );\n }\n return DISCARDED_TRACE_ATTRIBUTES;\n};\n\nconst generateTracingAttributesWithSampling = (\n tracingSamplingRate: number,\n propagatorTypes: PropagatorType[]\n): DdRumResourceTracingAttributes => {\n const isSampled = Math.random() * 100 <= tracingSamplingRate;\n const tracingAttributes: DdRumResourceTracingAttributes = {\n traceId: new TraceIdentifier() as TraceId,\n spanId: new TraceIdentifier() as SpanId,\n samplingPriorityHeader: isSampled ? '1' : '0',\n tracingStrategy: 'KEEP',\n rulePsr: tracingSamplingRate / 100,\n propagatorTypes\n };\n\n return tracingAttributes;\n};\n\n/**\n * Using branded types will ensure we don't accidentally use\n * traceId for spanId when generating headers.\n */\nexport type TraceId = TraceIdentifier & {\n _brand: 'traceId';\n};\n\nexport type SpanId = TraceIdentifier & {\n _brand: 'spanId';\n};\n\n/*\n * This code was inspired from browser-sdk at (https://github.com/DataDog/browser-sdk/blob/0e9722d5b06f6d49264bc82cd254a207d647d66c/packages/rum-core/src/domain/tracing/tracer.ts#L190)\n */\nconst MAX_32_BITS_NUMBER = 4294967295; // 2^32-1\nconst MAX_31_BITS_NUMBER = 2147483647; // 2^31-1\nexport class TraceIdentifier {\n private low: number;\n private high: number;\n\n constructor() {\n // We need to have a 63 bits number max\n this.high = Math.floor(Math.random() * MAX_31_BITS_NUMBER);\n this.low = Math.floor(Math.random() * MAX_32_BITS_NUMBER);\n }\n\n toString = (radix: number) => {\n let low = this.low;\n let high = this.high;\n let str = '';\n\n while (high > 0 || low > 0) {\n const mod = (high % radix) * (MAX_32_BITS_NUMBER + 1) + low;\n high = Math.floor(high / radix);\n low = Math.floor(mod / radix);\n str = (mod % radix).toString(radix) + str;\n }\n return str;\n };\n\n /**\n * This function pads the trace with `0`.\n * It should not be used with a `length` lower than the trace, as we return the full trace in this case.\n * @param radix radix for the trace\n * @param length minimum length\n * @returns padded string\n */\n toPaddedString = (radix: number, length: number) => {\n const traceId = this.toString(radix);\n if (traceId.length > length) {\n return traceId;\n }\n return Array(length - traceId.length + 1).join('0') + traceId;\n };\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
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,CAA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AoB,CAACG,IAArB,CAA0B,yBAA1B;AACA,WAAOH,oBAAP;AACH,GAVD,CAUE,OAAOI,CAAP,EAAU;AACRC,6BAAYC,GAAZ,CACK,kCAAiCC,IAAI,CAACC,SAAL,CAC9B3B,eAD8B,CAEhC,wCAHN,EAII4B,2BAAaC,IAJjB;;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"]}
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAoC;AAAA;;AAAA,4CAI7BC,QAAD,IAA2B;AACxC,UAAIC,gBAAoC,GAAGD,QAA3C;;AAEA,WAAK,MAAME,MAAX,IAAqB,KAAKC,OAA1B,EAAmC;AAC/BF,QAAAA,gBAAgB,GAAGC,MAAM,CAACF,QAAD,CAAzB;;AACA,YAAIC,gBAAgB,KAAK,IAAzB,EAA+B;AAC3B;AACH;AACJ;;AAEDG,MAAAA,cAAc,CAACH,gBAAD,CAAd;AACH,KAf8C;;AAC3C,SAAKE,OAAL,GAAeJ,eAAf;AACH;;AALyB;;;;AAqB9B,MAAMM,0BAA0B,GAC5BC,iBAD+B,IAEe;AAC9C,SAAOA,iBAAiB,CAACC,sBAAlB,KAA6C,GAA7C,GACDC,SADC,GAED;AACI,mBAAeF,iBAAiB,CAACG,MAAlB,CAAyBC,QAAzB,CAAkC,EAAlC,CADnB;AAEI,oBAAgBJ,iBAAiB,CAACK,OAAlB,CAA0BD,QAA1B,CAAmC,EAAnC,CAFpB;AAGI,oBAAgBJ,iBAAiB,CAACM;AAHtC,GAFN;AAOH,CAVD;;AAYA,MAAMC,yBAAyB,GAC3BC,OAD8B,IAEJ;AAC1B,SAAO;AACH,4BACIA,OAAO,CAACC,iBAAR,KAA8BP,SAA9B,GACM,mCACIM,OAAO,CAACE,SADZ,EAEIF,OAAO,CAACC,iBAFZ,EAGID,OAAO,CAACG,QAHZ,CADN,GAMM;AARP,GAAP;AAUH,CAbD;;AAeA,MAAMb,cAAc,GAAG,MAAOJ,QAAP,IAAiC;AACpD,QAAMkB,aAAMC,aAAN,CACFnB,QAAQ,CAACoB,GADP,EAEFpB,QAAQ,CAACqB,OAAT,CAAiBC,MAFf,EAGFtB,QAAQ,CAACqB,OAAT,CAAiBE,GAHf,EAIFlB,0BAA0B,CAACL,QAAQ,CAACM,iBAAV,CAJxB,EAKFN,QAAQ,CAACc,OAAT,CAAiBE,SALf,CAAN;;AAQAE,eAAMM,YAAN,CACIxB,QAAQ,CAACoB,GADb,EAEIpB,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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["internalDevResourceBlocklist.ts"],"names":["EXPO_DEV_LOGS_REGEX","RegExp","RN_PACKAGER_SYMBOLICATE_REGEX","internalResourceBlocklist","filterDevResource","resource","resourceRegex","test","request","url"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,mBAAmB,GAAG,IAAIC,MAAJ,CACxB,oEADwB,CAA5B;AAIA;AACA;AACA;;AACA,MAAMC,6BAA6B,GAAG,IAAID,MAAJ,CAClC,uCADkC,CAAtC;AAIA,MAAME,yBAAmC,GAAG,CACxCH,mBADwC,EAExCE,6BAFwC,CAA5C;AAKA;AACA;AACA;AACA;;AACO,MAAME,iBAAiB,GAC1BC,QAD6B,IAER;AACrB;AACA;AACA;AACA,OAAK,MAAMC,aAAX,IAA4BH,yBAA5B,EAAuD;AACnD,QAAIG,aAAa,CAACC,IAAd,CAAmBF,QAAQ,CAACG,OAAT,CAAiBC,GAApC,CAAJ,EAA8C;AAC1C,aAAO,IAAP;AACH;AACJ;;AACD,SAAOJ,QAAP;AACH,CAZM","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 { RUMResource } from '../../domain/interfaces/RumResource';\n\n/**\n * Expo sends all console.* calls to the packager. As we log all API calls\n * when the SDKVerbosity is DEBUG, this would result in an infinite loop of\n * `console.log` and API calls, creating 250 RUM resources per second.\n *\n * The hostname is always going to be localhost or a local IP.\n *\n * An example URL is http://192.168.1.20:8081/logs or http://10.46.29.155:19000/logs\n */\nconst EXPO_DEV_LOGS_REGEX = new RegExp(\n '^http://((10|172|192).[0-9]+.[0-9]+.[0-9]+|localhost):[0-9]+/logs$'\n);\n\n/**\n * This call is made every time the RN packager reloads the js in dev mode.\n */\nconst RN_PACKAGER_SYMBOLICATE_REGEX = new RegExp(\n '^http://localhost:[0-9]+/symbolicate$'\n);\n\nconst internalResourceBlocklist: RegExp[] = [\n EXPO_DEV_LOGS_REGEX,\n RN_PACKAGER_SYMBOLICATE_REGEX\n];\n\n/**\n * Filters RN symbolicate calls and Expo logs calls that happen only in dev.\n * @param resource RUMResource\n */\nexport const filterDevResource = (\n resource: RUMResource\n): RUMResource | null => {\n // TODO: if we get the confirmation by Expo that the\n // logs call is only made when __DEV__ is true, add an\n // early return for when it is false.\n for (const resourceRegex of internalResourceBlocklist) {\n if (resourceRegex.test(resource.request.url)) {\n return null;\n }\n }\n return resource;\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
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;;AA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I,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"]}
|
package/lib/commonjs/rum/instrumentation/resourceTracking/implementation/responseSize.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["responseSize.ts"],"names":["MISSING_RESOURCE_SIZE","RESOURCE_SIZE_ERROR_MESSAGE","byteLength","str","unescape","encodeURI","length","getResponseContentLengthFromHeader","xhr","contentLengthHeader","parseInt","getResponseHeader","isNaN","calculateResponseSize","response","size","responseType","JSON","stringify","e","InternalLog","log","SdkVerbosity","ERROR"],"mappings":";;;;;;;;AAMA;;AACA;;AAPA;AACA;AACA;AACA;AACA;AAKA,MAAMA,qBAAqB,GAAG,CAAC,CAA/B;AACO,MAAMC,2BAA2B,GACpC,wDADG;;;AAGP,SAASC,UAAT,CAAoBC,GAApB,EAAyC;AACrC;AACA;AACA,SAAOC,QAAQ,CAACC,SAAS,CAACF,GAAD,CAAV,CAAR,CAAyBG,MAAhC;AACH;;AAED,SAASC,kCAAT,CACIC,GADJ,EAEiB;AAAA;;AACb,QAAMC,mBAAmB,GAAGC,QAAQ,0BAChCF,GAAG,CAACG,iBAAJ,CAAsB,gBAAtB,CADgC,yEACW,EADX,EAEhC,EAFgC,CAApC;;AAIA,MAAI,CAACC,KAAK,CAACH,mBAAD,CAAV,EAAiC;AAC7B,WAAOA,mBAAP;AACH;;AACD,SAAO,IAAP;AACH;;AAEM,SAASI,qBAAT,CAA+BL,GAA/B,EAA4D;AAC/D,QAAMC,mBAAmB,GAAGF,kCAAkC,CAACC,GAAD,CAA9D;;AACA,MAAIC,mBAAmB,IAAI,IAA3B,EAAiC;AAC7B,WAAOA,mBAAP;AACH;;AAED,QAAMK,QAAQ,GAAGN,GAAG,CAACM,QAArB;;AACA,MAAI,CAACA,QAAL,EAAe;AACX,WAAOd,qBAAP;AACH;;AAED,MAAIe,IAAJ;;AACA,MAAI;AACA,YAAQP,GAAG,CAACQ,YAAZ;AACI,WAAK,EAAL;AACA,WAAK,MAAL;AACI;AACAD,QAAAA,IAAI,GAAGb,UAAU,CAACY,QAAD,CAAjB;AACA;;AACJ,WAAK,MAAL;AACIC,QAAAA,IAAI,GAAGD,QAAQ,CAACC,IAAhB;AACA;;AACJ,WAAK,aAAL;AACIA,QAAAA,IAAI,GAAGD,QAAQ,CAACZ,UAAhB;AACA;;AACJ,WAAK,UAAL;AACI;AACA;AACA;;AACJ,WAAK,MAAL;AACI;AACA;AACA;AACA;AACAa,QAAAA,IAAI,GAAGb,UAAU,CAACe,IAAI,CAACC,SAAL,CAAeJ,QAAf,CAAD,CAAjB;AACA;;AACJ;AACI;AAxBR;AA0BH,GA3BD,CA2BE,OAAOK,CAAP,EAAU;AACRC,6BAAYC,GAAZ,CACK,GAAEpB,2BAA4B,GAAEkB,CAAE,EADvC,EAEIG,2BAAaC,KAFjB;AAIH;;AAED,MAAI,OAAOR,IAAP,KAAgB,QAApB,EAA8B;AAC1B,WAAOf,qBAAP;AACH;;AACD,SAAOe,IAAP;AACH","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';\n\nconst MISSING_RESOURCE_SIZE = -1;\nexport const RESOURCE_SIZE_ERROR_MESSAGE =\n \"Couldn't get resource size, because an error occured: \";\n\nfunction byteLength(str: string): number {\n // This is a weird trick, but it works.\n // Output is the same as TextEncoder.encode(...).length\n return unescape(encodeURI(str)).length;\n}\n\nfunction getResponseContentLengthFromHeader(\n xhr: XMLHttpRequest\n): number | null {\n const contentLengthHeader = parseInt(\n xhr.getResponseHeader('Content-Length') ?? '',\n 10\n );\n if (!isNaN(contentLengthHeader)) {\n return contentLengthHeader;\n }\n return null;\n}\n\nexport function calculateResponseSize(xhr: XMLHttpRequest): number {\n const contentLengthHeader = getResponseContentLengthFromHeader(xhr);\n if (contentLengthHeader != null) {\n return contentLengthHeader as number;\n }\n\n const response = xhr.response;\n if (!response) {\n return MISSING_RESOURCE_SIZE;\n }\n\n let size;\n try {\n switch (xhr.responseType) {\n case '':\n case 'text':\n // String\n size = byteLength(response);\n break;\n case 'blob':\n size = response.size;\n break;\n case 'arraybuffer':\n size = response.byteLength;\n break;\n case 'document':\n // currently not supported by RN as of 0.66\n // HTML Document or XML Document\n break;\n case 'json':\n // plain JS object\n // original size was lost, because this is the object which was parsed.\n // We can only convert back to the string and calculate the size,\n // which will roughly match original.\n size = byteLength(JSON.stringify(response));\n break;\n default:\n break;\n }\n } catch (e) {\n InternalLog.log(\n `${RESOURCE_SIZE_ERROR_MESSAGE}${e}`,\n SdkVerbosity.ERROR\n );\n }\n\n if (typeof size !== 'number') {\n return MISSING_RESOURCE_SIZE;\n }\n return size;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["foundation.tsx"],"names":["NativeModules","DdSdkConfiguration","InternalLog","SdkVerbosity","TimeProvider","bufferNativeCallReturningId","bufferNativeCallWithId","timeProvider","DdTraceWrapper","DdTrace","startSpan","operation","context","timestampMs","now","spanId","nativeTrace","log","DEBUG","finishSpan","id","DdSdk"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAEA,SAASA,aAAT,QAA8B,cAA9B;AACA,SAASC,kBAAT,QAAgD,SAAhD;AACA,SAAQC,WAAR,QAA0B,eAA1B;AACA,SAAQC,YAAR,QAA2B,gBAA3B;AACA,SAAQC,YAAR,QAA2B,gBAA3B;AAEA,SAASC,2BAAT,EAAsCC,sBAAtC,QAAoE,+CAApE;AAEA,MAAMC,YAAY,GAAG,IAAIH,YAAJ,EAArB;;AAEA,MAAMI,cAAN,CAA4C;AAAA;AAAA,yCAECR,aAAa,CAACS,OAFf;AAAA;;AAIxCC,EAAAA,SAAS,CAACC,SAAD,EAAoBC,OAAe,GAAG,EAAtC,EAA0CC,WAAmB,GAAGN,YAAY,CAACO,GAAb,EAAhE,EAAqG;AAC1G,QAAIC,MAAM,GAAGV,2BAA2B,CAAC,MAAK,KAAKW,WAAL,CAAiBN,SAAjB,CAA2BC,SAA3B,EAAsCC,OAAtC,EAA+CC,WAA/C,CAAN,CAAxC;AACAX,IAAAA,WAAW,CAACe,GAAZ,CAAgB,oBAAqBN,SAArB,GAAiC,KAAjC,GAAyCI,MAAzD,EAAiEZ,YAAY,CAACe,KAA9E;AACA,WAAOH,MAAP;AACH;;AAEDI,EAAAA,UAAU,CAACJ,MAAD,EAAiBH,OAAe,GAAG,EAAnC,EAAuCC,WAAmB,GAAGN,YAAY,CAACO,GAAb,EAA7D,EAAgG;AACtGZ,IAAAA,WAAW,CAACe,GAAZ,CAAgB,qBAAsBF,MAAtC,EAA8CZ,YAAY,CAACe,KAA3D;AACA,WAAOZ,sBAAsB,CAAEc,EAAD,IAAS,KAAKJ,WAAL,CAAiBG,UAAjB,CAA4BC,EAA5B,EAAgCR,OAAhC,EAAyCC,WAAzC,CAAV,EAAiEE,MAAjE,CAA7B;AACH;;AAbuC;;AAgB5C,MAAMM,KAAsB,GAAGrB,aAAa,CAACqB,KAA7C;AACA,MAAMZ,OAAoB,GAAG,IAAID,cAAJ,EAA7B;AAEA,SAASP,kBAAT,EAA6BoB,KAA7B,EAAoCZ,OAApC","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 { NativeModules } from 'react-native';\nimport { DdSdkConfiguration, DdTraceType } from './types';\nimport {InternalLog} from \"./InternalLog\"\nimport {SdkVerbosity} from \"./SdkVerbosity\";\nimport {TimeProvider} from \"./TimeProvider\";\nimport type { DdNativeSdkType, DdNativeTraceType } from './nativeModulesTypes';\nimport { bufferNativeCallReturningId, bufferNativeCallWithId } from './sdk/DatadogProvider/Buffer/bufferNativeCall';\n\nconst timeProvider = new TimeProvider();\n\nclass DdTraceWrapper implements DdTraceType {\n\n private nativeTrace: DdNativeTraceType = NativeModules.DdTrace;\n\n startSpan(operation: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<string> {\n let spanId = bufferNativeCallReturningId(() =>this.nativeTrace.startSpan(operation, context, timestampMs));\n InternalLog.log(\"Starting span “\" + operation + \"” #\" + spanId, SdkVerbosity.DEBUG);\n return spanId\n }\n\n finishSpan(spanId: string, context: object = {}, timestampMs: number = timeProvider.now()): Promise<void> {\n InternalLog.log(\"Finishing span #\" + spanId, SdkVerbosity.DEBUG);\n return bufferNativeCallWithId((id) => this.nativeTrace.finishSpan(id, context, timestampMs), spanId);\n }\n}\n\nconst DdSdk: DdNativeSdkType = NativeModules.DdSdk;\nconst DdTrace: DdTraceType = new DdTraceWrapper();\n\nexport { DdSdkConfiguration, DdSdk, DdTrace };\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["distributedTracing.tsx"],"names":["getPropagatorsForHost","DISCARDED_TRACE_ATTRIBUTES","samplingPriorityHeader","tracingStrategy","getTracingAttributes","hostname","firstPartyHostsRegexMap","tracingSamplingRate","propagatorsForHost","generateTracingAttributesWithSampling","propagatorTypes","isSampled","Math","random","tracingAttributes","traceId","TraceIdentifier","spanId","rulePsr","MAX_32_BITS_NUMBER","MAX_31_BITS_NUMBER","constructor","radix","low","high","str","mod","floor","toString","length","Array","join"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAKA,SAASA,qBAAT,QAAsC,mBAAtC;AAmBA,MAAMC,0BAA0D,GAAG;AAC/DC,EAAAA,sBAAsB,EAAE,GADuC;AAE/DC,EAAAA,eAAe,EAAE;AAF8C,CAAnE;AAKA,OAAO,MAAMC,oBAAoB,GAAG,CAAC;AACjCC,EAAAA,QADiC;AAEjCC,EAAAA,uBAFiC;AAGjCC,EAAAA;AAHiC,CAAD,KAQE;AAClC,MAAIF,QAAQ,KAAK,IAAjB,EAAuB;AACnB,WAAOJ,0BAAP;AACH;;AACD,QAAMO,kBAAkB,GAAGR,qBAAqB,CAC5CK,QAD4C,EAE5CC,uBAF4C,CAAhD;;AAIA,MAAIE,kBAAJ,EAAwB;AACpB,WAAOC,qCAAqC,CACxCF,mBADwC,EAExCC,kBAFwC,CAA5C;AAIH;;AACD,SAAOP,0BAAP;AACH,CAvBM;;AAyBP,MAAMQ,qCAAqC,GAAG,CAC1CF,m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G,CAACH,KAAD,EAAgBO,MAAhB,KAAmC;AAChD,YAAMd,OAAO,GAAG,KAAKa,QAAL,CAAcN,KAAd,CAAhB;;AACA,UAAIP,OAAO,CAACc,MAAR,GAAiBA,MAArB,EAA6B;AACzB,eAAOd,OAAP;AACH;;AACD,aAAOe,KAAK,CAACD,MAAM,GAAGd,OAAO,CAACc,MAAjB,GAA0B,CAA3B,CAAL,CAAmCE,IAAnC,CAAwC,GAAxC,IAA+ChB,OAAtD;AACH,KAjCa;;AACV;AACA,SAAKS,IAAL,GAAYZ,IAAI,CAACe,KAAL,CAAWf,IAAI,CAACC,MAAL,KAAgBO,kBAA3B,CAAZ;AACA,SAAKG,GAAL,GAAWX,IAAI,CAACe,KAAL,CAAWf,IAAI,CAACC,MAAL,KAAgBM,kBAA3B,CAAX;AACH;;AARwB","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\nimport type { Hostname } from './firstPartyHosts';\nimport { getPropagatorsForHost } from './firstPartyHosts';\nimport type { RegexMap } from './interfaces/RequestProxy';\n\nexport type DdRumResourceTracingAttributes =\n | {\n tracingStrategy: 'KEEP';\n traceId: TraceId;\n spanId: SpanId;\n samplingPriorityHeader: '1' | '0';\n rulePsr: number;\n propagatorTypes: PropagatorType[];\n }\n | {\n tracingStrategy: 'DISCARD';\n traceId?: void;\n spanId?: void;\n samplingPriorityHeader: '0';\n };\n\nconst DISCARDED_TRACE_ATTRIBUTES: DdRumResourceTracingAttributes = {\n samplingPriorityHeader: '0',\n tracingStrategy: 'DISCARD'\n};\n\nexport const getTracingAttributes = ({\n hostname,\n firstPartyHostsRegexMap,\n tracingSamplingRate\n}: {\n hostname: Hostname | null;\n firstPartyHostsRegexMap: RegexMap;\n tracingSamplingRate: number;\n}): DdRumResourceTracingAttributes => {\n if (hostname === null) {\n return DISCARDED_TRACE_ATTRIBUTES;\n }\n const propagatorsForHost = getPropagatorsForHost(\n hostname,\n firstPartyHostsRegexMap\n );\n if (propagatorsForHost) {\n return generateTracingAttributesWithSampling(\n tracingSamplingRate,\n propagatorsForHost\n );\n }\n return DISCARDED_TRACE_ATTRIBUTES;\n};\n\nconst generateTracingAttributesWithSampling = (\n tracingSamplingRate: number,\n propagatorTypes: PropagatorType[]\n): DdRumResourceTracingAttributes => {\n const isSampled = Math.random() * 100 <= tracingSamplingRate;\n const tracingAttributes: DdRumResourceTracingAttributes = {\n traceId: new TraceIdentifier() as TraceId,\n spanId: new TraceIdentifier() as SpanId,\n samplingPriorityHeader: isSampled ? '1' : '0',\n tracingStrategy: 'KEEP',\n rulePsr: tracingSamplingRate / 100,\n propagatorTypes\n };\n\n return tracingAttributes;\n};\n\n/**\n * Using branded types will ensure we don't accidentally use\n * traceId for spanId when generating headers.\n */\nexport type TraceId = TraceIdentifier & {\n _brand: 'traceId';\n};\n\nexport type SpanId = TraceIdentifier & {\n _brand: 'spanId';\n};\n\n/*\n * This code was inspired from browser-sdk at (https://github.com/DataDog/browser-sdk/blob/0e9722d5b06f6d49264bc82cd254a207d647d66c/packages/rum-core/src/domain/tracing/tracer.ts#L190)\n */\nconst MAX_32_BITS_NUMBER = 4294967295; // 2^32-1\nconst MAX_31_BITS_NUMBER = 2147483647; // 2^31-1\nexport class TraceIdentifier {\n private low: number;\n private high: number;\n\n constructor() {\n // We need to have a 63 bits number max\n this.high = Math.floor(Math.random() * MAX_31_BITS_NUMBER);\n this.low = Math.floor(Math.random() * MAX_32_BITS_NUMBER);\n }\n\n toString = (radix: number) => {\n let low = this.low;\n let high = this.high;\n let str = '';\n\n while (high > 0 || low > 0) {\n const mod = (high % radix) * (MAX_32_BITS_NUMBER + 1) + low;\n high = Math.floor(high / radix);\n low = Math.floor(mod / radix);\n str = (mod % radix).toString(radix) + str;\n }\n return str;\n };\n\n /**\n * This function pads the trace with `0`.\n * It should not be used with a `length` lower than the trace, as we return the full trace in this case.\n * @param radix radix for the trace\n * @param length minimum length\n * @returns padded string\n */\n toPaddedString = (radix: number, length: number) => {\n const traceId = this.toString(radix);\n if (traceId.length > length) {\n return traceId;\n }\n return Array(length - traceId.length + 1).join('0') + traceId;\n };\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["ResourceReporter.ts"],"names":["DdRum","createTimings","ResourceReporter","constructor","resourceMappers","resource","modifiedResource","mapper","mappers","reportResource","formatResourceStartContext","tracingAttributes","samplingPriorityHeader","undefined","spanId","toString","traceId","rulePsr","formatResourceStopContext","timings","responseStartTime","startTime","stopTime","startResource","key","request","method","url","stopResource","response","statusCode","kind","size","resourceContext"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAEA,SAASA,KAAT,QAAsB,mBAAtB;AAGA,SAASC,aAAT,QAA8B,kBAA9B;AAIA,OAAO,MAAMC,gBAAN,CAAuB;AAG1BC,EAAAA,WAAW,CAACC,eAAD,EAAoC;AAAA;;AAAA,4CAI7BC,QAAD,IAA2B;AACxC,UAAIC,gBAAoC,GAAGD,QAA3C;;AAEA,WAAK,MAAME,MAAX,IAAqB,KAAKC,OAA1B,EAAmC;AAC/BF,QAAAA,gBAAgB,GAAGC,MAAM,CAACF,QAAD,CAAzB;;AACA,YAAIC,gBAAgB,KAAK,IAAzB,EAA+B;AAC3B;AACH;AACJ;;AAEDG,MAAAA,cAAc,CAACH,gBAAD,CAAd;AACH,KAf8C;;AAC3C,SAAKE,OAAL,GAAeJ,eAAf;AACH;;AALyB;;AAqB9B,MAAMM,0BAA0B,GAC5BC,iBAD+B,IAEe;AAC9C,SAAOA,iBAAiB,CAACC,sBAAlB,KAA6C,GAA7C,GACDC,SADC,GAED;AACI,mBAAeF,iBAAiB,CAACG,MAAlB,CAAyBC,QAAzB,CAAkC,EAAlC,CADnB;AAEI,oBAAgBJ,iBAAiB,CAACK,OAAlB,CAA0BD,QAA1B,CAAmC,EAAnC,CAFpB;AAGI,oBAAgBJ,iBAAiB,CAACM;AAHtC,GAFN;AAOH,CAVD;;AAYA,MAAMC,yBAAyB,GAC3BC,OAD8B,IAEJ;AAC1B,SAAO;AACH,4BACIA,OAAO,CAACC,iBAAR,KAA8BP,SAA9B,GACMZ,aAAa,CACTkB,OAAO,CAACE,SADC,EAETF,OAAO,CAACC,iBAFC,EAGTD,OAAO,CAACG,QAHC,CADnB,GAMM;AARP,GAAP;AAUH,CAbD;;AAeA,MAAMb,cAAc,GAAG,MAAOJ,QAAP,IAAiC;AACpD,QAAML,KAAK,CAACuB,aAAN,CACFlB,QAAQ,CAACmB,GADP,EAEFnB,QAAQ,CAACoB,OAAT,CAAiBC,MAFf,EAGFrB,QAAQ,CAACoB,OAAT,CAAiBE,GAHf,EAIFjB,0BAA0B,CAACL,QAAQ,CAACM,iBAAV,CAJxB,EAKFN,QAAQ,CAACc,OAAT,CAAiBE,SALf,CAAN;AAQArB,EAAAA,KAAK,CAAC4B,YAAN,CACIvB,QAAQ,CAACmB,GADb,EAEInB,QAAQ,CAACwB,QAAT,CAAkBC,UAFtB,EAGIzB,QAAQ,CAACoB,OAAT,CAAiBM,IAHrB,EAII1B,QAAQ,CAACwB,QAAT,CAAkBG,IAJtB,EAKId,yBAAyB,CAACb,QAAQ,CAACc,OAAV,CAL7B,EAMId,QAAQ,CAACc,OAAT,CAAiBG,QANrB,EAOIjB,QAAQ,CAAC4B,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"]}
|