Repository navigation
feat(apidocs): Publish trace-logs endpoint - #130357
Merged
Merged
Conversation
Publish GET /organizations/{org}/trace-logs/ in the public API schema so
it reaches @sentry/api. Type each log row and describe every response
field, and fix the example's timestamp_precise, which the endpoint
returns as an integer.
Refs #130351
Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
Publishing the trace-logs endpoint adds it to the agent token public GET matrix. The endpoint returns 400 without a traceId or replayId, so give it one like the other endpoints that need query params.
BYK
approved these changes
Nov 7, 2026
BYK
enabled auto-merge (squash)
November 7, 2026 16:04
BYK
added a commit
to getsentry/toolkit
that referenced
this pull request
Nov 7, 2026
… revision operations (#2093) Next batch of moving the CLI onto `@sentry/api` generated operations (follows #2073, #2075, #2078, #2090). `@sentry/api` 1.49.0 publishes three endpoints the CLI already calls: | CLI function | Endpoint | Operation | Published by | | --- | --- | --- | --- | | `listTraceLogs` (`log list --trace`, `trace logs`) | `GET /organizations/{org}/trace-logs/` | `listOrganizationTraceLogs` | getsentry/sentry#130357 | | `listDashboardRevisionsPaginated` (`dashboard revisions`) | `GET /organizations/{org}/dashboards/{id}/revisions/` | `listOrganizationDashboardRevisions` | getsentry/sentry#130358 | | `restoreDashboardRevision` (`dashboard restore`) | `POST /organizations/{org}/dashboards/{id}/revisions/{rev}/restore/` | `restoreOrganizationDashboardRevision` | getsentry/sentry#130358 | These calls stop using `apiRequestToRegion` and behave the same as before: - The CLI's valibot schemas still validate each response, so schema mismatches still fail as "Unexpected response format". - Region routing goes through `getOrgSdkConfig`. - Pagination still uses the Link-header cursors, including the previous cursor for revisions. - 401/403 errors are still enriched by `unwrapResult`. - On the wire, `traceId` and `sort` are sent as single repeated params, the same as before. - The dashboard and revision ids are passed as strings with the same cast `getDashboard` uses. The SDK URL-encodes them the way the old code did. All three operations have `experimental: false`. Bumping to 1.49.0 also pulls in the 1.47.0 regen and 1.48.0's `experimental` flag. Typecheck and generated docs don't change. ### Still on the helpers | Call site | Endpoint | Waiting on | | --- | --- | --- | | `issues.ts` `getSharedIssue` (raw fetch) | `GET /shared/issues/{share_id}/` | getsentry/sentry#130359 merged after the 1.49.0 regen, so it needs the next release | | `releases.ts` set-commits | `GET /organizations/{org}/releases/{version}/previous-with-commits/` | same as above (#130359) | | `org-auth-tokens.ts` (3 sites) | list/create/delete `/organizations/{org}/org-auth-tokens/` | getsentry/sentry#130360 (auto-merging) | | `projects.ts` dsn-lookup | `GET /organizations/{org}/dsn-lookup/` | getsentry/sentry#130367 | | `auth.ts` | `GET /api/0/` (control silo) | getsentry/sentry#130369 | | `users.ts` | `GET /auth/` → `GET /users/me/` | getsentry/sentry#130368 | | `organizations.ts` | `GET /users/me/regions/` | #2091 replaces it with `listOrganizations` | | `traces.ts` / `logs.ts` | `GET /projects/{org}/{project}/trace-items/{id}/` | sentry publish PR still to come | | `preprod-artifacts.ts` | build assemble, snapshot archive status and trigger, snapshot create (zstd body) | sentry publish PRs still to come | | `projects.ts` | `GET /projects/?query=dsn:` fallback for old self-hosted servers | not public; needs a decision (see below) | These are the agreed exceptions: `trials.ts` (`/customers/*` and the product-trial PUT), snapshot `upload-options` and archive `?download`, `downloadBuildArtifact`'s install URL, chunk-upload server URLs, and `rawApiRequest` for `sentry api`. **Needs a decision:** the self-hosted DSN fallback from #2090 calls `GET /projects/?query=dsn:`, which isn't in the public schema. It needs to be added to the exception list for the lint rule, or dropped once old self-hosted versions age out. ### Testing - `pnpm run tsc` and `pnpm run lint` pass. - `pnpm run test` fails only on the 5 file-permission tests that also fail on `main` in the sandbox (`completions` ×2, `upgrade`, `db/resilient`, `dsn/code-scanner`), plus `@sentry/cli3to4`, whose codemod binary needs GLIBC 2.35. - Added unit tests for the revision list (cursors, schema rejection) and for restore (operation args, error naming). The trace-logs test now checks `traceId` and `sort` on the wire. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A80220b9d4c297e2a971f05dcb03af515 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A80220b9d4c297e2a971f05dcb03af515) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A80220b9d4c297e2a971f05dcb03af515/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: BYK <126780+BYK@users.noreply.github.com>
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.
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/apiSDK.This comes from the #130351 proposal. The Sentry CLI is moving every call onto
@sentry/apioperations (getsentry/toolkit#2073). Itslog listandtrace logscommands still call this endpoint by hand because it isn't in the schema.Evidence:
extend_schemabut left itPRIVATE.useTraceOverviewData,useLogsApiOptions)log listandtrace logscommandsThe 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 aTraceLogTypedDict, and every field has anApiDescription.I checked the types against a real response from the endpoint:
project.idandtimestamp_preciseare integers. The example'stimestamp_precisewas a float, so it's now an integer.timestampis ISO 8601.confidenceis one empty object per row, because logs aren't aggregated.full_scan,bytes_scannedandroutingHintare 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 newlistOrganizationTraceLogsoperation and itsTraceLogsResponsecomponent. The new apidocs test validates a stored log against the schema.Publishing the endpoint also adds it to the agent token public GET matrix in
tests/sentry/seer/endpoints/test_organization_agent_token.py. The endpoint returns 400 without atraceIdorreplayId, so the matrix now passes atraceId, the same way it handles other endpoints that need query params. That test file passes locally.tests/snuba/api/endpoints/test_organization_trace_logs.py::test_simplefailed once under-n3. It passes when the file runs serially. The likely cause is that the tests share trace IDs in Snuba when they run in parallel, but I haven't confirmed that.The "(Optional) Shows the difference between the prod and dev schema" check is expected to fail, because this PR changes the schema.
via @BYK.
--
View Session [Sentry]