fix(eap): Resolve unprefixed new attributes to their public alias - #118917
fix(eap): Resolve unprefixed new attributes to their public alias#118917buenaflor wants to merge 1 commit into
Conversation
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.
mjq
left a comment
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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_overridesto generate reverse-map entries for unprefixed convention-canonical attribute names (excluding deprecated canonical/alias forms). - Extend
SPANS_INTERNAL_TO_PUBLIC_ALIAS_MAPPINGSto 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.
| def _unprefixed_convention_overrides( | ||
| search_type: Literal["string", "number", "boolean"], | ||
| ) -> dict[str, str]: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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"), |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 3493f5d. Configure here.


Some span attributes (
os.name,os.rooted,browser.name,user.email,user.id, and severaldevice.*/user.geo.*fields) come back from the trace-items API wrapped astags[name,type]instead of their clean public alias when the underlying span data uses the unprefixed attribute name.The registry's
simple_sentry_fieldhelper assumes an attribute's internal storage key issentry.<public_alias>. Span-v2/streaming SDKs write several of these attributes unprefixed instead, matching the current canonical name insentry_conventions(e.g.os.namerather thansentry.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 intags[name,type]rather than resolving cleanly._unprefixed_convention_overridesadds 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 insentry_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:
After (only together with the frontend fix as well):