Skip to content

explore: canonical source for sortable dataset list (errors/discover) #1584

Closed

Description

@jared-outpost

In getsentry/cli#1520 we hard-coded SORTABLE_DATASETS = new Set(["spans", "errors", "discover"]) based on live-org probe + existing spans guard.

We should have a canonical, machine-readable source (or at least a documented contract) rather than a static list that can drift. Possible homes:

  • @sentry/api SDK
  • Sentry server (events endpoint capability)
  • Snuba schema / Discover docs

This would let the CLI (and other clients) query "which datasets accept sort on grouped aggregates?" instead of maintaining a hand-curated set.

cc @BYK

Activity

  1. added
    jaredTrigger the Jared agent to work on stuff
    on Sep 2, 2026
  2. self-assigned this
    on Sep 2, 2026
  3. linear-code commented on Oct 22, 2026

    @linear-code
  4. transferred this issue fromgetsentry/clion Oct 22, 2026
  5. sentry-junior commented on Oct 22, 2026

    @sentry-junior
    Contributor

    Closing this as no longer valid. #1521 removed the hard-coded SORTABLE_DATASETS list, so there's nothing left to replace with a canonical source.

    It turned out there isn't a per-dataset sort capability to look up: every Events dataset (errors, spans, logs, tracemetrics, and so on) accepts sort. The one rule Sentry enforces is that the sort column has to be selected. RPC datasets return "orderby must also be in the selected columns or groupby", and errors events-stats returns "Cannot sort by a field that is not selected." That 400 is why the original list looked like dataset support.

    That rule now lives in one shared place, packages/toolkit-core/src/events-sort.ts (resolveEventsSort / ensureSortInFields). The CLI's sentry explore, dashboard widgets, and MCP search_events all use it. It adds the sort column to field when that's safe, and defaults grouped queries to their first aggregate descending. A capability endpoint in Sentry or @sentry/api would have nothing to report beyond that rule, so I don't think it's worth pursuing.

    If a dataset that really doesn't support sort shows up later, we can reopen this and use that as the starting point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestjaredTrigger the Jared agent to work on stuff

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions