Repository navigation
feat(explore): Add raw names to trace item details API - #130132
Merged
Merged
Conversation
In the trace item details endpoint, expose a new `rawName` field behind the `organizations:trace-item-details-raw-attribute-names` flag. This will enable us to conditionally show the original, unaliased name to users.
Contributor
There was a problem hiding this comment.
✅ 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 d6f40c2. Configure here.
mjq
marked this pull request as ready for review
November 5, 2026 21:16
adrianviquez
approved these changes
Nov 5, 2026
BYK
added a commit
that referenced
this pull request
Nov 9, 2026
Part of the #130351 proposal to publish the endpoints the Sentry CLI calls today with raw API requests, so they reach the public schema and the generated `@sentry/api` SDK. Owner: Data Browsing. `GET /projects/{org}/{project}/trace-items/{item_id}/` (`ProjectTraceItemDetailsEndpoint`) goes from `EXPERIMENTAL` to **`PUBLIC_EXPERIMENTAL`**. It stays experimental because the response shape is still changing (for example, `rawName` was added in #130132 on 2026-11-06). ### Evidence - Age: added in #86235 (2025-03-04); `trace_id` became required in #87905 (2025-03-25). - Callers: the Explore trace-item details hook (`static/app/views/explore/hooks/useTraceItemDetails.tsx`), the logs table rows and the trace drawer's "view JSON" links, plus the Sentry CLI. ### Changes **Commit 1: tooling, `feat(apidocs): Add an opt-in JsonValue response field type`** - `sentry.apidocs.formats.JsonValue` (`Annotated[object, ApiJsonValue()]`) renders as an explicit `anyOf` of object, array, string, number and boolean, described as "Any JSON value". - The response-coverage ratchet treats a `JsonValue` field as typed and doesn't descend into it. Its `x-sentry-json-value` marker is only emitted under `OPENAPIGENERATE` and is stripped on deref, like the cycle marker. - It's opt-in. **No existing operation changes**: after this commit `openapi-derefed.json` is byte-identical to master. - Unit tests in `tests/sentry/apidocs` and a README paragraph. **Commit 2: the endpoint** - `PUBLIC_EXPERIMENTAL`, `Explore` tag, `retrieveProjectTraceItem` / "Retrieve a Trace Item". - Documented params, checked against the serializer and the handler: `item_id`, `trace_id` (required), `item_type` (required; enum of the supported item types), `routing_hint`, `timestamp`, `statsPeriod`/`start`/`end`. `referrer` and the superuser-only `debug` stay undocumented. - `TraceItemDetailsResponse` and the nested `TraceItemLink`, `TraceItemLinkAttribute` and `TraceItemEvent` TypedDicts. The serializer helpers now return them. - `JsonValue` is used only for the free-form fields: the `meta` values (including the superuser `meta.debug_info`) and `event.contexts`/`extra`/`breadcrumbs`. Everything else is typed exactly. - `TraceItemAttribute` (`sentry/search/eap/types.py`) gets field descriptions. Its `value` is narrowed to `ScalarValueType | list[ScalarValueType]`: the only producer skips attributes without a value, so `None` was never returned. The skip check changed from `and` to `or`, which is the same at runtime (both are `None` or neither is) but lets mypy narrow the type. - 400s now use `as_validation_errors(serializer)`, the same shape as the other published endpoints. - Span and log response examples, and an apidocs test for both (a log with event fields, a span with links). - Agent-token permission matrix: a real log stored in EAP backs the new row, because the matrix requires a 200. ### Verification - `make build-api-docs` and a diff against master: only `retrieveProjectTraceItem` and its `TraceItemDetailsResponse` component are added. Nothing else changes. - Response-coverage ratchet: 0 fixed, 0 new entries. - `pnpm run validate-api-examples`: no errors. - `pytest tests/apidocs` 156 passed; `tests/sentry/apidocs` 170 passed. - Endpoint tests: `tests/snuba/api/endpoints/test_project_trace_item_details.py` 23 passed, 1 xpassed; `tests/sentry/api/endpoints/test_project_trace_item_details.py` 33 passed; `test_organization_events_occurrences.py` 20 passed, 1 xfailed; `test_organization_events_span_indexed.py` 181 passed, 3 skipped, 5 xfailed, 2 xpassed. - Snuba-backed tests failed under `-n3` with different failures on each run, which is likely xdist flakiness. Every file passed when rerun on its own without xdist. - Agent-token matrix: 328 passed, 23 xfailed (the new row passes). - prek and mypy (pre-push) pass on the changed files. The "(Optional) Shows the difference between the prod and dev schema" check is expected to fail on PRs that change the schema. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A22c5e57fa755cece5122380dcb72ec8e --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A22c5e57fa755cece5122380dcb72ec8e) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A22c5e57fa755cece5122380dcb72ec8e/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: BYK <[email protected]>
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.
In the trace item details endpoint, expose a new
rawNamefield behind theorganizations:trace-item-details-raw-attribute-namesflag.This will enable us to conditionally show the original, unaliased name to users. This is just an internal test on the Data Browsing team for now.
See EXP-1386.