Skip to content

fix(eap): Resolve unprefixed new attributes to their public alias - #118917

Open
buenaflor wants to merge 1 commit into
masterfrom
fix/eap-unprefixed-span-attribute-overrides
Open

fix(eap): Resolve unprefixed new attributes to their public alias#118917
buenaflor wants to merge 1 commit into
masterfrom
fix/eap-unprefixed-span-attribute-overrides

Conversation

@buenaflor

@buenaflor buenaflor commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Some span attributes (os.name, os.rooted, browser.name, user.email, user.id, and several device.*/user.geo.* fields) come back from the trace-items API wrapped as tags[name,type] instead of their clean public alias when the underlying span data uses the unprefixed attribute name.

The registry's simple_sentry_field helper assumes an attribute's internal storage key is sentry.<public_alias>. Span-v2/streaming SDKs write several of these attributes unprefixed instead, matching the current canonical name in sentry_conventions (e.g. os.name rather than sentry.os.name). The reverse map used to resolve an internal key back to its public alias only had an entry for the prefixed form, so the unprefixed key fell through to a defensive "ambiguous name" branch and got wrapped in tags[name,type] rather than resolving cleanly.

_unprefixed_convention_overrides adds a reverse-map entry for the unprefixed form wherever it is the package's current (non-deprecated) canonical name, so both the legacy prefixed and the newer unprefixed data resolve to the same public alias. Fields where the unprefixed name is itself deprecated in sentry_conventions (environment, release, runtime.name, app_start_type) are correctly excluded, since a compliant SDK wouldn't emit those unprefixed.

This also affects filtering/autocomplete in Explore, not just the trace-items details response, since both consume the same reverse map.


Before:

Screenshot 2026-07-06 at 14 26 37

After (only together with the frontend fix as well):

Screenshot 2026-07-06 at 14 26 51

Span-v2/streaming SDKs write some attributes (os.name, user.email,
browser.name, etc.) unprefixed, matching the current canonical name in
sentry_conventions. The registry's simple_sentry_field helper only
recognized the legacy sentry.<field> prefixed form, so the unprefixed
form fell into the ambiguous tags[name,type] representation instead of
resolving to its public alias.

Add unprefixed reverse-map entries wherever the unprefixed name is the
package's current (non-deprecated) canonical form, so both old prefixed
and new unprefixed data resolve to the same public alias.
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 2, 2026
@buenaflor buenaflor changed the title fix(eap): Resolve unprefixed span-v2 attributes to their public alias fix(eap): Resolve unprefixed new attributes to their public alias Jul 6, 2026

@mjq mjq left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This approach looks fine. Hopefully all this indirection inside Sentry won't be necessary once we start recording public names in conventions, but for now, this works.

@buenaflor
buenaflor marked this pull request as ready for review July 28, 2026 09:50
@buenaflor
buenaflor requested a review from a team as a code owner July 28, 2026 09:50
Copilot AI review requested due to automatic review settings July 28, 2026 09:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes span attribute name resolution in EAP so that attributes emitted unprefixed by newer span-v2/streaming SDKs (e.g. os.name, user.email) resolve to their expected public alias instead of falling back to the defensive tags[name,type] representation. This impacts both trace-items responses and Explore filtering/autocomplete since they share the same reverse-map.

Changes:

  • Add _unprefixed_convention_overrides to generate reverse-map entries for unprefixed convention-canonical attribute names (excluding deprecated canonical/alias forms).
  • Extend SPANS_INTERNAL_TO_PUBLIC_ALIAS_MAPPINGS to include these unprefixed entries for string/boolean/number (including boolean-as-number) attribute mappings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +744 to +746
def _unprefixed_convention_overrides(
search_type: Literal["string", "number", "boolean"],
) -> dict[str, str]:

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

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 3493f5d. Configure here.

},
}
| _unprefixed_convention_overrides("boolean")
| _unprefixed_convention_overrides("number"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reverse map breaks unprefixed filtering

High Severity

_unprefixed_convention_overrides maps stored keys like os.name to the public alias os.name, so autocomplete and details stop emitting tags[os.name,string]. Query resolution still sends that public alias to sentry.os.name via simple_sentry_field, so filters from Explore miss span-v2/unprefixed data that this change is meant to support.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 3493f5d. Configure here.

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

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants