@datadog/mobile-react-native 1.1.3 → 1.2.0-beta1
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/README.md +18 -14
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogSDKWrapper.kt +8 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DatadogWrapper.kt +10 -0
- package/android/src/main/kotlin/com/datadog/reactnative/DdSdk.kt +25 -0
- 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 +52 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/DdSdkConfigurationExt.kt +7 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/DdSdkConfigurationForgeryFactory.kt +1 -0
- package/ios/Sources/DdSdk.m +10 -0
- package/ios/Sources/DdSdk.swift +17 -0
- package/ios/Sources/DdSdkConfiguration.swift +4 -0
- package/ios/Sources/RNDdSdkConfiguration.swift +2 -0
- package/lib/commonjs/DatadogProvider/Buffer/BoundedBuffer.js +173 -0
- package/lib/commonjs/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -0
- package/lib/commonjs/DatadogProvider/Buffer/BufferSingleton.js +32 -0
- package/lib/commonjs/DatadogProvider/Buffer/BufferSingleton.js.map +1 -0
- package/lib/commonjs/DatadogProvider/Buffer/DatadogBuffer.js +29 -0
- package/lib/commonjs/DatadogProvider/Buffer/DatadogBuffer.js.map +1 -0
- package/lib/commonjs/DatadogProvider/Buffer/PassThroughBuffer.js +28 -0
- package/lib/commonjs/DatadogProvider/Buffer/PassThroughBuffer.js.map +1 -0
- package/lib/commonjs/DatadogProvider/Buffer/bufferNativeCall.js +32 -0
- package/lib/commonjs/DatadogProvider/Buffer/bufferNativeCall.js.map +1 -0
- package/lib/commonjs/DatadogProvider/DatadogProvider.js +101 -0
- package/lib/commonjs/DatadogProvider/DatadogProvider.js.map +1 -0
- package/lib/commonjs/DdSdkReactNative.js +138 -56
- package/lib/commonjs/DdSdkReactNative.js.map +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +102 -9
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/commonjs/errorUtils.js +60 -0
- package/lib/commonjs/errorUtils.js.map +1 -0
- package/lib/commonjs/foundation.js +19 -12
- package/lib/commonjs/foundation.js.map +1 -1
- package/lib/commonjs/index.js +20 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nativeModulesTypes.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js +8 -45
- package/lib/commonjs/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/DdRumUserInteractionTracking.js +19 -9
- package/lib/commonjs/rum/instrumentation/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/getJsxRuntime.js +55 -0
- package/lib/commonjs/rum/instrumentation/getJsxRuntime.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/DatadogProvider/Buffer/BoundedBuffer.js +163 -0
- package/lib/module/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -0
- package/lib/module/DatadogProvider/Buffer/BufferSingleton.js +26 -0
- package/lib/module/DatadogProvider/Buffer/BufferSingleton.js.map +1 -0
- package/lib/module/DatadogProvider/Buffer/DatadogBuffer.js +20 -0
- package/lib/module/DatadogProvider/Buffer/DatadogBuffer.js.map +1 -0
- package/lib/module/DatadogProvider/Buffer/PassThroughBuffer.js +23 -0
- package/lib/module/DatadogProvider/Buffer/PassThroughBuffer.js.map +1 -0
- package/lib/module/DatadogProvider/Buffer/bufferNativeCall.js +16 -0
- package/lib/module/DatadogProvider/Buffer/bufferNativeCall.js.map +1 -0
- package/lib/module/DatadogProvider/DatadogProvider.js +82 -0
- package/lib/module/DatadogProvider/DatadogProvider.js.map +1 -0
- package/lib/module/DdSdkReactNative.js +130 -54
- package/lib/module/DdSdkReactNative.js.map +1 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +91 -8
- package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/module/errorUtils.js +45 -0
- package/lib/module/errorUtils.js.map +1 -0
- package/lib/module/foundation.js +18 -12
- package/lib/module/foundation.js.map +1 -1
- package/lib/module/index.js +3 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeModulesTypes.js.map +1 -1
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js +5 -42
- package/lib/module/rum/instrumentation/DdRumErrorTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/DdRumUserInteractionTracking.js +16 -9
- package/lib/module/rum/instrumentation/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/getJsxRuntime.js +45 -0
- package/lib/module/rum/instrumentation/getJsxRuntime.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/DatadogProvider/Buffer/BoundedBuffer.d.ts +15 -0
- package/lib/typescript/DatadogProvider/Buffer/BufferSingleton.d.ts +7 -0
- package/lib/typescript/DatadogProvider/Buffer/DatadogBuffer.d.ts +20 -0
- package/lib/typescript/DatadogProvider/Buffer/PassThroughBuffer.d.ts +7 -0
- package/lib/typescript/DatadogProvider/Buffer/bufferNativeCall.d.ts +3 -0
- package/lib/typescript/DatadogProvider/DatadogProvider.d.ts +26 -0
- package/lib/typescript/DdSdkReactNative.d.ts +23 -1
- package/lib/typescript/DdSdkReactNativeConfiguration.d.ts +63 -0
- package/lib/typescript/errorUtils.d.ts +4 -0
- package/lib/typescript/index.d.ts +3 -2
- package/lib/typescript/nativeModulesTypes.d.ts +12 -0
- package/lib/typescript/rum/instrumentation/DdRumErrorTracking.d.ts +0 -2
- package/lib/typescript/rum/instrumentation/DdRumUserInteractionTracking.d.ts +3 -0
- package/lib/typescript/rum/instrumentation/getJsxRuntime.d.ts +1 -0
- package/lib/typescript/types.d.ts +2 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/DatadogProvider/Buffer/BoundedBuffer.ts +209 -0
- package/src/DatadogProvider/Buffer/BufferSingleton.ts +26 -0
- package/src/DatadogProvider/Buffer/DatadogBuffer.ts +34 -0
- package/src/DatadogProvider/Buffer/PassThroughBuffer.ts +16 -0
- package/src/DatadogProvider/Buffer/__tests__/BoundedBuffer.test.ts +202 -0
- package/src/DatadogProvider/Buffer/__tests__/BufferSingleton.test.ts +50 -0
- package/src/DatadogProvider/Buffer/bufferNativeCall.ts +24 -0
- package/src/DatadogProvider/DatadogProvider.tsx +122 -0
- package/src/DatadogProvider/__tests__/__utils__/renderWithProvider.tsx +111 -0
- package/src/DatadogProvider/__tests__/initialization.test.tsx +174 -0
- package/src/DatadogProvider/__tests__/initializationModes.test.tsx +174 -0
- package/src/DdSdkReactNative.tsx +205 -105
- package/src/DdSdkReactNativeConfiguration.tsx +160 -8
- package/src/__tests__/DdRumWrapper.test.tsx +3 -27
- package/src/__tests__/DdSdkReactNative.test.tsx +1 -0
- package/src/__tests__/DdSdkReactNativeConfiguration.test.ts +168 -0
- package/src/__tests__/foundation.test.ts +11 -2
- package/src/__tests__/rum/instrumentation/DdRumUserInteractionTracking.test.tsx +18 -4
- package/src/errorUtils.ts +50 -0
- package/src/foundation.tsx +15 -12
- package/src/index.tsx +9 -1
- package/src/nativeModulesTypes.ts +14 -0
- package/src/rum/instrumentation/DdRumErrorTracking.tsx +9 -46
- package/src/rum/instrumentation/DdRumUserInteractionTracking.tsx +13 -9
- package/src/rum/instrumentation/getJsxRuntime.ts +43 -0
- package/src/rum/instrumentation/resourceTracking/__tests__/DdRumResourceTracking.test.ts +2 -0
- package/src/rum/instrumentation/resourceTracking/implementation/DatadogRumResource/__tests__/ResourceReporter.test.ts +2 -0
- package/src/rum/instrumentation/resourceTracking/implementation/__tests__/XHRProxy.test.ts +3 -0
- package/src/types.tsx +2 -1
- package/src/version.ts +1 -1
package/src/index.tsx
CHANGED
|
@@ -4,7 +4,12 @@
|
|
|
4
4
|
* Copyright 2016-Present Datadog, Inc.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { DatadogProvider } from './DatadogProvider/DatadogProvider';
|
|
8
|
+
import {
|
|
9
|
+
DatadogProviderConfiguration,
|
|
10
|
+
DdSdkReactNativeConfiguration,
|
|
11
|
+
InitializationMode
|
|
12
|
+
} from './DdSdkReactNativeConfiguration';
|
|
8
13
|
import { DdSdkReactNative } from './DdSdkReactNative';
|
|
9
14
|
import { InternalLog } from './InternalLog';
|
|
10
15
|
import { ProxyConfiguration, ProxyType } from './ProxyConfiguration';
|
|
@@ -14,6 +19,9 @@ import { DdLogs, DdTrace, DdRum } from './foundation';
|
|
|
14
19
|
import { RumActionType, ErrorSource } from './types';
|
|
15
20
|
|
|
16
21
|
export {
|
|
22
|
+
DatadogProvider,
|
|
23
|
+
DatadogProviderConfiguration,
|
|
24
|
+
InitializationMode,
|
|
17
25
|
DdLogs,
|
|
18
26
|
DdTrace,
|
|
19
27
|
DdRum,
|
|
@@ -47,6 +47,20 @@ export type DdNativeSdkType = {
|
|
|
47
47
|
* @param trackingConsent: Consent, which can take one of the following values: 'pending', 'granted', 'not_granted'.
|
|
48
48
|
*/
|
|
49
49
|
setTrackingConsent(trackingConsent: string): Promise<void>;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Sends internal telemetry debug message
|
|
53
|
+
* @param message debug message
|
|
54
|
+
*/
|
|
55
|
+
telemetryDebug(message: string): Promise<void>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Sends internal telemetry error
|
|
59
|
+
* @param message error message
|
|
60
|
+
* @param stack error stack
|
|
61
|
+
* @param kind error kind
|
|
62
|
+
*/
|
|
63
|
+
telemetryError(message: string, stack: string, kind: string): Promise<void>;
|
|
50
64
|
};
|
|
51
65
|
|
|
52
66
|
/**
|
|
@@ -8,12 +8,14 @@ import type { ErrorHandlerCallback } from 'react-native';
|
|
|
8
8
|
|
|
9
9
|
import { InternalLog } from '../../InternalLog';
|
|
10
10
|
import { SdkVerbosity } from '../../SdkVerbosity';
|
|
11
|
+
import {
|
|
12
|
+
getErrorMessage,
|
|
13
|
+
getErrorStackTrace,
|
|
14
|
+
EMPTY_STACK_TRACE
|
|
15
|
+
} from '../../errorUtils';
|
|
11
16
|
import { DdRum } from '../../foundation';
|
|
12
17
|
import { ErrorSource } from '../../types';
|
|
13
18
|
|
|
14
|
-
const EMPTY_MESSAGE = 'Unknown Error';
|
|
15
|
-
const EMPTY_STACK_TRACE = '';
|
|
16
|
-
|
|
17
19
|
/**
|
|
18
20
|
* Provides RUM auto-instrumentation feature to track errors as RUM events.
|
|
19
21
|
*/
|
|
@@ -63,8 +65,8 @@ export class DdRumErrorTracking {
|
|
|
63
65
|
|
|
64
66
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
65
67
|
static onGlobalError(error: any, isFatal?: boolean): void {
|
|
66
|
-
const message =
|
|
67
|
-
const stacktrace =
|
|
68
|
+
const message = getErrorMessage(error);
|
|
69
|
+
const stacktrace = getErrorStackTrace(error);
|
|
68
70
|
DdRum.addError(message, ErrorSource.SOURCE, stacktrace, {
|
|
69
71
|
'_dd.error.is_crash': isFatal,
|
|
70
72
|
'_dd.error.raw': error
|
|
@@ -86,7 +88,7 @@ export class DdRumErrorTracking {
|
|
|
86
88
|
let stack: string = EMPTY_STACK_TRACE;
|
|
87
89
|
for (let i = 0; i < params.length; i += 1) {
|
|
88
90
|
const param = params[i];
|
|
89
|
-
const paramStack =
|
|
91
|
+
const paramStack = getErrorStackTrace(param);
|
|
90
92
|
if (paramStack !== EMPTY_STACK_TRACE) {
|
|
91
93
|
stack = paramStack;
|
|
92
94
|
break;
|
|
@@ -98,7 +100,7 @@ export class DdRumErrorTracking {
|
|
|
98
100
|
if (typeof param === 'string') {
|
|
99
101
|
return param;
|
|
100
102
|
} else {
|
|
101
|
-
return
|
|
103
|
+
return getErrorMessage(param);
|
|
102
104
|
}
|
|
103
105
|
})
|
|
104
106
|
.join(' ');
|
|
@@ -107,43 +109,4 @@ export class DdRumErrorTracking {
|
|
|
107
109
|
DdRumErrorTracking.defaultConsoleError.apply(console, params);
|
|
108
110
|
});
|
|
109
111
|
}
|
|
110
|
-
|
|
111
|
-
private static getErrorMessage(error: any | undefined): string {
|
|
112
|
-
let message = EMPTY_MESSAGE;
|
|
113
|
-
if (error === undefined || error === null) {
|
|
114
|
-
message = EMPTY_MESSAGE;
|
|
115
|
-
} else if (typeof error === 'object' && 'message' in error) {
|
|
116
|
-
message = String(error.message);
|
|
117
|
-
} else {
|
|
118
|
-
message = String(error);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return message;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
private static getErrorStackTrace(error: any | undefined): string {
|
|
125
|
-
let stack = EMPTY_STACK_TRACE;
|
|
126
|
-
|
|
127
|
-
if (error === undefined || error === null) {
|
|
128
|
-
stack = EMPTY_STACK_TRACE;
|
|
129
|
-
} else if (typeof error === 'string') {
|
|
130
|
-
stack = EMPTY_STACK_TRACE;
|
|
131
|
-
} else if (typeof error === 'object') {
|
|
132
|
-
if ('componentStack' in error) {
|
|
133
|
-
stack = String(error.componentStack);
|
|
134
|
-
} else if ('stacktrace' in error) {
|
|
135
|
-
stack = String(error.stacktrace);
|
|
136
|
-
} else if ('stack' in error) {
|
|
137
|
-
stack = String(error.stack);
|
|
138
|
-
} else if (
|
|
139
|
-
'sourceURL' in error &&
|
|
140
|
-
'line' in error &&
|
|
141
|
-
'column' in error
|
|
142
|
-
) {
|
|
143
|
-
stack = `at ${error.sourceURL}:${error.line}:${error.column}`;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return stack;
|
|
148
|
-
}
|
|
149
112
|
}
|
|
@@ -8,11 +8,14 @@ import React from 'react';
|
|
|
8
8
|
|
|
9
9
|
import { InternalLog } from '../../InternalLog';
|
|
10
10
|
import { SdkVerbosity } from '../../SdkVerbosity';
|
|
11
|
+
import { getErrorMessage } from '../../errorUtils';
|
|
12
|
+
import { DdSdk } from '../../foundation';
|
|
11
13
|
|
|
12
14
|
import { DdEventsInterceptor } from './DdEventsInterceptor';
|
|
13
15
|
import type EventsInterceptor from './EventsInterceptor';
|
|
14
16
|
import NoOpEventsInterceptor from './NoOpEventsInterceptor';
|
|
15
17
|
import { areObjectShallowEqual } from './ShallowObjectEqualityChecker';
|
|
18
|
+
import { getJsxRuntime } from './getJsxRuntime';
|
|
16
19
|
|
|
17
20
|
/**
|
|
18
21
|
* Provides RUM auto-instrumentation feature to track user interaction as RUM events.
|
|
@@ -21,6 +24,8 @@ import { areObjectShallowEqual } from './ShallowObjectEqualityChecker';
|
|
|
21
24
|
export class DdRumUserInteractionTracking {
|
|
22
25
|
private static isTracking = false;
|
|
23
26
|
private static eventsInterceptor: EventsInterceptor = new NoOpEventsInterceptor();
|
|
27
|
+
private static originalCreateElement = React.createElement;
|
|
28
|
+
private static originalMemo = React.memo;
|
|
24
29
|
|
|
25
30
|
private static patchCreateElementFunction = (
|
|
26
31
|
originalFunction: typeof React.createElement,
|
|
@@ -71,22 +76,15 @@ export class DdRumUserInteractionTracking {
|
|
|
71
76
|
};
|
|
72
77
|
|
|
73
78
|
try {
|
|
74
|
-
|
|
75
|
-
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
76
|
-
const jsxRuntime = require('react/jsx-runtime');
|
|
79
|
+
const jsxRuntime = getJsxRuntime();
|
|
77
80
|
const originaljsx = jsxRuntime.jsx;
|
|
78
|
-
if (!originaljsx) {
|
|
79
|
-
throw new Error(
|
|
80
|
-
'React version does not support new jsx transform'
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
81
|
jsxRuntime.jsx = (
|
|
84
82
|
...args: Parameters<typeof React.createElement>
|
|
85
83
|
): ReturnType<typeof React.createElement> => {
|
|
86
84
|
return this.patchCreateElementFunction(originaljsx, args);
|
|
87
85
|
};
|
|
88
86
|
} catch (e) {
|
|
89
|
-
|
|
87
|
+
DdSdk.telemetryDebug(getErrorMessage(e));
|
|
90
88
|
}
|
|
91
89
|
|
|
92
90
|
const originalMemo = React.memo;
|
|
@@ -126,4 +124,10 @@ export class DdRumUserInteractionTracking {
|
|
|
126
124
|
SdkVerbosity.INFO
|
|
127
125
|
);
|
|
128
126
|
}
|
|
127
|
+
|
|
128
|
+
static stopTracking() {
|
|
129
|
+
React.createElement = this.originalCreateElement;
|
|
130
|
+
React.memo = this.originalMemo;
|
|
131
|
+
DdRumUserInteractionTracking.isTracking = false;
|
|
132
|
+
}
|
|
129
133
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
3
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const getJsxRuntime = () => {
|
|
8
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
|
|
9
|
+
const [major, minor] = require('react/package.json').version.split('.');
|
|
10
|
+
// We need to check on the version of React before calling require('react/jsx-runtime') as
|
|
11
|
+
// it might crash other exports if the export does not exist (even if there is a try/catch).
|
|
12
|
+
// See: https://github.com/facebook/metro/issues/836
|
|
13
|
+
if (!isJsxExportedInReactVersion(major, minor)) {
|
|
14
|
+
throw new Error('React version does not support new jsx transform');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// React Native does some premature optimizations if the require target is a static string, by making
|
|
18
|
+
// it dynamic we prevent RN from trying to resolve react/jsx-runtime before the function is called
|
|
19
|
+
const jsxRuntimePackage = isJsxExportedInReactVersion(major, minor)
|
|
20
|
+
? 'react/jsx-runtime'
|
|
21
|
+
: 'react';
|
|
22
|
+
|
|
23
|
+
// We have to use inline require here because older React versions (below 17) don't have jsx-runtime
|
|
24
|
+
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires, import/no-dynamic-require
|
|
25
|
+
const jsxRuntime = require(jsxRuntimePackage);
|
|
26
|
+
if (!jsxRuntime.jsx) {
|
|
27
|
+
throw new Error('React jsx runtime does not export new jsx transform');
|
|
28
|
+
}
|
|
29
|
+
return jsxRuntime.jsx;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* JSX Transform is available for React 16.14.0 (last React 16 version) and above
|
|
34
|
+
*/
|
|
35
|
+
const isJsxExportedInReactVersion = (major: string, minor: string): boolean => {
|
|
36
|
+
if (Number(major) > 16) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
if (Number(major) === 16 && Number(minor) > 13) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
};
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { NativeModules } from 'react-native';
|
|
8
8
|
|
|
9
|
+
import { BufferSingleton } from '../../../../DatadogProvider/Buffer/BufferSingleton';
|
|
9
10
|
import { DdRumResourceTracking } from '../DdRumResourceTracking';
|
|
10
11
|
|
|
11
12
|
import { XMLHttpRequestMock } from './__utils__/XMLHttpRequestMock';
|
|
@@ -17,6 +18,7 @@ const flushPromises = () => new Promise(setImmediate);
|
|
|
17
18
|
beforeEach(() => {
|
|
18
19
|
DdRum.startResource.mockClear();
|
|
19
20
|
DdRum.stopResource.mockClear();
|
|
21
|
+
BufferSingleton.onInitialization();
|
|
20
22
|
global.XMLHttpRequest = XMLHttpRequestMock;
|
|
21
23
|
});
|
|
22
24
|
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { NativeModules } from 'react-native';
|
|
8
8
|
|
|
9
|
+
import { BufferSingleton } from '../../../../../../DatadogProvider/Buffer/BufferSingleton';
|
|
9
10
|
import type { RUMResource } from '../../../domain/interfaces/RumResource';
|
|
10
11
|
import { ResourceReporter } from '../ResourceReporter';
|
|
11
12
|
|
|
@@ -18,6 +19,7 @@ const flushPromises = () => new Promise(setImmediate);
|
|
|
18
19
|
beforeEach(() => {
|
|
19
20
|
DdRum.startResource.mockClear();
|
|
20
21
|
DdRum.stopResource.mockClear();
|
|
22
|
+
BufferSingleton.onInitialization();
|
|
21
23
|
});
|
|
22
24
|
|
|
23
25
|
describe('Resource reporter', () => {
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { Platform, NativeModules } from 'react-native';
|
|
8
8
|
|
|
9
|
+
import { BufferSingleton } from '../../../../../DatadogProvider/Buffer/BufferSingleton';
|
|
9
10
|
import { InternalLog } from '../../../../../InternalLog';
|
|
10
11
|
import { SdkVerbosity } from '../../../../../SdkVerbosity';
|
|
11
12
|
import { XMLHttpRequestMock } from '../../__tests__/__utils__/XMLHttpRequestMock';
|
|
@@ -43,6 +44,8 @@ let xhrProxy;
|
|
|
43
44
|
beforeEach(() => {
|
|
44
45
|
DdRum.startResource.mockClear();
|
|
45
46
|
DdRum.stopResource.mockClear();
|
|
47
|
+
BufferSingleton.onInitialization();
|
|
48
|
+
|
|
46
49
|
xhrProxy = new XHRProxy({
|
|
47
50
|
xhrType: XMLHttpRequestMock,
|
|
48
51
|
resourceReporter: new ResourceReporter([])
|
package/src/types.tsx
CHANGED
|
@@ -16,7 +16,8 @@ export class DdSdkConfiguration {
|
|
|
16
16
|
readonly sampleRate: number,
|
|
17
17
|
readonly site: string,
|
|
18
18
|
readonly trackingConsent: string,
|
|
19
|
-
readonly additionalConfig: object
|
|
19
|
+
readonly additionalConfig: object,
|
|
20
|
+
readonly telemetrySampleRate: number
|
|
20
21
|
) {}
|
|
21
22
|
}
|
|
22
23
|
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by genversion
|
|
2
|
-
export const version = '1.
|
|
2
|
+
export const version = '1.2.0-beta1';
|