-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix(core): Apply dataCollection.urlQueryParams to url.full and url.query
#23061
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
Open
chargome
wants to merge
6
commits into
fix/filter-url-query-util
from
fix/gate-url-query-params-on-data-collection
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b2e0e77
fix(core): Apply `dataCollection.urlQueryParams` to `url.full` and `u…
chargome 0e39522
test(core): Cover breadcrumb query filtering and tighten span assertions
chargome 82e22d5
pr feedback
chargome 868bc15
ref(core): Filter collected URLs at their write sites
chargome ee7cbb0
fix(core): Filter query params in `http.target`
chargome 3ebcc0f
fix gcp names
chargome File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
packages/core/src/utils/data-collection/filterCollectedUrl.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import { getClient } from '../../currentScopes'; | ||
| import type { CollectBehavior } from '../../types/datacollection'; | ||
| import { filterQueryParams } from './filterQueryParams'; | ||
| import { filterUrlQuery } from './filterUrlQuery'; | ||
|
|
||
| function urlQueryParamsBehavior(): CollectBehavior { | ||
| // Instrumentation can run before a client exists; the denylist default is the safe fallback. | ||
| return getClient()?.getDataCollectionOptions().urlQueryParams ?? true; | ||
| } | ||
|
|
||
| /** | ||
| * Applies `dataCollection.urlQueryParams` to a URL the SDK collected itself, for use as `url.full`. | ||
| * | ||
| * Call this at every site where instrumentation records a URL. Routing the SDK's own URLs through a | ||
| * helper is what makes the filtering provenance-correct: a URL a user attaches themselves never passes | ||
| * through here, and `dataCollection` is only meant to gate automatically collected data. | ||
| */ | ||
| export function filterCollectedUrl(url: string): string; | ||
| export function filterCollectedUrl(url: string | undefined): string | undefined; | ||
| export function filterCollectedUrl(url: string | undefined): string | undefined { | ||
| return url === undefined ? undefined : filterUrlQuery(url, urlQueryParamsBehavior()); | ||
| } | ||
|
|
||
| /** | ||
| * Applies `dataCollection.urlQueryParams` to a query string the SDK collected itself, for use as | ||
| * `url.query`. Returns `undefined` when the query must not be collected at all. | ||
| * | ||
| * See {@link filterCollectedUrl} for why this is a helper rather than a central pass. | ||
| */ | ||
| export function filterCollectedUrlQuery(query: string | undefined): string | undefined { | ||
| return query ? filterQueryParams(query, urlQueryParamsBehavior()) : undefined; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.