@datadog/mobile-react-native 1.3.1 → 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 +155 -92
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfiguration.kt +2 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdkConfigurationExt.kt +16 -0
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +293 -30
- package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +5 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/MapExt.kt +7 -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 +19 -2
- package/ios/Sources/DdSdkConfiguration.swift +6 -0
- package/ios/Sources/RNDdSdkConfiguration.swift +44 -0
- package/jest/mock.js +1 -1
- package/lib/commonjs/DdSdkReactNative.js +3 -3
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +34 -2
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nativeModulesTypes.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +5 -5
- package/lib/commonjs/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +101 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +136 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.js +39 -6
- package/lib/commonjs/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -0
- package/lib/commonjs/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/ResourceReporter.js +4 -4
- 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 +15 -24
- 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/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js.map +1 -0
- package/lib/commonjs/rum/types.js +19 -1
- package/lib/commonjs/rum/types.js.map +1 -1
- 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 +4 -4
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +30 -1
- package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/module/index.js +3 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeModulesTypes.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js +6 -6
- package/lib/module/rum/instrumentation/resourceTracking/DdRumResourceTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js +93 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js +115 -0
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.js +37 -3
- package/lib/module/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.js.map +1 -0
- package/lib/module/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/ResourceReporter.js +4 -4
- 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 +13 -18
- 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/rum/instrumentation/resourceTracking/requestProxy/interfaces/RequestProxy.js.map +1 -0
- package/lib/module/rum/types.js +16 -0
- package/lib/module/rum/types.js.map +1 -1
- 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 +16 -3
- package/lib/typescript/index.d.ts +3 -3
- package/lib/typescript/nativeModulesTypes.d.ts +5 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/DdRumResourceTracking.d.ts +2 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.d.ts +45 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.d.ts +21 -0
- package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts +8 -0
- 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 -7
- package/lib/typescript/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.d.ts +6 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.d.ts +1 -1
- package/lib/typescript/rum/types.d.ts +17 -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 +9 -4
- package/src/DdSdkReactNativeConfiguration.tsx +44 -4
- package/src/__tests__/DdSdkReactNative.test.tsx +16 -4
- package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +7 -2
- package/src/index.tsx +6 -3
- package/src/nativeModulesTypes.ts +6 -0
- package/src/rum/__tests__/DdRum.test.ts +17 -1
- package/src/rum/instrumentation/resourceTracking/DdRumResourceTracking.tsx +10 -7
- package/src/rum/instrumentation/resourceTracking/__tests__/DdRumResourceTracking.test.ts +13 -2
- package/src/rum/instrumentation/resourceTracking/distributedTracing/__tests__/distributedTracing.test.ts +71 -0
- package/src/rum/instrumentation/resourceTracking/distributedTracing/__tests__/firstPartyHosts.test.ts +34 -0
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracing.tsx +131 -0
- package/src/rum/instrumentation/resourceTracking/distributedTracing/distributedTracingHeaders.ts +141 -0
- package/src/rum/instrumentation/resourceTracking/{domain → distributedTracing}/firstPartyHosts.ts +42 -7
- package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/DatadogRumResource/ResourceReporter.ts +6 -6
- 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 +13 -28
- package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/__tests__/XHRProxy.test.ts +257 -79
- package/src/rum/instrumentation/resourceTracking/{implementation → requestProxy/XHRProxy}/responseSize.ts +2 -2
- package/src/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RequestProxy.ts +8 -1
- package/src/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.ts +1 -1
- package/src/rum/types.ts +19 -0
- package/src/sdk/DatadogProvider/__tests__/initialization.test.tsx +1 -0
- package/src/sdk/DatadogProvider/__tests__/initializationModes.test.tsx +1 -1
- package/src/types.tsx +1 -0
- package/src/version.ts +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/domain/distributedTracing.js +0 -83
- 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/domain/interfaces/RequestProxy.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 +0 -71
- package/lib/module/rum/instrumentation/resourceTracking/domain/distributedTracing.js.map +0 -1
- package/lib/module/rum/instrumentation/resourceTracking/domain/firstPartyHosts.js.map +0 -1
- package/lib/module/rum/instrumentation/resourceTracking/domain/interfaces/RequestProxy.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/rum/instrumentation/resourceTracking/domain/distributedTracing.d.ts +0 -19
- package/lib/typescript/rum/instrumentation/resourceTracking/domain/firstPartyHosts.d.ts +0 -6
- package/src/rum/instrumentation/resourceTracking/domain/__tests__/distributedTracing.test.ts +0 -31
- package/src/rum/instrumentation/resourceTracking/domain/__tests__/firstPartyHosts.test.ts +0 -22
- package/src/rum/instrumentation/resourceTracking/domain/distributedTracing.tsx +0 -89
- /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/RumResource.js +0 -0
- /package/lib/commonjs/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.js.map +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/RumResource.js +0 -0
- /package/lib/module/rum/instrumentation/resourceTracking/{domain → requestProxy}/interfaces/RumResource.js.map +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/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
|
@@ -5,12 +5,20 @@ import type { LogEventMapper } from './logs/types';
|
|
|
5
5
|
import type { ActionEventMapper } from './rum/eventMappers/actionEventMapper';
|
|
6
6
|
import type { ErrorEventMapper } from './rum/eventMappers/errorEventMapper';
|
|
7
7
|
import type { ResourceEventMapper } from './rum/eventMappers/resourceEventMapper';
|
|
8
|
+
import type { FirstPartyHost } from './rum/types';
|
|
8
9
|
export declare enum VitalsUpdateFrequency {
|
|
9
10
|
FREQUENT = "FREQUENT",
|
|
10
11
|
AVERAGE = "AVERAGE",
|
|
11
12
|
RARE = "RARE",
|
|
12
13
|
NEVER = "NEVER"
|
|
13
14
|
}
|
|
15
|
+
export declare type FirstPartyHostsConfiguration = (FirstPartyHost | LegacyFirstPartyHost)[];
|
|
16
|
+
export declare type LegacyFirstPartyHost = string;
|
|
17
|
+
/**
|
|
18
|
+
* Defaults legacy first party hosts format to Datadog first party hosts to keep
|
|
19
|
+
* retro-compatibility before OTel support was introduced.
|
|
20
|
+
*/
|
|
21
|
+
export declare const formatFirstPartyHosts: (firstPartyHosts: FirstPartyHostsConfiguration) => FirstPartyHost[];
|
|
14
22
|
/**
|
|
15
23
|
* The SDK configuration class.
|
|
16
24
|
* It will be used to configure the SDK functionality at initialization.
|
|
@@ -63,7 +71,7 @@ export declare class DdSdkReactNativeConfiguration {
|
|
|
63
71
|
*
|
|
64
72
|
* Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`.
|
|
65
73
|
*/
|
|
66
|
-
firstPartyHosts:
|
|
74
|
+
firstPartyHosts: FirstPartyHostsConfiguration;
|
|
67
75
|
/**
|
|
68
76
|
* Overrides the reported version of the app.
|
|
69
77
|
* Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.
|
|
@@ -118,6 +126,10 @@ export declare class DdSdkReactNativeConfiguration {
|
|
|
118
126
|
* Sets the preferred frequency for collecting mobile vitals.
|
|
119
127
|
*/
|
|
120
128
|
vitalsUpdateFrequency: VitalsUpdateFrequency;
|
|
129
|
+
/**
|
|
130
|
+
* Enables tracking of frustration signals (error taps). Defaults to `true`.
|
|
131
|
+
*/
|
|
132
|
+
trackFrustrations: boolean;
|
|
121
133
|
logEventMapper: LogEventMapper | null;
|
|
122
134
|
errorEventMapper: ErrorEventMapper | null;
|
|
123
135
|
resourceEventMapper: ResourceEventMapper | null;
|
|
@@ -134,7 +146,7 @@ export declare class DdSdkReactNativeConfiguration {
|
|
|
134
146
|
export declare type AutoInstrumentationConfiguration = {
|
|
135
147
|
readonly trackInteractions: boolean;
|
|
136
148
|
readonly trackResources: boolean;
|
|
137
|
-
readonly firstPartyHosts?:
|
|
149
|
+
readonly firstPartyHosts?: FirstPartyHostsConfiguration;
|
|
138
150
|
readonly resourceTracingSamplingRate?: number;
|
|
139
151
|
readonly trackErrors: boolean;
|
|
140
152
|
readonly logEventMapper?: LogEventMapper | null;
|
|
@@ -148,7 +160,7 @@ export declare type AutoInstrumentationConfiguration = {
|
|
|
148
160
|
export declare type AutoInstrumentationParameters = {
|
|
149
161
|
readonly trackInteractions: boolean;
|
|
150
162
|
readonly trackResources: boolean;
|
|
151
|
-
readonly firstPartyHosts:
|
|
163
|
+
readonly firstPartyHosts: FirstPartyHostsConfiguration;
|
|
152
164
|
readonly resourceTracingSamplingRate: number;
|
|
153
165
|
readonly trackErrors: boolean;
|
|
154
166
|
readonly logEventMapper: LogEventMapper | null;
|
|
@@ -183,6 +195,7 @@ export declare type PartialInitializationConfiguration = {
|
|
|
183
195
|
readonly nativeCrashReportEnabled?: boolean;
|
|
184
196
|
readonly telemetrySampleRate?: number;
|
|
185
197
|
readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;
|
|
198
|
+
readonly trackFrustrations?: boolean;
|
|
186
199
|
};
|
|
187
200
|
export declare const buildConfigurationFromPartialConfiguration: (features: AutoInstrumentationConfiguration, configuration: PartialInitializationConfiguration) => DdSdkReactNativeConfiguration;
|
|
188
201
|
export declare class DatadogProviderConfiguration extends DdSdkReactNativeConfiguration {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DatadogProviderConfiguration, DdSdkReactNativeConfiguration, InitializationMode } from './DdSdkReactNativeConfiguration';
|
|
1
|
+
import { DatadogProviderConfiguration, DdSdkReactNativeConfiguration, InitializationMode, VitalsUpdateFrequency } from './DdSdkReactNativeConfiguration';
|
|
2
2
|
import { DdSdkReactNative } from './DdSdkReactNative';
|
|
3
3
|
import { InternalLog } from './InternalLog';
|
|
4
4
|
import { ProxyConfiguration, ProxyType } from './ProxyConfiguration';
|
|
@@ -7,6 +7,6 @@ import { TrackingConsent } from './TrackingConsent';
|
|
|
7
7
|
import { DdTrace } from './foundation';
|
|
8
8
|
import { DdLogs } from './logs/DdLogs';
|
|
9
9
|
import { DdRum } from './rum/DdRum';
|
|
10
|
-
import { RumActionType, ErrorSource } from './rum/types';
|
|
10
|
+
import { RumActionType, ErrorSource, PropagatorType } from './rum/types';
|
|
11
11
|
import { DatadogProvider } from './sdk/DatadogProvider/DatadogProvider';
|
|
12
|
-
export { DatadogProvider, DatadogProviderConfiguration, InitializationMode, DdLogs, DdTrace, DdRum, RumActionType, ErrorSource, DdSdkReactNativeConfiguration, DdSdkReactNative, InternalLog, ProxyConfiguration, ProxyType, TrackingConsent, SdkVerbosity };
|
|
12
|
+
export { DatadogProvider, DatadogProviderConfiguration, InitializationMode, DdLogs, DdTrace, DdRum, RumActionType, ErrorSource, DdSdkReactNativeConfiguration, DdSdkReactNative, InternalLog, ProxyConfiguration, ProxyType, TrackingConsent, SdkVerbosity, VitalsUpdateFrequency, PropagatorType };
|
|
@@ -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,3 +1,4 @@
|
|
|
1
|
+
import type { FirstPartyHost } from '../../types';
|
|
1
2
|
/**
|
|
2
3
|
* Provides RUM auto-instrumentation feature to track resources (fetch, XHR, axios) as RUM events.
|
|
3
4
|
*/
|
|
@@ -9,7 +10,7 @@ export declare class DdRumResourceTracking {
|
|
|
9
10
|
*/
|
|
10
11
|
static startTracking({ tracingSamplingRate, firstPartyHosts }: {
|
|
11
12
|
tracingSamplingRate: number;
|
|
12
|
-
firstPartyHosts:
|
|
13
|
+
firstPartyHosts: FirstPartyHost[];
|
|
13
14
|
}): void;
|
|
14
15
|
static stopTracking(): void;
|
|
15
16
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { PropagatorType } from '../../../types';
|
|
2
|
+
import type { RegexMap } from '../requestProxy/interfaces/RequestProxy';
|
|
3
|
+
import type { Hostname } from './firstPartyHosts';
|
|
4
|
+
export declare type DdRumResourceTracingAttributes = {
|
|
5
|
+
tracingStrategy: 'KEEP';
|
|
6
|
+
traceId: TraceId;
|
|
7
|
+
spanId: SpanId;
|
|
8
|
+
samplingPriorityHeader: '1' | '0';
|
|
9
|
+
rulePsr: number;
|
|
10
|
+
propagatorTypes: PropagatorType[];
|
|
11
|
+
} | {
|
|
12
|
+
tracingStrategy: 'DISCARD';
|
|
13
|
+
traceId?: void;
|
|
14
|
+
spanId?: void;
|
|
15
|
+
samplingPriorityHeader: '0';
|
|
16
|
+
};
|
|
17
|
+
export declare const getTracingAttributes: ({ hostname, firstPartyHostsRegexMap, tracingSamplingRate }: {
|
|
18
|
+
hostname: Hostname | null;
|
|
19
|
+
firstPartyHostsRegexMap: RegexMap;
|
|
20
|
+
tracingSamplingRate: number;
|
|
21
|
+
}) => DdRumResourceTracingAttributes;
|
|
22
|
+
/**
|
|
23
|
+
* Using branded types will ensure we don't accidentally use
|
|
24
|
+
* traceId for spanId when generating headers.
|
|
25
|
+
*/
|
|
26
|
+
export declare type TraceId = TraceIdentifier & {
|
|
27
|
+
_brand: 'traceId';
|
|
28
|
+
};
|
|
29
|
+
export declare type SpanId = TraceIdentifier & {
|
|
30
|
+
_brand: 'spanId';
|
|
31
|
+
};
|
|
32
|
+
export declare class TraceIdentifier {
|
|
33
|
+
private low;
|
|
34
|
+
private high;
|
|
35
|
+
constructor();
|
|
36
|
+
toString: (radix: number) => string;
|
|
37
|
+
/**
|
|
38
|
+
* This function pads the trace with `0`.
|
|
39
|
+
* It should not be used with a `length` lower than the trace, as we return the full trace in this case.
|
|
40
|
+
* @param radix radix for the trace
|
|
41
|
+
* @param length minimum length
|
|
42
|
+
* @returns padded string
|
|
43
|
+
*/
|
|
44
|
+
toPaddedString: (radix: number, length: number) => string;
|
|
45
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { DdRumResourceTracingAttributes } from './distributedTracing';
|
|
2
|
+
export declare const SAMPLING_PRIORITY_HEADER_KEY = "x-datadog-sampling-priority";
|
|
3
|
+
/**
|
|
4
|
+
* Datadog headers
|
|
5
|
+
*/
|
|
6
|
+
export declare const ORIGIN_HEADER_KEY = "x-datadog-origin";
|
|
7
|
+
export declare const ORIGIN_RUM = "rum";
|
|
8
|
+
export declare const TRACE_ID_HEADER_KEY = "x-datadog-trace-id";
|
|
9
|
+
export declare const PARENT_ID_HEADER_KEY = "x-datadog-parent-id";
|
|
10
|
+
/**
|
|
11
|
+
* OTel headers
|
|
12
|
+
*/
|
|
13
|
+
export declare const TRACECONTEXT_HEADER_KEY = "traceparent";
|
|
14
|
+
export declare const B3_HEADER_KEY = "b3";
|
|
15
|
+
export declare const B3_MULTI_TRACE_ID_HEADER_KEY = "X-B3-TraceId";
|
|
16
|
+
export declare const B3_MULTI_SPAN_ID_HEADER_KEY = "X-B3-SpanId";
|
|
17
|
+
export declare const B3_MULTI_SAMPLED_HEADER_KEY = "X-B3-Sampled";
|
|
18
|
+
export declare const getTracingHeaders: (tracingAttributes: DdRumResourceTracingAttributes) => {
|
|
19
|
+
header: string;
|
|
20
|
+
value: string;
|
|
21
|
+
}[];
|
package/lib/typescript/rum/instrumentation/resourceTracking/distributedTracing/firstPartyHosts.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FirstPartyHost, PropagatorType } from '../../../types';
|
|
2
|
+
import type { RegexMap } from '../requestProxy/interfaces/RequestProxy';
|
|
3
|
+
export declare type Hostname = {
|
|
4
|
+
_type: 'Hostname';
|
|
5
|
+
} & string;
|
|
6
|
+
export declare const NO_MATCH_REGEX: RegExp;
|
|
7
|
+
export declare const firstPartyHostsRegexMapBuilder: (firstPartyHosts: FirstPartyHost[]) => RegexMap;
|
|
8
|
+
export declare const getPropagatorsForHost: (hostname: Hostname, firstPartyHostsRegexMap: RegexMap) => PropagatorType[] | null;
|
|
@@ -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,11 +1,6 @@
|
|
|
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
|
-
export declare const TRACE_ID_HEADER_KEY = "x-datadog-trace-id";
|
|
5
|
-
export declare const PARENT_ID_HEADER_KEY = "x-datadog-parent-id";
|
|
6
|
-
export declare const ORIGIN_HEADER_KEY = "x-datadog-origin";
|
|
7
|
-
export declare const SAMPLING_PRIORITY_HEADER_KEY = "x-datadog-sampling-priority";
|
|
8
|
-
export declare const ORIGIN_RUM = "rum";
|
|
9
4
|
interface XHRProxyProviders {
|
|
10
5
|
xhrType: typeof XMLHttpRequest;
|
|
11
6
|
resourceReporter: ResourceReporter;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import type { PropagatorType } from '../../../../types';
|
|
1
2
|
export interface RequestProxyOptions {
|
|
2
3
|
tracingSamplingRate: number;
|
|
3
|
-
|
|
4
|
+
firstPartyHostsRegexMap: RegexMap;
|
|
4
5
|
}
|
|
6
|
+
export declare type RegexMap = {
|
|
7
|
+
regex: RegExp;
|
|
8
|
+
propagatorType: PropagatorType;
|
|
9
|
+
}[];
|
|
5
10
|
export declare abstract class RequestProxy {
|
|
6
11
|
abstract onTrackingStart: (context: RequestProxyOptions) => void;
|
|
7
12
|
abstract onTrackingStop: () => void;
|
|
@@ -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: {
|
|
@@ -108,3 +108,20 @@ export declare enum ErrorSource {
|
|
|
108
108
|
WEBVIEW = "WEBVIEW",
|
|
109
109
|
CUSTOM = "CUSTOM"
|
|
110
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Type of instrumentation on the host.
|
|
113
|
+
* - DATADOG: Datadog’s propagator (`x-datadog-*`)
|
|
114
|
+
* - TRACECONTEXT: W3C Trace Context (`traceparent`)
|
|
115
|
+
* - B3: B3 single header (`b3`)
|
|
116
|
+
* - B3MULTI: B3 multiple headers (`X-B3-*`)
|
|
117
|
+
*/
|
|
118
|
+
export declare enum PropagatorType {
|
|
119
|
+
DATADOG = "datadog",
|
|
120
|
+
TRACECONTEXT = "tracecontext",
|
|
121
|
+
B3 = "b3",
|
|
122
|
+
B3MULTI = "b3multi"
|
|
123
|
+
}
|
|
124
|
+
export declare type FirstPartyHost = {
|
|
125
|
+
match: string;
|
|
126
|
+
propagatorTypes: PropagatorType[];
|
|
127
|
+
};
|
|
@@ -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
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
DdSdkReactNativeConfiguration,
|
|
11
11
|
buildConfigurationFromPartialConfiguration,
|
|
12
12
|
addDefaultValuesToAutoInstrumentationConfiguration,
|
|
13
|
-
InitializationMode
|
|
13
|
+
InitializationMode,
|
|
14
|
+
formatFirstPartyHosts
|
|
14
15
|
} from './DdSdkReactNativeConfiguration';
|
|
15
16
|
import type {
|
|
16
17
|
AutoInstrumentationParameters,
|
|
@@ -117,6 +118,7 @@ export class DdSdkReactNative {
|
|
|
117
118
|
configuration.additionalConfig,
|
|
118
119
|
configuration.telemetrySampleRate,
|
|
119
120
|
configuration.vitalsUpdateFrequency,
|
|
121
|
+
configuration.trackFrustrations,
|
|
120
122
|
{
|
|
121
123
|
initializationType: params.initializationModeForTelemetry,
|
|
122
124
|
trackErrors: configuration.trackErrors,
|
|
@@ -301,8 +303,9 @@ export class DdSdkReactNative {
|
|
|
301
303
|
] = `-${configuration.versionSuffix}`;
|
|
302
304
|
}
|
|
303
305
|
|
|
304
|
-
configuration.additionalConfig[
|
|
305
|
-
|
|
306
|
+
configuration.additionalConfig[
|
|
307
|
+
'_dd.first_party_hosts'
|
|
308
|
+
] = formatFirstPartyHosts(configuration.firstPartyHosts);
|
|
306
309
|
};
|
|
307
310
|
|
|
308
311
|
private static enableFeatures(
|
|
@@ -322,7 +325,9 @@ export class DdSdkReactNative {
|
|
|
322
325
|
if (configuration.trackResources) {
|
|
323
326
|
DdRumResourceTracking.startTracking({
|
|
324
327
|
tracingSamplingRate: configuration.resourceTracingSamplingRate,
|
|
325
|
-
firstPartyHosts:
|
|
328
|
+
firstPartyHosts: formatFirstPartyHosts(
|
|
329
|
+
configuration.firstPartyHosts
|
|
330
|
+
)
|
|
326
331
|
});
|
|
327
332
|
}
|
|
328
333
|
|
|
@@ -11,6 +11,8 @@ import type { LogEventMapper } from './logs/types';
|
|
|
11
11
|
import type { ActionEventMapper } from './rum/eventMappers/actionEventMapper';
|
|
12
12
|
import type { ErrorEventMapper } from './rum/eventMappers/errorEventMapper';
|
|
13
13
|
import type { ResourceEventMapper } from './rum/eventMappers/resourceEventMapper';
|
|
14
|
+
import type { FirstPartyHost } from './rum/types';
|
|
15
|
+
import { PropagatorType } from './rum/types';
|
|
14
16
|
|
|
15
17
|
export enum VitalsUpdateFrequency {
|
|
16
18
|
FREQUENT = 'FREQUENT',
|
|
@@ -19,6 +21,37 @@ export enum VitalsUpdateFrequency {
|
|
|
19
21
|
NEVER = 'NEVER'
|
|
20
22
|
}
|
|
21
23
|
|
|
24
|
+
export type FirstPartyHostsConfiguration = (
|
|
25
|
+
| FirstPartyHost
|
|
26
|
+
| LegacyFirstPartyHost
|
|
27
|
+
)[];
|
|
28
|
+
|
|
29
|
+
export type LegacyFirstPartyHost = string;
|
|
30
|
+
|
|
31
|
+
const isLegacyFirstPartyHost = (
|
|
32
|
+
firstPartyHost: FirstPartyHost | LegacyFirstPartyHost
|
|
33
|
+
): firstPartyHost is LegacyFirstPartyHost => {
|
|
34
|
+
return typeof firstPartyHost === 'string';
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Defaults legacy first party hosts format to Datadog first party hosts to keep
|
|
39
|
+
* retro-compatibility before OTel support was introduced.
|
|
40
|
+
*/
|
|
41
|
+
export const formatFirstPartyHosts = (
|
|
42
|
+
firstPartyHosts: FirstPartyHostsConfiguration
|
|
43
|
+
): FirstPartyHost[] => {
|
|
44
|
+
return firstPartyHosts.map(host => {
|
|
45
|
+
if (isLegacyFirstPartyHost(host)) {
|
|
46
|
+
return {
|
|
47
|
+
match: host,
|
|
48
|
+
propagatorTypes: [PropagatorType.DATADOG]
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return host;
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
|
|
22
55
|
const DEFAULTS = {
|
|
23
56
|
nativeCrashReportEnabled: false,
|
|
24
57
|
sessionSamplingRate: 100.0,
|
|
@@ -36,7 +69,8 @@ const DEFAULTS = {
|
|
|
36
69
|
logEventMapper: null,
|
|
37
70
|
errorEventMapper: null,
|
|
38
71
|
resourceEventMapper: null,
|
|
39
|
-
actionEventMapper: null
|
|
72
|
+
actionEventMapper: null,
|
|
73
|
+
trackFrustrations: true
|
|
40
74
|
};
|
|
41
75
|
|
|
42
76
|
/**
|
|
@@ -87,7 +121,7 @@ export class DdSdkReactNativeConfiguration {
|
|
|
87
121
|
*
|
|
88
122
|
* Matches domains and subdomains, e.g. `['example.com']` matches `example.com` and `api.example.com`.
|
|
89
123
|
*/
|
|
90
|
-
public firstPartyHosts:
|
|
124
|
+
public firstPartyHosts: FirstPartyHostsConfiguration = DEFAULTS.getFirstPartyHosts();
|
|
91
125
|
/**
|
|
92
126
|
* Overrides the reported version of the app.
|
|
93
127
|
* Accepted characters are alphanumerics and `_`, `-`, `:`, `.`, `/`.
|
|
@@ -149,6 +183,11 @@ export class DdSdkReactNativeConfiguration {
|
|
|
149
183
|
public vitalsUpdateFrequency: VitalsUpdateFrequency =
|
|
150
184
|
DEFAULTS.vitalsUpdateFrequency;
|
|
151
185
|
|
|
186
|
+
/**
|
|
187
|
+
* Enables tracking of frustration signals (error taps). Defaults to `true`.
|
|
188
|
+
*/
|
|
189
|
+
public trackFrustrations: boolean = DEFAULTS.trackFrustrations;
|
|
190
|
+
|
|
152
191
|
public logEventMapper: LogEventMapper | null = DEFAULTS.logEventMapper;
|
|
153
192
|
|
|
154
193
|
public errorEventMapper: ErrorEventMapper | null =
|
|
@@ -182,7 +221,7 @@ export class DdSdkReactNativeConfiguration {
|
|
|
182
221
|
export type AutoInstrumentationConfiguration = {
|
|
183
222
|
readonly trackInteractions: boolean;
|
|
184
223
|
readonly trackResources: boolean;
|
|
185
|
-
readonly firstPartyHosts?:
|
|
224
|
+
readonly firstPartyHosts?: FirstPartyHostsConfiguration;
|
|
186
225
|
readonly resourceTracingSamplingRate?: number;
|
|
187
226
|
readonly trackErrors: boolean;
|
|
188
227
|
readonly logEventMapper?: LogEventMapper | null;
|
|
@@ -197,7 +236,7 @@ export type AutoInstrumentationConfiguration = {
|
|
|
197
236
|
export type AutoInstrumentationParameters = {
|
|
198
237
|
readonly trackInteractions: boolean;
|
|
199
238
|
readonly trackResources: boolean;
|
|
200
|
-
readonly firstPartyHosts:
|
|
239
|
+
readonly firstPartyHosts: FirstPartyHostsConfiguration;
|
|
201
240
|
readonly resourceTracingSamplingRate: number;
|
|
202
241
|
readonly trackErrors: boolean;
|
|
203
242
|
readonly logEventMapper: LogEventMapper | null;
|
|
@@ -260,6 +299,7 @@ export type PartialInitializationConfiguration = {
|
|
|
260
299
|
readonly nativeCrashReportEnabled?: boolean;
|
|
261
300
|
readonly telemetrySampleRate?: number;
|
|
262
301
|
readonly vitalsUpdateFrequency?: VitalsUpdateFrequency;
|
|
302
|
+
readonly trackFrustrations?: boolean;
|
|
263
303
|
};
|
|
264
304
|
|
|
265
305
|
const setConfigurationAttribute = <
|
|
@@ -17,7 +17,7 @@ import { DdRum } from '../rum/DdRum';
|
|
|
17
17
|
import { DdRumErrorTracking } from '../rum/instrumentation/DdRumErrorTracking';
|
|
18
18
|
import { DdRumUserInteractionTracking } from '../rum/instrumentation/interactionTracking/DdRumUserInteractionTracking';
|
|
19
19
|
import { DdRumResourceTracking } from '../rum/instrumentation/resourceTracking/DdRumResourceTracking';
|
|
20
|
-
import { ErrorSource, RumActionType } from '../rum/types';
|
|
20
|
+
import { ErrorSource, PropagatorType, RumActionType } from '../rum/types';
|
|
21
21
|
import { AttributesSingleton } from '../sdk/AttributesSingleton/AttributesSingleton';
|
|
22
22
|
import { UserInfoSingleton } from '../sdk/UserInfoSingleton/UserInfoSingleton';
|
|
23
23
|
import type { DdSdkConfiguration } from '../types';
|
|
@@ -488,7 +488,13 @@ describe('DdSdkReactNative', () => {
|
|
|
488
488
|
true
|
|
489
489
|
);
|
|
490
490
|
configuration.resourceTracingSamplingRate = 42;
|
|
491
|
-
configuration.firstPartyHosts = [
|
|
491
|
+
configuration.firstPartyHosts = [
|
|
492
|
+
'api.example.com',
|
|
493
|
+
{
|
|
494
|
+
match: 'something.fr',
|
|
495
|
+
propagatorTypes: [PropagatorType.DATADOG]
|
|
496
|
+
}
|
|
497
|
+
];
|
|
492
498
|
|
|
493
499
|
NativeModules.DdSdk.initialize.mockResolvedValue(null);
|
|
494
500
|
|
|
@@ -507,14 +513,20 @@ describe('DdSdkReactNative', () => {
|
|
|
507
513
|
'_dd.sdk_version': sdkVersion,
|
|
508
514
|
'_dd.native_view_tracking': false,
|
|
509
515
|
'_dd.native_interaction_tracking': false,
|
|
510
|
-
'_dd.first_party_hosts': [
|
|
516
|
+
'_dd.first_party_hosts': [
|
|
517
|
+
{ match: 'api.example.com', propagatorTypes: ['datadog'] },
|
|
518
|
+
{ match: 'something.fr', propagatorTypes: ['datadog'] }
|
|
519
|
+
]
|
|
511
520
|
});
|
|
512
521
|
expect(DdRumResourceTracking.startTracking).toHaveBeenCalledTimes(
|
|
513
522
|
1
|
|
514
523
|
);
|
|
515
524
|
expect(DdRumResourceTracking.startTracking).toHaveBeenCalledWith({
|
|
516
525
|
tracingSamplingRate: 42,
|
|
517
|
-
firstPartyHosts: [
|
|
526
|
+
firstPartyHosts: [
|
|
527
|
+
{ match: 'api.example.com', propagatorTypes: ['datadog'] },
|
|
528
|
+
{ match: 'something.fr', propagatorTypes: ['datadog'] }
|
|
529
|
+
]
|
|
518
530
|
});
|
|
519
531
|
});
|
|
520
532
|
|