Skip to content

fix(tools): Show a span's recorded attributes in get_span_details - #2441

Draft
sentry-junior[bot] wants to merge 2 commits into
mainfrom
fix/span-details-recorded-attributes
Draft

sentry-junior[bot] wants to merge 2 commits into
mainfrom
fix/span-details-recorded-attributes

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

get_span_details builds its span view from the organization trace endpoint. That endpoint only returns fixed span columns: SerializedSpan has no tags or data (sentry src/sentry/snuba/trace.py, _serialize_rpc_event), and additional_attributes only holds names the caller asks for, which MCP never does. So for EAP spans the tool always printed Tags {} and Data {}, and agents read that as "this span recorded nothing", even when search_traces can read attributes like http.request.method from the same span.

This PR fetches the focused span from GET /projects/{org}/{project}/trace-items/{span_id}/?trace_id=…&item_type=spans (sentry project_trace_item_details.py, the endpoint the CLI's span view already uses) and renders the result as a ### Recorded Attributes section. The keys are the names search accepts, such as http.request.method or tags[retry_count,number], so agents can copy them into search_traces.

  • SentryApiService.getSpanAttributes and a loose TraceItemDetailsSchema (values stay unknown, since Sentry sends int64 values as strings; see span view / trace view drop span details: trace-items schema mismatch #1471).
  • If the call fails, the span still renders, with a note saying its recorded attributes weren't returned. 4xx and config errors aren't reported to Sentry; anything else goes through logIssue.
  • The mocks get a default empty trace-items handler, so the existing focused-span snapshots only add an empty section.
  • The overview path (get_trace_details without spanId) is unchanged and makes no extra call.

Open decision: this keeps the existing Tags / Data / Additional Attributes sections, which are always empty for EAP spans. Dropping them would make the output shorter, but older fixtures still carry tags.

Related: #2211 and #2251 cover the related ask to list attribute names when search validation rejects a key.

via automation evt_905b9c478746fd9deeb853f85ad7441b · Run ID dispatch_ebeb379d306b37123de88567371dea0a.

--

View Session [Sentry]

Sentry's trace endpoint returns only fixed span columns, so
get_span_details showed empty Tags and Data for spans whose SDK
recorded attributes such as http.request.method. Fetch the span from
the trace-items details endpoint and render its attributes under the
names search accepts. If that call fails, the span still renders with
a note.
@vercel

vercel Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cli Ready Ready Preview Nov 19, 2026 10:23pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Nov 19, 2026 10:23pm UTC

Request Review

This branch was successfully deployed

2 active and 1 inactive deployments
Preview – cli — 7e5166c8 Deployed Nov 19, 2026 by vercel[bot]
Actions — 7e5166c8 Deployed Nov 19, 2026 by sentry-junior[bot] via eval #1994
Preview – sentry-local — 7e5166c8 Deployed Nov 19, 2026 by vercel[bot]
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.

0 participants