Repository navigation
Commit 5f77fe2
authored
fix(v10/browser): Apply
Backport of: #25262
## Differences to the original PR
- **Source files moved.** v10 still uses the older `browser-utils`
layout. The `performance/entries.ts` and `web-vitals/tracking.ts`
changes went into `src/metrics/browserMetrics.ts`. The
`web-vitals/spans.ts` change went into `src/metrics/webVitalSpans.ts`.
The filtering is the same.
- **Navigation spans:** v10's `_addPerformanceNavigationTiming` /
`_addRequest` set no `url.full` attribute and have no span-streaming
name branch. So only the span `name` is now filtered
(`filterCollectedUrl(entry.name)`).
- **`_sendLcpSpan` (`webVitalSpans.ts`):** on v10 this function takes no
`client` parameter. `filterCollectedUrl(entry.url)` falls back to
`getClient()`.
- **Added beyond the original:** `src/metrics/lcp.ts`
(`_sendStandaloneLcpSpan`) now filters its `lcp.url` attribute too. This
standalone LCP span code exists only on v10 (it was removed on develop).
Without this change it would still send the unfiltered LCP URL. This
matches the original PR's goal of filtering `lcp.url`.
- **`httpcontext.ts`:** v10 spreads `...reqData` into `event.request`
instead of setting `url` explicitly. The backport adds `url:
filterCollectedUrl(reqData.url, client)` after the spread and before
`...event.request`, so a URL the user set still wins. `preprocessEvent`
now takes the `client` argument.
- **Unit tests adapted to v10 paths and shapes:**
- The new `browserMetrics.test.ts` cases are in
`test/browser/browserMetrics.test.ts`. They check `description`/`data`,
not `name`/`attributes`.
- The navigation case checks only span descriptions, because v10
navigation spans have no `url.full`. To share it with the new case, the
navigation `entry` fixture moved to `describe` scope.
- The `_sendLcpSpan` expectation update is in
`test/metrics/webVitalSpans.test.ts`. No client mock is needed.
- `test/metrics/lcp.test.ts` gets the same query-param expectation for
the standalone LCP span.
- The `httpcontext.test.ts` cases were added at the top level, because
v10 has no `dataCollection` describe block.
- **Integration tests:**
- The develop-only `web-vitals-lcp-static` suite maps to v10's
`web-vitals-lcp` (static is the default there).
- The new `pageload-sensitive-query-params-static` test uses string ops
(`'pageload'`, `'browser.request'`, `'resource.img'`). v10's
`@sentry/conventions@0.16.0` doesn't export `BROWSER_REQUEST` /
`PAGELOAD` / `RESOURCE_IMG` from `@sentry/conventions/op`.
- The `httpContext` integration test imports
`waitForErrorRequest`/`envelopeRequestParser`, which v10's version
didn't import yet.
## Verification
- `yarn format`, `yarn lint:fix` (0 warnings, 0 errors) and `yarn
build:dev` all pass.
- Vitest passes for: `browser-utils` (`browserMetrics`, `lcp`,
`webVitalSpans`), `browser` (`browserTracingIntegration`) and `nextjs`
(`pagesRouterInstrumentation`).
- `browser` `httpcontext.test.ts` passed (5/5) only with a temporary
local workaround. Under the sandbox's Node 22, the existing
`globalThis.navigator = …` setup throws, and it does the same on
unmodified v10. The repo pins Node 20.
- Playwright browser-integration tests were not run locally. They are
left to CI.
<!-- junior-request-attribution:start -->
via Junior system actor `junior`.
<!-- junior-request-attribution:end -->
<!-- junior-session-footer:start -->
<!--
junior-conversation-id:agent-dispatch%3Adispatch_968746a4c2386e3695487fe7c0061e2b
-->
--
[View Junior
Session](https://junior-prod.sentry.dev/conversations/agent-dispatch%3Adispatch_968746a4c2386e3695487fe7c0061e2b)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent-dispatch%3Adispatch_968746a4c2386e3695487fe7c0061e2b/?project=4510944073809921)
<!-- junior-session-footer:end -->
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>urlQueryParams to event URLs, static span names and LCP URLs (#25297)1 parent c96d509 commit 5f77fe2
17 files changed
Lines changed: 191 additions & 58 deletions
File tree
- dev-packages/browser-integration-tests
- suites
- integrations/httpContext
- tracing
- browserTracingIntegration/pageload-sensitive-query-params-static
- metrics/web-vitals-lcp
- utils
- packages
- browser-utils
- src/metrics
- test
- browser
- metrics
- browser
- src
- integrations
- tracing
- test/integrations
- nextjs/test/performance
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
690 | 690 | | |
691 | 691 | | |
692 | 692 | | |
693 | | - | |
| 693 | + | |
694 | 694 | | |
695 | 695 | | |
696 | 696 | | |
| |||
718 | 718 | | |
719 | 719 | | |
720 | 720 | | |
| 721 | + | |
| 722 | + | |
721 | 723 | | |
722 | 724 | | |
723 | | - | |
| 725 | + | |
724 | 726 | | |
725 | 727 | | |
726 | 728 | | |
727 | 729 | | |
728 | 730 | | |
729 | 731 | | |
730 | 732 | | |
731 | | - | |
| 733 | + | |
732 | 734 | | |
733 | 735 | | |
734 | 736 | | |
| |||
776 | 778 | | |
777 | 779 | | |
778 | 780 | | |
779 | | - | |
| 781 | + | |
| 782 | + | |
780 | 783 | | |
781 | 784 | | |
782 | 785 | | |
| |||
799 | 802 | | |
800 | 803 | | |
801 | 804 | | |
802 | | - | |
| 805 | + | |
803 | 806 | | |
804 | 807 | | |
805 | 808 | | |
| |||
873 | 876 | | |
874 | 877 | | |
875 | 878 | | |
876 | | - | |
| 879 | + | |
877 | 880 | | |
878 | 881 | | |
879 | 882 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
93 | | - | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
162 | 163 | | |
163 | 164 | | |
164 | 165 | | |
165 | | - | |
| 166 | + | |
166 | 167 | | |
167 | 168 | | |
168 | 169 | | |
| |||
0 commit comments