Skip to content

feat: expose span attributes/data in trace and span views #736

@betegon

Description

@betegon

Description

When viewing traces with sentry trace view --json, spans only include standard fields (description, op, duration, project). Custom span attributes and data payloads are not included. This makes it impossible to debug application-specific issues from the CLI.

Context

Trace: e998143883414695ad5600a058581fcb
UI: https://sentry.sentry.io/explore/traces/trace/e998143883414695ad5600a058581fcb/

While debugging a sentry init wizard failure, the trace had workflow.step spans with descriptions like workflow_step apply-codemods. But there was no way to see:

  • What files were in the patchset
  • What the specific error message was
  • Which edit failed and why
  • What the agent's codemod plan contained

The only visible data was the span description and duration. All the useful debugging context (error messages, file paths, edit content) was either in span attributes or the linked event — neither accessible from the CLI.

Expected behavior

sentry trace view --json and sentry span view --json should include span attributes/data when available. Something like:

{
  "description": "workflow_step apply-codemods",
  "op": "workflow.step",
  "duration": 987,
  "attributes": {
    "wizard.patches": ["instrument.ts", "app.ts", "package.json"],
    "wizard.error": "Edit #1 failed on package.json: oldString and newString are identical"
  }
}

Impact

Without span attributes, debugging cross-service traces requires either:

  1. Access to the Sentry web UI (not always available in terminal workflows)
  2. Adding custom logging and re-running the failing scenario
  3. Parsing event details (which also didn't work — see bug: sentry event view cannot find events visible in trace view #734)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions