Repository navigation
fix(tools): Show a span's recorded attributes in get_span_details - #2441
Draft
sentry-junior[bot] wants to merge 2 commits into
Draft
sentry-junior[bot] wants to merge 2 commits into
sentry-junior[bot] wants to merge 2 commits into
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
get_span_detailsbuilds its span view from the organization trace endpoint. That endpoint only returns fixed span columns:SerializedSpanhas notagsordata(sentrysrc/sentry/snuba/trace.py,_serialize_rpc_event), andadditional_attributesonly holds names the caller asks for, which MCP never does. So for EAP spans the tool always printedTags {}andData {}, and agents read that as "this span recorded nothing", even whensearch_tracescan read attributes likehttp.request.methodfrom the same span.This PR fetches the focused span from
GET /projects/{org}/{project}/trace-items/{span_id}/?trace_id=…&item_type=spans(sentryproject_trace_item_details.py, the endpoint the CLI'sspan viewalready uses) and renders the result as a### Recorded Attributessection. The keys are the names search accepts, such ashttp.request.methodortags[retry_count,number], so agents can copy them intosearch_traces.SentryApiService.getSpanAttributesand a looseTraceItemDetailsSchema(values stayunknown, since Sentry sends int64 values as strings; see span view / trace view drop span details: trace-items schema mismatch #1471).logIssue.get_trace_detailswithoutspanId) is unchanged and makes no extra call.Open decision: this keeps the existing
Tags/Data/Additional Attributessections, which are always empty for EAP spans. Dropping them would make the output shorter, but older fixtures still carrytags.Related: #2211 and #2251 cover the related ask to list attribute names when search validation rejects a key.
via automation
evt_905b9c478746fd9deeb853f85ad7441b· Run IDdispatch_ebeb379d306b37123de88567371dea0a.--
View Session [Sentry]