Skip to content

fix(v10/browser): Apply urlQueryParams to event URLs, static span names and LCP URLs - #25297

Draft
sentry-junior[bot] wants to merge 1 commit into
v10from
backport/v10-25262-browser-sensitive-query-params
Draft

sentry-junior[bot] wants to merge 1 commit into
v10from
backport/v10-25262-browser-sensitive-query-params

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

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.

via Junior system actor junior.

--

View Junior Session [Sentry]

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.24 kB added added
@sentry/browser - with treeshaking flags 26.68 kB added added
@sentry/browser (incl. Tracing) 47.15 kB added added
@sentry/browser (incl. Tracing + Span Streaming) 48.95 kB added added
@sentry/browser (incl. Tracing, Profiling) 51.94 kB added added
@sentry/browser (incl. Tracing, Replay) 86.57 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 76.19 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 91.29 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 103.94 kB added added
@sentry/browser (incl. Feedback) 45.42 kB added added
@sentry/browser (incl. sendFeedback) 33.04 kB added added
@sentry/browser (incl. FeedbackAsync) 38.18 kB added added
@sentry/browser (incl. Metrics) 29.33 kB added added
@sentry/browser (incl. Logs) 29.56 kB added added
@sentry/browser (incl. Metrics & Logs) 30.24 kB added added
@sentry/react 30.05 kB added added
@sentry/react (incl. Tracing) 49.5 kB added added
@sentry/vue 34.05 kB added added
@sentry/vue (incl. Tracing) 49.55 kB added added
@sentry/svelte 28.26 kB added added
CDN Bundle 30.61 kB added added
CDN Bundle (incl. Tracing) 49.11 kB added added
CDN Bundle (incl. Logs, Metrics) 32.19 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 50.46 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 71.61 kB added added
CDN Bundle (incl. Tracing, Replay) 86.82 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.09 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 92.61 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 93.92 kB added added
CDN Bundle - uncompressed 90.99 kB added added
CDN Bundle (incl. Tracing) - uncompressed 148.06 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 95.7 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 152.04 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 221.05 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 267.88 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 271.85 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 281.58 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 285.54 kB added added
@sentry/nextjs (client) 52.04 kB added added
@sentry/sveltekit (client) 47.6 kB added added
@sentry/core/server 81.55 kB added added
@sentry/core/browser 67.64 kB added added
@sentry/node-core 63.92 kB added added
@sentry/node 127.11 kB added added
@sentry/node (incl. diagnostics channel injection) 171.29 kB added added
@sentry/node/import (ESM hook with diagnostics-channel injection) 166 B added added
@sentry/node/light 51.99 kB added added
@sentry/node - without tracing 75.7 kB added added
@sentry/aws-serverless 84.86 kB added added
@sentry/cloudflare (withSentry) - minified 204.74 kB added added
@sentry/cloudflare (withSentry) 504.74 kB added added

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant