Skip to content

feat(attributes): Add internal sentry.is_localhost attribute - #646

Merged
Lms24 merged 2 commits into
mainfrom
lms/feat-attr-is-localhost
Sep 23, 2026
Merged

Lms24 merged 2 commits into
mainfrom
lms/feat-attr-is-localhost

Conversation

@Lms24

@Lms24 Lms24 commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

This PR adds a new attribute marked as internal called sentry.is_localhost. The purpose of this is that SDKs must attach it to every telemetry item (all spans, logs, metrics) so that our "Filter out events from localhost" inbound filter can be applied to all attribute-exclusive telemetry.

We explored several more generic options, enumerated in #636, but the issue here basically boiled down to:

  • there's no generic attribute that makes sense on backend and frontend sdks
  • adding two attributes would be better but also begs the questions which ones, leading to
  • there's no untainted attribute yet that is not ambiguously used on multiple spans for different purposes. Just some examples
    • server.address is set on http.sever spans for the server host address (correct), but also for outgoing spans (http.client, db, etc) describing the target server address. So we can't apply it to every span.
    • Same for url.* attributes
    • This leaves us with host.* attributes which we could introduce newly, but there's no attribute in OTel that covers the domain. Only the ip address. So we'd again need to introduce a new attribute on top (something like host.address). Which is prone to be misused again. Hence the choice to go specific.
    • Fwiw, for browser, there would be browser.document.url.full, which could carry the current location host name, so theoretically we could use this as well. Though in this case, sentry.is_localhost works in both cases.

@Lms24
Lms24 requested review from a team, cleptric, mjq and nsdeschenes as code owners September 22, 2026 14:19
@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Attributes

  • Add internal sentry.is_localhost attribute by Lms24 in #646
  • Add the INP target and interaction type attributes by logaretm in #641
  • Deprecate the web vital report event attributes by logaretm in #642
  • Add React Native native module call attributes by alwx in #564
  • Use the web-vitals navigation types as-is for browser.navigation.type by logaretm in #640
  • Add legacy gen_ai cache token attributes (deprecated) by JPeer264 in #582

Other

  • (names) Add span name and description conventions for ui.* ops by Lms24 in #643
  • (op) Add ui.resolve span op by Lms24 in #633
  • (replays) Define replayId as a deprecated attribute by mjq in #401

Internal Changes 🔧

Deps

  • Bump devalue from 5.8.1 to 5.9.2 by dependabot in #639
  • Bump smol-toml from 1.6.1 to 1.8.0 by dependabot in #635

🤖 This preview updates automatically when you update the PR.

@Lms24 Lms24 self-assigned this Sep 22, 2026

@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.

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 e0abbde. Configure here.

@Lms24
Lms24 merged commit 48ba2a2 into main Sep 23, 2026
17 checks passed
@Lms24
Lms24 deleted the lms/feat-attr-is-localhost branch September 23, 2026 06:50
Lms24 added a commit to getsentry/sentry-javascript that referenced this pull request Sep 23, 2026
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.
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