Skip to content

docs(api): Document trace item validate, ranked, and trace logs endpoints - #126626

Merged
DominikB2014 merged 1 commit into
masterfrom
dominikbuszowiecki/eng-8772-document-trace-items-eap-endpoints
Oct 7, 2026
Merged

DominikB2014 merged 1 commit into
masterfrom
dominikbuszowiecki/eng-8772-document-trace-items-eap-endpoints

Conversation

@DominikB2014

Copy link
Copy Markdown
Contributor

Add @extend_schema docs (params, response types, examples) for:

  • POST /organizations/{org}/trace-items/attributes/validate/
  • GET /organizations/{org}/trace-items/attributes/ranked/
  • GET /organizations/{org}/trace-logs/

All stay PRIVATE for now. Part of ENG-8606.

Fixes ENG-8772

@linear-code

linear-code Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

ENG-8606

ENG-8772

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 6, 2026
…ints

Add OpenAPI schemas and response types for the three endpoints. All stay PRIVATE.

Fixes ENG-8772
@DominikB2014
DominikB2014 force-pushed the dominikbuszowiecki/eng-8772-document-trace-items-eap-endpoints branch from 9447f2f to cd20b3f Compare October 6, 2026 19:47
@DominikB2014
DominikB2014 marked this pull request as ready for review October 7, 2026 14:36
@DominikB2014
DominikB2014 requested review from a team as code owners October 7, 2026 14:36
@DominikB2014
DominikB2014 merged commit 50fac6b into master Oct 7, 2026
75 checks passed
@DominikB2014
DominikB2014 deleted the dominikbuszowiecki/eng-8772-document-trace-items-eap-endpoints branch October 7, 2026 14:54
BYK added a commit that referenced this pull request Nov 7, 2026
Publishes `GET
/api/0/organizations/{organization_id_or_slug}/trace-logs/`
(`OrganizationTraceLogsEndpoint`, owner Data Browsing) in the public API
schema, so it reaches the generated `@sentry/api` SDK.

This comes from the #130351 proposal. The Sentry CLI is moving every
call onto `@sentry/api` operations (getsentry/toolkit#2073), and `log
list` and `trace logs` still call this endpoint by hand because it isn't
in the schema.

Evidence:
- The endpoint has existed since #92501 (2025-05). #126626 documented it
fully with `extend_schema` but left it `PRIVATE`.
- Current callers: the trace view and logs explore pages
(`useTraceOverviewData`, `useLogsApiOptions`) and the CLI's `log list`
and `trace logs` commands.

The response type was `list[dict[str, Any]]`, which the
response-coverage check rejects for public operations. The endpoint
always selects the same eight columns, so each row is now a `TraceLog`
TypedDict, and every field has an `ApiDescription`. I checked the types
against a real response from the endpoint: `project.id` and
`timestamp_precise` are integers, `timestamp` is ISO 8601, and
`confidence` is one empty object per row because logs aren't aggregated.
The example's `timestamp_precise` was a float, so it's now an integer.
`full_scan`, `bytes_scanned` and `routingHint` are optional, because a
mocked or empty RPC meta can leave them out.

The only change to the built schema (`make build-api-docs`, diffed
against master) is the new `listOrganizationTraceLogs` operation and its
`TraceLogsResponse` component. The new apidocs test validates a stored
log against the schema.


`tests/snuba/api/endpoints/test_organization_trace_logs.py::test_simple`
failed once under `-n3` because tests share trace IDs in Snuba. It
passes when the file runs serially.

The "(Optional) Shows the difference between the prod and dev schema"
check is expected to fail, because this PR changes 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]>
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