@datadog/mobile-react-native 1.4.0 → 1.5.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 +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 +55 -7
- 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 +1 -1
- 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/nativeModulesTypes.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/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 +1 -1
- 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/nativeModulesTypes.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/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/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/types.d.ts +2 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +76 -76
- package/src/DdSdkReactNative.tsx +1 -0
- package/src/DdSdkReactNativeConfiguration.tsx +8 -1
- package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +7 -2
- package/src/nativeModulesTypes.ts +6 -0
- 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/__tests__/initialization.test.tsx +1 -0
- package/src/types.tsx +1 -0
- package/src/version.ts +1 -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/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/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
|
@@ -126,6 +126,10 @@ export declare class DdSdkReactNativeConfiguration {
|
|
|
126
126
|
* Sets the preferred frequency for collecting mobile vitals.
|
|
127
127
|
*/
|
|
128
128
|
vitalsUpdateFrequency: VitalsUpdateFrequency;
|
|
129
|
+
/**
|
|
130
|
+
* Enables tracking of frustration signals (error taps). Defaults to `true`.
|
|
131
|
+
*/
|
|
132
|
+
trackFrustrations: boolean;
|
|
129
133
|
logEventMapper: LogEventMapper | null;
|
|
130
134
|
errorEventMapper: ErrorEventMapper | null;
|
|
131
135
|
resourceEventMapper: ResourceEventMapper | null;
|
|
@@ -191,6 +195,7 @@ export declare type PartialInitializationConfiguration = {
|
|
|
191
195
|
readonly nativeCrashReportEnabled?: boolean;
|
|
192
196
|
readonly telemetrySampleRate?: number;
|
|
193
197
|
readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;
|
|
198
|
+
readonly trackFrustrations?: boolean;
|
|
194
199
|
};
|
|
195
200
|
export declare const buildConfigurationFromPartialConfiguration: (features: AutoInstrumentationConfiguration, configuration: PartialInitializationConfiguration) => DdSdkReactNativeConfiguration;
|
|
196
201
|
export declare class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {
|
|
@@ -48,6 +48,11 @@ export declare type DdNativeSdkType = {
|
|
|
48
48
|
* @param kind error kind
|
|
49
49
|
*/
|
|
50
50
|
telemetryError(message: string, stack: string, kind: string): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Send webview telemetry logs
|
|
53
|
+
* @param message event description
|
|
54
|
+
*/
|
|
55
|
+
consumeWebviewEvent(message: string): Promise<void>;
|
|
51
56
|
};
|
|
52
57
|
/**
|
|
53
58
|
* The entry point to use Datadog's Logs feature.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PropagatorType } from '../../../types';
|
|
2
|
+
import type { RegexMap } from '../requestProxy/interfaces/RequestProxy';
|
|
2
3
|
import type { Hostname } from './firstPartyHosts';
|
|
3
|
-
import type { RegexMap } from './interfaces/RequestProxy';
|
|
4
4
|
export declare type DdRumResourceTracingAttributes = {
|
|
5
5
|
tracingStrategy: 'KEEP';
|
|
6
6
|
traceId: TraceId;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FirstPartyHost, PropagatorType } from '../../../types';
|
|
2
|
-
import type { RegexMap } from '
|
|
2
|
+
import type { RegexMap } from '../requestProxy/interfaces/RequestProxy';
|
|
3
3
|
export declare type Hostname = {
|
|
4
4
|
_type: 'Hostname';
|
|
5
5
|
} & string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RUMResource } from '../../
|
|
1
|
+
import type { RUMResource } from '../../interfaces/RumResource';
|
|
2
2
|
declare type ResourceMapper = (resource: RUMResource) => RUMResource | null;
|
|
3
3
|
export declare class ResourceReporter {
|
|
4
4
|
private mappers;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RequestProxyOptions } from '../
|
|
2
|
-
import { RequestProxy } from '../
|
|
1
|
+
import type { RequestProxyOptions } from '../interfaces/RequestProxy';
|
|
2
|
+
import { RequestProxy } from '../interfaces/RequestProxy';
|
|
3
3
|
import type { ResourceReporter } from './DatadogRumResource/ResourceReporter';
|
|
4
4
|
interface XHRProxyProviders {
|
|
5
5
|
xhrType: typeof XMLHttpRequest;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ResourceKind } from '../../../../types';
|
|
2
|
-
import type { DdRumResourceTracingAttributes } from '
|
|
2
|
+
import type { DdRumResourceTracingAttributes } from '../../distributedTracing/distributedTracing';
|
|
3
3
|
export interface RUMResource {
|
|
4
4
|
key: string;
|
|
5
5
|
request: {
|
|
@@ -14,13 +14,14 @@ export declare class DdSdkConfiguration {
|
|
|
14
14
|
readonly additionalConfig: object;
|
|
15
15
|
readonly telemetrySampleRate: number;
|
|
16
16
|
readonly vitalsUpdateFrequency: string;
|
|
17
|
+
readonly trackFrustrations: boolean;
|
|
17
18
|
readonly configurationForTelemetry: {
|
|
18
19
|
initializationType: string;
|
|
19
20
|
trackErrors: boolean;
|
|
20
21
|
trackInteractions: boolean;
|
|
21
22
|
trackNetworkRequests: boolean;
|
|
22
23
|
};
|
|
23
|
-
constructor(clientToken: string, env: string, applicationId: string, nativeCrashReportEnabled: boolean, nativeLongTaskThresholdMs: number, longTaskThresholdMs: number, sampleRate: number, site: string, trackingConsent: string, additionalConfig: object, telemetrySampleRate: number, vitalsUpdateFrequency: string, configurationForTelemetry: {
|
|
24
|
+
constructor(clientToken: string, env: string, applicationId: string, nativeCrashReportEnabled: boolean, nativeLongTaskThresholdMs: number, longTaskThresholdMs: number, sampleRate: number, site: string, trackingConsent: string, additionalConfig: object, telemetrySampleRate: number, vitalsUpdateFrequency: string, trackFrustrations: boolean, configurationForTelemetry: {
|
|
24
25
|
initializationType: string;
|
|
25
26
|
trackErrors: boolean;
|
|
26
27
|
trackInteractions: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.
|
|
1
|
+
export declare const version = "1.5.0";
|
package/package.json
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
],
|
|
11
|
-
"author": "Datadog (https://github.com/DataDog)",
|
|
12
|
-
"homepage": "https://github.com/DataDog/dd-sdk-reactnative#readme",
|
|
13
|
-
"repository": "https://github.com/DataDog/dd-sdk-reactnative",
|
|
14
|
-
"bugs": {
|
|
15
|
-
"url": "https://github.com/DataDog/dd-sdk-reactnative/issues"
|
|
16
|
-
},
|
|
17
|
-
"license": "Apache-2.0",
|
|
18
|
-
"main": "lib/commonjs/index",
|
|
19
|
-
"files": [
|
|
20
|
-
"src",
|
|
21
|
-
"lib",
|
|
22
|
-
"scripts",
|
|
23
|
-
"android/build.gradle",
|
|
24
|
-
"android/detekt.yml",
|
|
25
|
-
"android/gradle.properties",
|
|
26
|
-
"android/src",
|
|
27
|
-
"ios/Sources",
|
|
28
|
-
"ios/DdSdkReactNative.xcodeproj/project.xcworkspace/xcsharedata",
|
|
29
|
-
"ios/DdSdkReactNative.xcodeproj/project.xcworkspace/*.xcworkspacedata",
|
|
30
|
-
"ios/DdSdkReactNative.xcodeproj/*.pbxproj",
|
|
31
|
-
"jest",
|
|
32
|
-
"DatadogSDKReactNative.podspec",
|
|
33
|
-
"datadog-sourcemaps.gradle"
|
|
34
|
-
],
|
|
35
|
-
"types": "lib/typescript/index.d.ts",
|
|
36
|
-
"react-native": "src/index",
|
|
37
|
-
"source": "src",
|
|
38
|
-
"module": "lib/module/index",
|
|
39
|
-
"publishConfig": {
|
|
40
|
-
"access": "public"
|
|
41
|
-
},
|
|
42
|
-
"scripts": {
|
|
43
|
-
"test": "jest",
|
|
44
|
-
"lint": "eslint .",
|
|
45
|
-
"prepare": "rm -rf lib && yarn bob build",
|
|
46
|
-
"postinstall": "node scripts/replace-react-require.js # Use node to execute the script for Windows, see https://github.com/DataDog/dd-sdk-reactnative/issues/358"
|
|
47
|
-
},
|
|
48
|
-
"peerDependencies": {
|
|
49
|
-
"react": ">=16.13.1",
|
|
50
|
-
"react-native": ">=0.63.4 <1.0"
|
|
51
|
-
},
|
|
52
|
-
"devDependencies": {
|
|
53
|
-
"@testing-library/react-native": "7.0.2"
|
|
54
|
-
},
|
|
55
|
-
"jest": {
|
|
56
|
-
"preset": "react-native",
|
|
57
|
-
"modulePathIgnorePatterns": [
|
|
58
|
-
"<rootDir>/lib/"
|
|
2
|
+
"name": "@datadog/mobile-react-native",
|
|
3
|
+
"version": "1.5.0",
|
|
4
|
+
"description": "A client-side React Native module to interact with Datadog",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"datadog",
|
|
7
|
+
"react-native",
|
|
8
|
+
"ios",
|
|
9
|
+
"android"
|
|
59
10
|
],
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
11
|
+
"author": "Datadog (https://github.com/DataDog)",
|
|
12
|
+
"homepage": "https://github.com/DataDog/dd-sdk-reactnative#readme",
|
|
13
|
+
"repository": "https://github.com/DataDog/dd-sdk-reactnative",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/DataDog/dd-sdk-reactnative/issues"
|
|
16
|
+
},
|
|
17
|
+
"license": "Apache-2.0",
|
|
18
|
+
"main": "lib/commonjs/index",
|
|
19
|
+
"files": [
|
|
20
|
+
"src",
|
|
21
|
+
"lib",
|
|
22
|
+
"scripts",
|
|
23
|
+
"android/build.gradle",
|
|
24
|
+
"android/detekt.yml",
|
|
25
|
+
"android/gradle.properties",
|
|
26
|
+
"android/src",
|
|
27
|
+
"ios/Sources",
|
|
28
|
+
"ios/DdSdkReactNative.xcodeproj/project.xcworkspace/xcsharedata",
|
|
29
|
+
"ios/DdSdkReactNative.xcodeproj/project.xcworkspace/*.xcworkspacedata",
|
|
30
|
+
"ios/DdSdkReactNative.xcodeproj/*.pbxproj",
|
|
31
|
+
"jest",
|
|
32
|
+
"DatadogSDKReactNative.podspec",
|
|
33
|
+
"datadog-sourcemaps.gradle"
|
|
63
34
|
],
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
"react-native-builder-bob": {
|
|
35
|
+
"types": "lib/typescript/index.d.ts",
|
|
36
|
+
"react-native": "src/index",
|
|
67
37
|
"source": "src",
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
38
|
+
"module": "lib/module/index",
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"test": "jest",
|
|
44
|
+
"lint": "eslint .",
|
|
45
|
+
"prepare": "rm -rf lib && yarn bob build",
|
|
46
|
+
"postinstall": "node scripts/replace-react-require.js # Use node to execute the script for Windows, see https://github.com/DataDog/dd-sdk-reactnative/issues/358"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"react": ">=16.13.1",
|
|
50
|
+
"react-native": ">=0.63.4 <1.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@testing-library/react-native": "7.0.2"
|
|
54
|
+
},
|
|
55
|
+
"jest": {
|
|
56
|
+
"preset": "react-native",
|
|
57
|
+
"modulePathIgnorePatterns": [
|
|
58
|
+
"<rootDir>/lib/"
|
|
59
|
+
],
|
|
60
|
+
"setupFiles": [
|
|
61
|
+
"./../../node_modules/react-native-gesture-handler/jestSetup.js",
|
|
62
|
+
"./../../jest.setup.js"
|
|
63
|
+
],
|
|
64
|
+
"transformIgnorePatterns": []
|
|
65
|
+
},
|
|
66
|
+
"react-native-builder-bob": {
|
|
67
|
+
"source": "src",
|
|
68
|
+
"output": "lib",
|
|
69
|
+
"targets": [
|
|
70
|
+
"commonjs",
|
|
71
|
+
"module",
|
|
72
|
+
[
|
|
73
|
+
"typescript",
|
|
74
|
+
{
|
|
75
|
+
"tsc": "./../../node_modules/.bin/tsc"
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
"gitHead": "04d48f34c3fe6f2d793cf4157eff5314253afd87"
|
|
81
81
|
}
|
package/src/DdSdkReactNative.tsx
CHANGED
|
@@ -118,6 +118,7 @@ export class DdSdkReactNative {
|
|
|
118
118
|
configuration.additionalConfig,
|
|
119
119
|
configuration.telemetrySampleRate,
|
|
120
120
|
configuration.vitalsUpdateFrequency,
|
|
121
|
+
configuration.trackFrustrations,
|
|
121
122
|
{
|
|
122
123
|
initializationType: params.initializationModeForTelemetry,
|
|
123
124
|
trackErrors: configuration.trackErrors,
|
|
@@ -69,7 +69,8 @@ const DEFAULTS = {
|
|
|
69
69
|
logEventMapper: null,
|
|
70
70
|
errorEventMapper: null,
|
|
71
71
|
resourceEventMapper: null,
|
|
72
|
-
actionEventMapper: null
|
|
72
|
+
actionEventMapper: null,
|
|
73
|
+
trackFrustrations: true
|
|
73
74
|
};
|
|
74
75
|
|
|
75
76
|
/**
|
|
@@ -182,6 +183,11 @@ export class DdSdkReactNativeConfiguration {
|
|
|
182
183
|
public vitalsUpdateFrequency: VitalsUpdateFrequency =
|
|
183
184
|
DEFAULTS.vitalsUpdateFrequency;
|
|
184
185
|
|
|
186
|
+
/**
|
|
187
|
+
* Enables tracking of frustration signals (error taps). Defaults to `true`.
|
|
188
|
+
*/
|
|
189
|
+
public trackFrustrations: boolean = DEFAULTS.trackFrustrations;
|
|
190
|
+
|
|
185
191
|
public logEventMapper: LogEventMapper | null = DEFAULTS.logEventMapper;
|
|
186
192
|
|
|
187
193
|
public errorEventMapper: ErrorEventMapper | null =
|
|
@@ -293,6 +299,7 @@ export type PartialInitializationConfiguration = {
|
|
|
293
299
|
readonly nativeCrashReportEnabled?: boolean;
|
|
294
300
|
readonly telemetrySampleRate?: number;
|
|
295
301
|
readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;
|
|
302
|
+
readonly trackFrustrations?: boolean;
|
|
296
303
|
};
|
|
297
304
|
|
|
298
305
|
const setConfigurationAttribute = <
|
|
@@ -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",
|
|
@@ -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
|
/**
|
|
@@ -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;
|
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.0';
|
|
@@ -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,0BAA0D,GAAG;AAC/DC,EAAAA,sBAAsB,EAAE,GADuC;AAE/DC,EAAAA,eAAe,EAAE;AAF8C,CAAnE;;AAKO,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,GAAG,4CACvBH,QADuB,EAEvBC,uBAFuB,CAA3B;;AAIA,MAAIE,kBAAJ,EAAwB;AACpB,WAAOC,qCAAqC,CACxCF,mBADwC,EAExCC,kBAFwC,CAA5C;AAIH;;AACD,SAAOP,0BAAP;AACH,CAvBM;;;;AAyBP,MAAMQ,qCAAqC,GAAG,CAC1CF,mBAD0C,EAE1CG,eAF0C,KAGT;AACjC,QAAMC,SAAS,GAAGC,IAAI,CAACC,MAAL,KAAgB,GAAhB,IAAuBN,mBAAzC;AACA,QAAMO,iBAAiD,GAAG;AACtDC,IAAAA,OAAO,EAAE,IAAIC,eAAJ,EAD6C;AAEtDC,IAAAA,MAAM,EAAE,IAAID,eAAJ,EAF8C;AAGtDd,IAAAA,sBAAsB,EAAES,SAAS,GAAG,GAAH,GAAS,GAHY;AAItDR,IAAAA,eAAe,EAAE,MAJqC;AAKtDe,IAAAA,OAAO,EAAEX,mBAAmB,GAAG,GALuB;AAMtDG,IAAAA;AANsD,GAA1D;AASA,SAAOI,iBAAP;AACH,CAfD;AAiBA;AACA;AACA;AACA;;;AASA;AACA;AACA;AACA,MAAMK,kBAAkB,GAAG,UAA3B,C,CAAuC;;AACvC,MAAMC,kBAAkB,GAAG,UAA3B,C,CAAuC;;AAChC,MAAMJ,eAAN,CAAsB;AAIzBK,EAAAA,WAAW,GAAG;AAAA;;AAAA;;AAAA,sCAMFC,KAAD,IAAmB;AAC1B,UAAIC,GAAG,GAAG,KAAKA,GAAf;AACA,UAAIC,IAAI,GAAG,KAAKA,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,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,EAFiC;AAG/CC,IAAAA,EAAE,EAAE,EAH2C;AAI/CC,IAAAA,OAAO,EAAE;AAJsC,GAAnD;AAOAL,EAAAA,eAAe,CAACM,OAAhB,CAAwBC,IAAI,IAAI;AAC5BA,IAAAA,IAAI,CAACC,eAAL,CAAqBF,OAArB,CAA6BG,cAAc,IAAI;AAC3CR,MAAAA,QAAQ,CAACQ,cAAD,CAAR,CAAyBC,IAAzB,CAA8BH,IAAI,CAACI,KAAnC;AACH,KAFD;AAGH,GAJD;AAMA,QAAMC,QAA6D,GAAG,EAAtE;AACAC,EAAAA,MAAM,CAACC,OAAP,CAAeb,QAAf,EAAyBK,OAAzB,CAAiC,CAAC,CAACG,cAAD,EAAiBM,KAAjB,CAAD,KAA6B;AAC1D,QAAIA,KAAK,CAACC,MAAN,GAAe,CAAnB,EAAsB;AAClBJ,MAAAA,QAAQ,CAACF,IAAT,CAAc;AACVD,QAAAA,cAAc,EAAEA,cADN;AAEVQ,QAAAA,KAAK,EAAEC,2BAA2B,CAACH,KAAD;AAFxB,OAAd;AAIH;AACJ,GAPD;AASA,SAAOH,QAAP;AACH,CA3BM;;;;AA6BP,MAAMM,2BAA2B,GAAIlB,eAAD,IAAuC;AACvE,MAAIA,eAAe,CAACgB,MAAhB,KAA2B,CAA/B,EAAkC;AAC9B,WAAOtB,cAAP;AACH;;AACD,MAAI;AACA;AACA;AACA,UAAMyB,oBAAoB,GAAG,IAAIxB,MAAJ,CACxB,aAAYK,eAAe,CACvBoB,GADQ,CACJb,IAAI,IAAK,GAAEX,YAAY,CAACW,IAAD,CAAO,GAD1B,EAERc,IAFQ,CAEH,GAFG,CAEE,GAHU,CAA7B;AAKAF,IAAAA,oBAAoB,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"]}
|