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: posthog path to ignore #1054

Merged
merged 3 commits into from
Mar 5, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/__tests__/extensions/replay/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,14 @@ describe('config', () => {
],
[
{
name: 'https://app.posthog.com/i/vo/e/',
name: 'https://app.posthog.com/i/v0/e/',
},
undefined,
],
[
{
// even an imaginary future world of rust session replay capture
name: 'https://app.posthog.com/i/v0/s/',
},
undefined,
],
Expand Down
4 changes: 2 additions & 2 deletions src/extensions/replay/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ const removeAuthorizationHeader = (data: CapturedNetworkRequest): CapturedNetwor
return data
}

const POSTHOG_PATHS_TO_IGNORE = ['/s/', '/e/', '/i/vo/e/']
const POSTHOG_PATHS_TO_IGNORE = ['/s/', '/e/', '/i/']
// want to ignore posthog paths when capturing requests, or we can get trapped in a loop
// because calls to PostHog would be reported using a call to PostHog which would be reported....
const ignorePostHogPaths = (data: CapturedNetworkRequest): CapturedNetworkRequest | undefined => {
const url = convertToURL(data.name)
if (url && url.pathname && POSTHOG_PATHS_TO_IGNORE.includes(url.pathname)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so if someone else has /i/my-important-data then we won't capture it but let's cross that bridge when we come to it

if (url && url.pathname && POSTHOG_PATHS_TO_IGNORE.some((path) => url.pathname.indexOf(path) === 0)) {
return undefined
}
return data
Expand Down
Loading