Skip to content

sp trace

Phase: v2
When agents use this: User provides business ID (orderId, caseId) instead of traceId — preferred discovery path.

Synopsis

Attribute-based trace lookup and lightweight trace summary.

Subcommands

SubcommandDescription
findReverse lookup traces by extraction rule / attr
get <traceId>Summary metadata and extracted attrs
statsAttr rule statistics (optional)

Flags (find)

FlagDescription
--appApplication id (required)
--attr-nameRule name (e.g. orderId)
--attr-valueBusiness value (e.g. ORD-1234)
--since / --untilEpoch ms window (default: last 7 days)
--limitMax traces (default 20)

Modes:

  1. --attr-name + --attr-value — precise lookup
  2. --attr-name only — all traces hit by rule
  3. Neither — recent traces hit by any extraction rule

Examples

bash
sp trace find --app my-app --attr-name orderId --attr-value ORD-1234 --json
sp trace get 4bf92f3577b34da6a3ce929d0e0e4736 --json

JSON output (find)

json
{
  "ok": true,
  "command": "trace find",
  "data": {
    "items": [
      {
        "traceId": "4bf92f3577b34da6a3ce929d0e0e4736",
        "endpoint": "POST /api/order",
        "status": "OK",
        "durationMs": 120,
        "startedAt": "2026-05-18T10:00:00Z"
      }
    ]
  }
}

REST mapping

SubcommandMethodPath
findPOST/api/traces/find-by-attr
getGET/api/traces/{traceId}/summary
statsPOST/api/traces/attr-rule-statistics

Replaces sp_api

sp_apisp
find_traces_by_attrsp trace find
get_trace_summarysp trace get