Skip to content

fix(explore): Unwrap typed span link attribute values in trace item details - #125749

Merged
s1gr1d merged 1 commit into
masterfrom
sig/unwrap-link-attributes
Oct 5, 2026
Merged

s1gr1d merged 1 commit into
masterfrom
sig/unwrap-link-attributes

Conversation

@s1gr1d

@s1gr1d s1gr1d commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

The trace item details endpoint drops all span link attributes that were ingested through the span pipeline, so links like
sentry.link.type: cache_origin show up in the trace view with no type.

The two pipelines store sentry.links differently. The transaction pipeline stores bare scalars ("sentry.link.type": "parent"), which serialize_link handles. The span pipeline (process_segments/convert.py) keeps the span V2 typed envelope
({"type": "string", "value": "parent"}), and infer_type returns None for dicts, filtering every attribute out.

Both shapes exist in storage, so this normalizes on read: unwrap the envelope before inferring the type. Added a test mirroring test_sentry_links with envelope-shaped input.

Linear: https://linear.app/getsentry/issue/JSSDK-23/sentry-backend-make-link-type-available-so-its-usable-in-the-sentry-ui

Related to this: getsentry/sentry-javascript#24227

@s1gr1d
s1gr1d requested review from a team as code owners September 28, 2026 15:30
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Sep 28, 2026
@s1gr1d

s1gr1d commented Sep 29, 2026

Copy link
Copy Markdown
Member Author

bugbot run

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 869125e. Configure here.

s1gr1d added a commit that referenced this pull request Oct 2, 2026
Adds a "Cache Lifecycle" section to the span details drawer for
`cache.get` and `cache.put` spans. It shows the entry as a timeline:
filled, hit/miss (this span), expires.

On reads, it resolves the `cache_origin` span link, fetches the fill
span, and shows the origin transaction, source file, and put duration,
with a button that opens the origin span.

Notes for review:

- Gated behind `organizations:performance-trace-cache-lifecycle`
(registered in #126184).
- Reuses data we already have: the span's `cache.*` attributes and its
span links. The only extra request fetches the linked fill span via
`useTraceItemDetails`.
- Workarounds for missing backend pieces, marked with a `TODO(cache)`
comment: typed link attributes are dropped until #125749 is merged
(single untyped link is treated as the origin) and the origin fetch
borrows the log-details referrer.

<img width="1837" height="860" alt="image"
src="https://github.com/user-attachments/assets/7a8b6a19-746c-4ddf-8ebb-ada54770c39f"
/>




### hit 
<img width="679" height="256" alt="image"
src="https://github.com/user-attachments/assets/2e0a8058-237c-4abf-84d1-781c4acae503"
/>

### miss
<img width="693" height="118" alt="image"
src="https://github.com/user-attachments/assets/b038d13e-8cd7-403b-9c2f-e1b73f703dc5"
/>

### fill
<img width="694" height="120" alt="image"
src="https://github.com/user-attachments/assets/90b7f646-bfc1-4f1b-90e3-0ac207521fe2"
/> |
 
 
Linear:
https://linear.app/getsentry/issue/JSSDK-28/add-cache-lifecycle-experience-to-the-product

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

Ahhh, good catch - thanks! It would be nice to fix this so we only have a single serialization format, but we'll need this no matter what for current/historical data. 👍

@s1gr1d
s1gr1d merged commit 9eb4829 into master Oct 5, 2026
73 checks passed
@s1gr1d
s1gr1d deleted the sig/unwrap-link-attributes branch October 5, 2026 15:40
s1gr1d added a commit that referenced this pull request Oct 7, 2026
We can access the attributes of span links now and show a more useful
representation of span links.
- Ref: #125749

---


- Span links in the drawer are now grouped by `sentry.link.type` (e.g.
`previous_trace`), not `span_link_1`. Untyped links show as `link`, and
repeated types get a counter.
- Adds a shared `getSpanLinkType` helper
- Updates TODO comments that needed change since merging #125741 
### Example

With multiple links: when a link type appears more often, it's numbered.

Be aware that the very nested `attributes.sentry.link.type` was only
shown since this PR (let us show the attributes):
#125749

One "Before" before (you know, before the span links were unwrapped),
there was just the `spanId` and `traceId`

|  Before  |  After  |
|---|---|
| <img width="300" height="579" alt="image"
src="https://github.com/user-attachments/assets/14ae0665-c1e9-41f3-a2be-94e62b8af862"
/> | <img width="264" height="579" alt="image"
src="https://github.com/user-attachments/assets/afa59996-4cfe-45e9-9c2e-33dfd07233b4"
/> |
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.

2 participants