fix(api-docs): widen dataset enum on /events/ to include discover, errors, transactions#114787
Merged
MathurAditya724 merged 4 commits intomasterfrom May 4, 2026
Merged
Conversation
The OpenAPI spec for GET /organizations/{org}/events/ had two gaps
blocking the generated @sentry/api TypeScript SDK from being usable
for paginated queries against legacy datasets:
1. The dataset enum only declared [logs, profile_functions, spans,
uptime_results]. The runtime (DATASET_OPTIONS in snuba/utils.py)
also accepts discover, errors, and transactions. Add those three
stable values to the enum; internal/deprecated aliases are
intentionally omitted.
2. The cursor query parameter was not declared. The endpoint uses
self.paginate() with cursor-based pagination at runtime, but
the @extend_schema parameters list was missing CursorQueryParam.
Add it, following the pattern used by 42 other paginated endpoints.
Together these unblock getsentry/cli from migrating 4 raw
apiRequestToRegion call sites to the typed SDK function
(queryExploreEventsInTableFormat) and its auto-generated
pagination wrappers (getsentry/sentry-api-schema#69).
5ef93a6 to
c298a64
Compare
JoshFerge
approved these changes
May 4, 2026
3 tasks
cleptric
pushed a commit
that referenced
this pull request
May 5, 2026
…rors, transactions (#114787) The OpenAPI spec for `GET /organizations/{org}/events/` declares `dataset` as `["logs", "profile_functions", "spans", "uptime_results"]` only. The runtime (`DATASET_OPTIONS` in `snuba/utils.py`) accepts many more values including `"discover"`, `"errors"`, and `"transactions"`. This mismatch causes the generated `@sentry/api` TypeScript SDK to reject these dataset values at the type level, forcing consumers (e.g. `getsentry/cli`) to bypass the SDK and use raw HTTP requests for any query targeting these datasets. ## Changes - Add `"discover"`, `"errors"`, and `"transactions"` to the `VisibilityParams.DATASET` enum in `src/sentry/apidocs/parameters.py` - Internal, metrics-layer, and deprecated aliases (e.g. `"ourlogs"`, `"metricsEnhanced"`, `"spansIndexed"`) are intentionally omitted to keep the public API surface stable ## Testing No behavior change — this only affects OpenAPI spec generation. The runtime already accepts all three values via `DATASET_OPTIONS`. ## Context In `getsentry/cli`, 4 paginated call sites in `src/lib/api/` (`fetchTransactionsPage`, `fetchSpansPage`, `fetchEventsPage`, `queryWidgetTable`) use raw `apiRequestToRegion` instead of the SDK's `queryExploreEventsInTableFormat` solely because the generated types reject their `dataset` values. Fixing the enum here unblocks migration to the typed SDK function. Related: `getsentry/sentry-api-schema#69` (pagination wrappers — blocked on this enum for full CLI adoption). <!-- ## Plan 1. Widen the `dataset` enum on `VisibilityParams.DATASET` in `src/sentry/apidocs/parameters.py` from `["profile_functions", "logs", "spans", "uptime_results"]` to `["discover", "errors", "logs", "profile_functions", "spans", "transactions", "uptime_results"]` 2. Keep internal/deprecated/metrics-layer dataset aliases out of the public enum 3. No runtime changes needed — the server already accepts these values 4. Affects both `/events/` (table) and `/events-stats/` (timeseries) endpoints since both reference `VisibilityParams.DATASET` -->
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.
The OpenAPI spec for
GET /organizations/{org}/events/declaresdatasetas["logs", "profile_functions", "spans", "uptime_results"]only. The runtime (DATASET_OPTIONSinsnuba/utils.py) accepts many more values including"discover","errors", and"transactions".This mismatch causes the generated
@sentry/apiTypeScript SDK to reject these dataset values at the type level, forcing consumers (e.g.getsentry/cli) to bypass the SDK and use raw HTTP requests for any query targeting these datasets.Changes
"discover","errors", and"transactions"to theVisibilityParams.DATASETenum insrc/sentry/apidocs/parameters.py"ourlogs","metricsEnhanced","spansIndexed") are intentionally omitted to keep the public API surface stableTesting
No behavior change — this only affects OpenAPI spec generation. The runtime already accepts all three values via
DATASET_OPTIONS.Context
In
getsentry/cli, 4 paginated call sites insrc/lib/api/(fetchTransactionsPage,fetchSpansPage,fetchEventsPage,queryWidgetTable) use rawapiRequestToRegioninstead of the SDK'squeryExploreEventsInTableFormatsolely because the generated types reject theirdatasetvalues. Fixing the enum here unblocks migration to the typed SDK function.Related:
getsentry/sentry-api-schema#69(pagination wrappers — blocked on this enum for full CLI adoption).