Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(replay): Fix missing fetch/xhr requests #7134

Merged
merged 1 commit into from
Feb 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/replay/src/util/shouldFilterRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ import { getCurrentHub } from '@sentry/core';
import type { ReplayContainer } from '../types';

/**
* Check whether a given request URL should be filtered out.
* Check whether a given request URL should be filtered out. This is so we
* don't log Sentry ingest requests.
*/
export function shouldFilterRequest(replay: ReplayContainer, url: string): boolean {
// If we enabled the `traceInternals` experiment, we want to trace everything
if (__DEBUG_BUILD__ && replay.getOptions()._experiments.traceInternals) {
return false;
}

return !_isSentryRequest(url);
return _isSentryRequest(url);
}

/**
Expand Down
20 changes: 20 additions & 0 deletions packages/replay/test/integration/shouldFilterRequest.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { shouldFilterRequest } from '../../src/util/shouldFilterRequest';
import { mockSdk } from '../index';

describe('Integration | shouldFilterRequest', () => {
beforeEach(() => {
jest.resetModules();
});

it('should not filter requests from non-Sentry ingest URLs', async () => {
const { replay } = await mockSdk();

expect(shouldFilterRequest(replay, 'https://example.com/foo')).toBe(false);
});

it('should filter requests for Sentry ingest URLs', async () => {
const { replay } = await mockSdk();

expect(shouldFilterRequest(replay, 'https://03031aa.ingest.f00.f00/api/129312/')).toBe(true);
});
});