@datadog/mobile-react-native 2.0.1 → 2.0.2
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 +6 -6
- package/android/build.gradle +38 -22
- package/android/src/test/kotlin/com/datadog/reactnative/DdLogsTest.kt +7 -7
- package/android/src/test/kotlin/com/datadog/reactnative/DdRumTest.kt +3 -3
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +15 -15
- package/android/src/test/kotlin/com/datadog/reactnative/DdTraceTest.kt +9 -9
- package/android/src/test/kotlin/com/datadog/tools/unit/MockRumMonitor.kt +2 -0
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/ActionEventForgeryFactory.kt +1 -1
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/ResourceEventForgeryFactory.kt +1 -1
- package/android/src/test/kotlin/com/datadog/tools/unit/forge/TelemetryConfigurationEventForgeryFactory.kt +1 -0
- package/lib/commonjs/DdSdkReactNativeConfiguration.js +1 -1
- package/lib/commonjs/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/commonjs/logs/DdLogs.js +3 -3
- package/lib/commonjs/logs/DdLogs.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +3 -3
- package/lib/commonjs/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js +8 -9
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js +1 -1
- package/lib/commonjs/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -1
- package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js +4 -4
- package/lib/commonjs/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
- package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js +1 -1
- package/lib/commonjs/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
- package/lib/commonjs/sdk/EventMappers/EventMapper.js +1 -1
- package/lib/commonjs/sdk/EventMappers/EventMapper.js.map +1 -1
- package/lib/commonjs/specs/NativeDdLogs.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/DdSdkReactNativeConfiguration.js +1 -1
- package/lib/module/DdSdkReactNativeConfiguration.js.map +1 -1
- package/lib/module/logs/DdLogs.js +3 -3
- package/lib/module/logs/DdLogs.js.map +1 -1
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js +3 -3
- package/lib/module/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js +8 -9
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.js.map +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js +1 -1
- package/lib/module/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js +4 -4
- package/lib/module/sdk/DatadogProvider/Buffer/BoundedBuffer.js.map +1 -1
- package/lib/module/sdk/DatadogProvider/DatadogProvider.js +1 -1
- package/lib/module/sdk/DatadogProvider/DatadogProvider.js.map +1 -1
- package/lib/module/sdk/EventMappers/EventMapper.js +1 -1
- package/lib/module/sdk/EventMappers/EventMapper.js.map +1 -1
- package/lib/module/specs/NativeDdLogs.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 +1 -1
- package/lib/typescript/logs/DdLogs.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.d.ts +1 -1
- package/lib/typescript/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.d.ts +1 -1
- package/lib/typescript/sdk/EventMappers/EventMapper.d.ts +1 -1
- package/lib/typescript/specs/NativeDdLogs.d.ts +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/DdSdkReactNativeConfiguration.tsx +1 -1
- package/src/__tests__/mock.test.ts +1 -1
- package/src/logs/DdLogs.ts +3 -3
- package/src/rum/instrumentation/interactionTracking/DdRumUserInteractionTracking.tsx +3 -3
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/__tests__/internalDevResourceBlocklist.test.ts +5 -5
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.ts +8 -9
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.ts +1 -1
- package/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/responseSize.ts +1 -1
- package/src/sdk/DatadogProvider/Buffer/BoundedBuffer.ts +5 -5
- package/src/sdk/DatadogProvider/DatadogProvider.tsx +1 -1
- package/src/sdk/EventMappers/EventMapper.ts +1 -1
- package/src/specs/NativeDdLogs.ts +1 -1
- package/src/version.ts +1 -1
|
@@ -12,7 +12,7 @@ const resourceMockFactory = new ResourceMockFactory();
|
|
|
12
12
|
|
|
13
13
|
describe('internalDevResourceBlocklist', () => {
|
|
14
14
|
describe('filterDevResource', () => {
|
|
15
|
-
it.each(['192.168.1.20', '10.46.29.155', '172.28.1.20'])(
|
|
15
|
+
it.each(['192.168.1.20', '10.46.29.155', '172.28.1.20', '127.0.0.1'])(
|
|
16
16
|
'returns null when a expo logs call with ip %s is made',
|
|
17
17
|
ip => {
|
|
18
18
|
const resource = resourceMockFactory.getCustomResource({
|
|
@@ -25,7 +25,7 @@ describe('internalDevResourceBlocklist', () => {
|
|
|
25
25
|
expect(filterDevResource(resource)).toBeNull();
|
|
26
26
|
}
|
|
27
27
|
);
|
|
28
|
-
it('returns
|
|
28
|
+
it('returns the event when an expo logs call with custom port is made', () => {
|
|
29
29
|
const resource = resourceMockFactory.getCustomResource({
|
|
30
30
|
request: {
|
|
31
31
|
method: 'GET',
|
|
@@ -33,7 +33,7 @@ describe('internalDevResourceBlocklist', () => {
|
|
|
33
33
|
kind: 'xhr'
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
-
expect(filterDevResource(resource)).toBeNull();
|
|
36
|
+
expect(filterDevResource(resource)).not.toBeNull();
|
|
37
37
|
});
|
|
38
38
|
it('returns null when a rn symbolicate call is made', () => {
|
|
39
39
|
const resource = resourceMockFactory.getCustomResource({
|
|
@@ -45,7 +45,7 @@ describe('internalDevResourceBlocklist', () => {
|
|
|
45
45
|
});
|
|
46
46
|
expect(filterDevResource(resource)).toBeNull();
|
|
47
47
|
});
|
|
48
|
-
it('returns
|
|
48
|
+
it('returns the event when an rn symbolicate call with custom port is made', () => {
|
|
49
49
|
const resource = resourceMockFactory.getCustomResource({
|
|
50
50
|
request: {
|
|
51
51
|
method: 'GET',
|
|
@@ -53,7 +53,7 @@ describe('internalDevResourceBlocklist', () => {
|
|
|
53
53
|
kind: 'xhr'
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
|
-
expect(filterDevResource(resource)).toBeNull();
|
|
56
|
+
expect(filterDevResource(resource)).not.toBeNull();
|
|
57
57
|
});
|
|
58
58
|
it('returns the resource when the resource is not a dev resource', () => {
|
|
59
59
|
const resource = resourceMockFactory.getCustomResource({
|
|
@@ -16,17 +16,17 @@ import type { RUMResource } from '../../interfaces/RumResource';
|
|
|
16
16
|
* An example URL is http://192.168.1.20:8081/logs or http://10.46.29.155:19000/logs
|
|
17
17
|
*/
|
|
18
18
|
const EXPO_DEV_LOGS_REGEX = new RegExp(
|
|
19
|
-
'^http://((10|172|192).[0-9]+.[0-9]+.[0-9]+|localhost):[0-9]
|
|
19
|
+
'^http://((10|172|192).[0-9]+.[0-9]+.[0-9]+|localhost|127.0.0.1):808[0-9]/logs$'
|
|
20
20
|
);
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* This call is made every time the RN packager reloads the js in dev mode.
|
|
24
24
|
*/
|
|
25
25
|
const RN_PACKAGER_SYMBOLICATE_REGEX = new RegExp(
|
|
26
|
-
'^http://localhost:[0-9]
|
|
26
|
+
'^http://localhost:808[0-9]/symbolicate$'
|
|
27
27
|
);
|
|
28
28
|
|
|
29
|
-
const
|
|
29
|
+
const internalDevResourceBlocklist: RegExp[] = [
|
|
30
30
|
EXPO_DEV_LOGS_REGEX,
|
|
31
31
|
RN_PACKAGER_SYMBOLICATE_REGEX
|
|
32
32
|
];
|
|
@@ -38,12 +38,11 @@ const internalResourceBlocklist: RegExp[] = [
|
|
|
38
38
|
export const filterDevResource = (
|
|
39
39
|
resource: RUMResource
|
|
40
40
|
): RUMResource | null => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return null;
|
|
41
|
+
if (__DEV__) {
|
|
42
|
+
for (const resourceRegex of internalDevResourceBlocklist) {
|
|
43
|
+
if (resourceRegex.test(resource.request.url)) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
48
|
return resource;
|
|
@@ -9,7 +9,7 @@ import { SdkVerbosity } from '../../../../../SdkVerbosity';
|
|
|
9
9
|
|
|
10
10
|
const MISSING_RESOURCE_SIZE = -1;
|
|
11
11
|
export const RESOURCE_SIZE_ERROR_MESSAGE =
|
|
12
|
-
"Couldn't get resource size, because an error
|
|
12
|
+
"Couldn't get resource size, because an error occurred: ";
|
|
13
13
|
|
|
14
14
|
function byteLength(str: string): number {
|
|
15
15
|
// This is a weird trick, but it works.
|
|
@@ -41,7 +41,7 @@ export class BoundedBuffer extends DatadogBuffer {
|
|
|
41
41
|
message: string;
|
|
42
42
|
stack: string;
|
|
43
43
|
kind: string;
|
|
44
|
-
|
|
44
|
+
occurrences: number;
|
|
45
45
|
};
|
|
46
46
|
} = {};
|
|
47
47
|
|
|
@@ -184,22 +184,22 @@ export class BoundedBuffer extends DatadogBuffer {
|
|
|
184
184
|
kind: string
|
|
185
185
|
) => {
|
|
186
186
|
if (this.telemetryBuffer[kind]) {
|
|
187
|
-
this.telemetryBuffer[kind].
|
|
187
|
+
this.telemetryBuffer[kind].occurrences++;
|
|
188
188
|
} else {
|
|
189
189
|
this.telemetryBuffer[kind] = {
|
|
190
190
|
message,
|
|
191
191
|
stack,
|
|
192
192
|
kind,
|
|
193
|
-
|
|
193
|
+
occurrences: 1
|
|
194
194
|
};
|
|
195
195
|
}
|
|
196
196
|
};
|
|
197
197
|
|
|
198
198
|
private drainTelemetry = () => {
|
|
199
199
|
Object.values(this.telemetryBuffer).forEach(
|
|
200
|
-
({ message, stack, kind,
|
|
200
|
+
({ message, stack, kind, occurrences }) => {
|
|
201
201
|
DdSdk.telemetryError(
|
|
202
|
-
`${message} happened ${
|
|
202
|
+
`${message} happened ${occurrences} times.`,
|
|
203
203
|
stack,
|
|
204
204
|
kind
|
|
205
205
|
);
|
|
@@ -51,7 +51,7 @@ const isConfigurationPartial = (
|
|
|
51
51
|
return false;
|
|
52
52
|
}
|
|
53
53
|
if (configuration instanceof DdSdkReactNativeConfiguration) {
|
|
54
|
-
// Not using InternalLog here as it is not yet
|
|
54
|
+
// Not using InternalLog here as it is not yet instantiated
|
|
55
55
|
console.warn(
|
|
56
56
|
'A DdSdkReactNativeConfiguration was passed to DatadogProvider. Please use DatadogProviderConfiguration instead.'
|
|
57
57
|
);
|
|
@@ -26,7 +26,7 @@ export type AdditionalEventDataForMapper = {
|
|
|
26
26
|
*
|
|
27
27
|
* @param eventMapper the user-registered event mapper
|
|
28
28
|
* @param formatRawEventForMapper formatter that gets the raw event (from javascript call) and returns the input given to the mapper
|
|
29
|
-
* @param formatMapperEventForNative formatter that gets the
|
|
29
|
+
* @param formatMapperEventForNative formatter that gets the output of the mapper, and returns the input given to the native SDKs
|
|
30
30
|
* @param formatRawEventForNative called when no event mapper is registered
|
|
31
31
|
*/
|
|
32
32
|
export class EventMapper<RawEvent, MapperEvent, NativeEvent> {
|
|
@@ -59,7 +59,7 @@ export interface Spec extends TurboModule {
|
|
|
59
59
|
) => Promise<void>;
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
* Send a log containing an error with
|
|
62
|
+
* Send a log containing an error with INFO level.
|
|
63
63
|
* @param message: The message to send.
|
|
64
64
|
* @param errorKind: The error kind to send.
|
|
65
65
|
* @param errorMessage: The error message to send.
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by genversion
|
|
2
|
-
export const version = '2.0.
|
|
2
|
+
export const version = '2.0.2';
|