Skip to content

feat(core): Send sentry.is_localhost on every streamed span - #24597

Merged
Lms24 merged 10 commits into
developfrom
lms/feat-core-is_localhost-attribute
Sep 23, 2026
Merged

Lms24 merged 10 commits into
developfrom
lms/feat-core-is_localhost-attribute

Conversation

@Lms24

@Lms24 Lms24 commented Sep 22, 2026

Copy link
Copy Markdown
Member

Following getsentry/sentry-conventions#646, this PR adds the new is_localhost attribute which we'll use to indicate to Relay/Sentry backend, whether the "filter out events coming from localhost" inbound filter should filter out spans or not.

See the conventions PR for reasoning why we ended up with this attribute rather than something more general.

See develop spec update for streamed spans: getsentry/sentry-docs#19559

Adding this is pretty, easy, as we can do it via requestDataIntegration for server, and httpContextIntegration for browser.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread packages/core/src/integrations/requestdata.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7007c3f. Configure here.

Comment thread dev-packages/deno-integration-tests/suites/is-localhost/test.ts Outdated
@github-actions

github-actions Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.23 kB +0.25% +71 B 🔺
@sentry/browser - with treeshaking flags 27.5 kB +0.27% +73 B 🔺
@sentry/browser - with treeshaking flags tracing without tracing 27.4 kB +0.26% +71 B 🔺
@sentry/browser (incl. Tracing) 51.03 kB +0.15% +74 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 51.02 kB +0.15% +74 B 🔺
@sentry/browser (incl. Tracing, Profiling) 54.04 kB +0.13% +66 B 🔺
@sentry/browser (incl. Tracing, Replay) 90.61 kB +0.08% +70 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 79.72 kB +0.09% +71 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 95.32 kB +0.08% +69 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 108.26 kB +0.07% +67 B 🔺
@sentry/browser (incl. Feedback) 46.76 kB +0.16% +71 B 🔺
@sentry/browser (incl. sendFeedback) 34.29 kB +0.22% +73 B 🔺
@sentry/browser (incl. FeedbackAsync) 39.39 kB +0.18% +70 B 🔺
@sentry/browser (incl. Metrics) 30.25 kB +0.24% +71 B 🔺
@sentry/browser (incl. Logs) 30.5 kB +0.24% +71 B 🔺
@sentry/browser (incl. Metrics & Logs) 31.17 kB +0.24% +73 B 🔺
@sentry/react 30.98 kB +0.24% +73 B 🔺
@sentry/react (incl. Tracing) 53.31 kB +0.14% +71 B 🔺
@sentry/vue 36.59 kB +0.21% +74 B 🔺
@sentry/vue (incl. Tracing) 53.41 kB +0.14% +70 B 🔺
@sentry/svelte 29.25 kB +0.25% +72 B 🔺
CDN Bundle 30.93 kB +0.24% +71 B 🔺
CDN Bundle (incl. Tracing) 51.55 kB +0.17% +84 B 🔺
CDN Bundle (incl. Logs, Metrics) 33.19 kB +0.23% +73 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 53.53 kB +0.15% +79 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 73.92 kB +0.1% +72 B 🔺
CDN Bundle (incl. Tracing, Replay) 89.09 kB +0.08% +65 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 91.06 kB +0.08% +67 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 95.26 kB +0.09% +79 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 97.23 kB +0.08% +76 B 🔺
CDN Bundle - uncompressed 91.4 kB +0.17% +150 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 153.48 kB +0.1% +150 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 97.97 kB +0.16% +150 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 159.43 kB +0.1% +150 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 227.54 kB +0.07% +150 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 273.21 kB +0.06% +150 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 279.15 kB +0.06% +150 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 286.91 kB +0.06% +150 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 292.84 kB +0.06% +150 B 🔺
@sentry/nextjs (client) 55.64 kB +0.13% +69 B 🔺
@sentry/sveltekit (client) 51.46 kB +0.15% +74 B 🔺
@sentry/core/server 39.92 kB - -
@sentry/core/browser 13.63 kB - -
@sentry/node 133.88 kB +0.24% +310 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 82.4 kB - -
@sentry/node - without tracing 90.39 kB +0.31% +274 B 🔺
@sentry/node - without channel injection 112.42 kB +0.3% +326 B 🔺
@sentry/aws-serverless 98.71 kB +0.34% +325 B 🔺
@sentry/cloudflare (withSentry) - minified 206.34 kB +0.43% +864 B 🔺
@sentry/cloudflare (withSentry) 513.42 kB +0.43% +2.18 kB 🔺

View base workflow run

Lms24 and others added 4 commits September 22, 2026 19:10
Tests that compare a whole span (or its full attribute bag) with `toEqual`
need the new attribute spelled out. Spans of a request served over localhost
get `true`; spans with no request in scope (db scripts, `sentry-test.io`
browser pages) get `false`.

Also bumps the `@sentry/cloudflare (withSentry)` size limit, which the extra
matching logic pushes 892 bytes over, and drops `spanStreamingIntegration()`
from the new browser test since streaming is the v11 default.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Covers the cases the first pass missed: the nestjs `@SentryTraced` helper
(reached via `toEqual(tracedSpan(...))` rather than an object literal) and the
redis/postgres suites, which need Docker and so only surfaced in CI.
Hardcoding `true` in the shared helpers was wrong for the app_creation span,
which is emitted at startup before any request and so is `false`. Every span
of a trace shares its segment's verdict, so deriving it covers both cases —
the same way the helper already derives `sentry.release`.
CI builds measure ~528 bytes larger than a local build, so the previous
501 KiB bump (sized off the local number) still failed at 513.42 kB. Sized
off CI's figure this time.
@Lms24 Lms24 self-assigned this Sep 22, 2026
@Lms24
Lms24 marked this pull request as ready for review September 22, 2026 19:06
@Lms24
Lms24 requested review from a team as code owners September 22, 2026 19:06
@Lms24
Lms24 requested review from isaacs, logaretm and mydea and removed request for a team September 22, 2026 19:06
Comment thread packages/browser/src/integrations/httpcontext.ts
`http://[::1]:3000` was reported as non-localhost. Note `location.hostname`
keeps the brackets for IPv6 hosts, so the comparison is against `[::1]`, not
`::1`. Server-side already covers this through the socket address.
@Lms24
Lms24 merged commit e986e10 into develop Sep 23, 2026
327 checks passed
@Lms24
Lms24 deleted the lms/feat-core-is_localhost-attribute branch September 23, 2026 06:52
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.

2 participants