diff --git a/packages/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/__tests__/internalDevResourceBlocklist.test.ts b/packages/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/__tests__/internalDevResourceBlocklist.test.ts index 9acc6b756..a8dc73ea2 100644 --- a/packages/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/__tests__/internalDevResourceBlocklist.test.ts +++ b/packages/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/__tests__/internalDevResourceBlocklist.test.ts @@ -12,7 +12,7 @@ const resourceMockFactory = new ResourceMockFactory(); describe('internalDevResourceBlocklist', () => { describe('filterDevResource', () => { - it.each(['192.168.1.20', '10.46.29.155', '172.28.1.20'])( + it.each(['192.168.1.20', '10.46.29.155', '172.28.1.20', '127.0.0.1'])( 'returns null when a expo logs call with ip %s is made', ip => { const resource = resourceMockFactory.getCustomResource({ @@ -25,7 +25,7 @@ describe('internalDevResourceBlocklist', () => { expect(filterDevResource(resource)).toBeNull(); } ); - it('returns null when an expo logs call with custom port is made', () => { + it('returns the event when an expo logs call with custom port is made', () => { const resource = resourceMockFactory.getCustomResource({ request: { method: 'GET', @@ -33,7 +33,7 @@ describe('internalDevResourceBlocklist', () => { kind: 'xhr' } }); - expect(filterDevResource(resource)).toBeNull(); + expect(filterDevResource(resource)).not.toBeNull(); }); it('returns null when a rn symbolicate call is made', () => { const resource = resourceMockFactory.getCustomResource({ @@ -45,7 +45,7 @@ describe('internalDevResourceBlocklist', () => { }); expect(filterDevResource(resource)).toBeNull(); }); - it('returns null when an rn symbolicate call with custom port is made', () => { + it('returns the event when an rn symbolicate call with custom port is made', () => { const resource = resourceMockFactory.getCustomResource({ request: { method: 'GET', @@ -53,7 +53,7 @@ describe('internalDevResourceBlocklist', () => { kind: 'xhr' } }); - expect(filterDevResource(resource)).toBeNull(); + expect(filterDevResource(resource)).not.toBeNull(); }); it('returns the resource when the resource is not a dev resource', () => { const resource = resourceMockFactory.getCustomResource({ diff --git a/packages/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.ts b/packages/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.ts index eff97710b..c8dae8ef5 100644 --- a/packages/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.ts +++ b/packages/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/DatadogRumResource/internalDevResourceBlocklist.ts @@ -16,17 +16,17 @@ import type { RUMResource } from '../../interfaces/RumResource'; * An example URL is http://192.168.1.20:8081/logs or http://10.46.29.155:19000/logs */ const EXPO_DEV_LOGS_REGEX = new RegExp( - '^http://((10|172|192).[0-9]+.[0-9]+.[0-9]+|localhost):[0-9]+/logs$' + '^http://((10|172|192).[0-9]+.[0-9]+.[0-9]+|localhost|127.0.0.1):808[0-9]/logs$' ); /** * This call is made every time the RN packager reloads the js in dev mode. */ const RN_PACKAGER_SYMBOLICATE_REGEX = new RegExp( - '^http://localhost:[0-9]+/symbolicate$' + '^http://localhost:808[0-9]/symbolicate$' ); -const internalResourceBlocklist: RegExp[] = [ +const internalDevResourceBlocklist: RegExp[] = [ EXPO_DEV_LOGS_REGEX, RN_PACKAGER_SYMBOLICATE_REGEX ]; @@ -38,12 +38,11 @@ const internalResourceBlocklist: RegExp[] = [ export const filterDevResource = ( resource: RUMResource ): RUMResource | null => { - // TODO: if we get the confirmation by Expo that the - // logs call is only made when __DEV__ is true, add an - // early return for when it is false. - for (const resourceRegex of internalResourceBlocklist) { - if (resourceRegex.test(resource.request.url)) { - return null; + if (__DEV__) { + for (const resourceRegex of internalDevResourceBlocklist) { + if (resourceRegex.test(resource.request.url)) { + return null; + } } } return resource;