Skip to content

feat(event): expand 'event list' to support org-scoped Discover/Events queries #672

Description

@BYK

Background

PR #671 added sentry event list <issue-id> for issue-scoped event listing. This issue tracks expanding it to support org-wide and project-scoped event queries via the Sentry Discover/Events API.

Proposed Usage

# Org-scoped: list error events across all projects
sentry event list my-org/ --dataset errors

# Project-scoped: list events for a specific project
sentry event list my-org/my-project/ --dataset errors

# With search query
sentry event list my-org/ --dataset transactions -q "transaction:/api/users"

# Specific fields
sentry event list my-org/ --dataset spans --field id --field timestamp --field description

Design Considerations

The Discover API (GET /organizations/{org}/events/) has dynamic response fields — the shape depends on which field params are requested. This differs from every other list command which has fixed table columns.

Key decisions needed:

  1. Default field sets per dataset — Each dataset (errors, transactions, spans, logs) should have sensible default columns if --field isn't specified
  2. Dynamic table rendering — The table formatter needs to handle arbitrary field sets
  3. Dataset flag--dataset to select which event type (errors, transactions, spans, logs, discover)
  4. --field flag — Repeatable flag to specify which columns to query/display
  5. SDK type gap — The @sentry/api SDK's typed dataset parameter only accepts logs | profile_functions | spans | uptime_results. Datasets like errors and transactions require raw apiRequestToRegion calls.

Existing Infrastructure

  • src/lib/api/traces.ts — Already calls /events/?dataset=transactions and dataset=spans
  • src/lib/api/logs.ts — Already calls queryExploreEventsInTableFormat with dataset=logs
  • src/lib/api/dashboards.ts — Most generic usage, maps widget types to datasets
  • sentry api organizations/{org}/events/ -F dataset=errors -F field=id — Works today as escape hatch

Implementation Plan

  1. Create a generic queryEvents() function in src/lib/api/events.ts that wraps the Discover endpoint
  2. Define default field sets per dataset in a config map
  3. Add --dataset and --field flags to event list
  4. Detect the target mode from positional args: issue ID vs org/ vs org/project/
  5. Use dynamic table columns when field sets are custom
  6. Handle pagination (cursor-based, same as other list commands)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions