Skip to content
Docs Try Aspire

aspire otel spans command

aspire otel spans - View spans from the Dashboard telemetry API.

Aspire CLI
aspire otel spans [resource] [options]

The aspire otel spans command retrieves and displays distributed trace spans collected by the Aspire Dashboard. Spans represent individual units of work within a distributed trace, such as HTTP requests or database calls. You can filter spans by resource name, trace ID, or error status. Use --follow to stream spans in real-time as they arrive.

  • [resource]

    Filter by resource name. When specified, only spans from the matching resource are shown. Supports both exact instance names and base resource names (which match all replicas).

The following options are available:

  • --apphost

    The path to the Aspire AppHost project file.

  • -f, --follow

    Stream telemetry in real-time as it arrives.

  • --format <Table|Json>

    Output format (Table or Json).

  • -n, --limit <limit>

    Maximum number of items to return.

  • --trace-id <trace-id>

    Filter by trace ID.

  • --has-error <true|false>

    Filter by error status (true to show only errors, false to exclude errors).

  • -?, -h, --help

    Prints help and usage documentation for the available commands and options.

  • -d, --debug

    Enable debug logging to the console, which prints detailed information about what Aspire CLI is doing when a command is run.

  • --wait-for-debugger

    Wait for a debugger to attach before running a command.

  • View all spans:

    Aspire CLI
    aspire otel spans
  • View spans for a specific resource:

    Aspire CLI
    aspire otel spans apiservice
  • Stream spans in real-time:

    Aspire CLI
    aspire otel spans --follow
  • View only error spans:

    Aspire CLI
    aspire otel spans --has-error true
  • View spans for a specific trace in JSON format:

    Aspire CLI
    aspire otel spans --trace-id abc123 --format Json