observe-trace

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Observe Trace

观测追踪

Collect distributed trace spans for a task and build a visual trace tree showing the execution flow, timing, and bottlenecks.
为任务收集分布式追踪跨度(spans),并构建可视化追踪树以展示执行流程、时间开销和瓶颈。

When to use

使用场景

When you need to understand how a task was executed across agents -- which spans ran, how long each took, where bottlenecks occurred, and how agents coordinated.
当你需要了解任务在多个Agent之间的执行方式时——包括哪些跨度(spans)已运行、每个跨度耗时多久、瓶颈出现在何处,以及Agent之间如何协作。

Steps

操作步骤

  1. Collect spans -- call
    mcp__claude-flow__agentdb_hierarchical-recall
    to retrieve all spans matching the
    <task-id>
    from the
    observability
    namespace
  2. Build trace tree -- organize spans into a parent-child hierarchy using
    parentSpanId
    references, with the root span at the top
  3. Calculate timing -- for each span, compute duration (endTime - startTime), and identify the critical path (longest chain of sequential spans)
  4. Identify bottlenecks -- flag spans where duration exceeds the p95 for that operation type, or where gaps between spans suggest idle time
  5. Synthesize -- call
    mcp__claude-flow__agentdb_context-synthesize
    to combine span metadata into a narrative summary of the execution flow
  6. Report -- display the trace tree with: span name, agent, duration, status (OK/ERROR), and bottleneck flag; include total trace duration and critical path duration
  1. 收集跨度(spans)——调用
    mcp__claude-flow__agentdb_hierarchical-recall
    observability
    命名空间中检索所有匹配
    <task-id>
    的跨度
  2. 构建追踪树——利用
    parentSpanId
    引用将跨度组织成父子层级结构,根跨度位于顶部
  3. 计算时间开销——为每个跨度计算持续时间(endTime - startTime),并识别关键路径(最长的连续跨度链)
  4. 识别瓶颈——标记持续时间超过该操作类型p95值的跨度,或跨度之间存在间隙表明空闲时间的情况
  5. 合成总结——调用
    mcp__claude-flow__agentdb_context-synthesize
    将跨度元数据合并为执行流程的叙述性摘要
  6. 生成报告——展示包含以下信息的追踪树:跨度名称、Agent、持续时间、状态(正常/错误)和瓶颈标记;同时包含总追踪持续时间和关键路径持续时间

CLI alternative

CLI替代方案

bash
npx @claude-flow/cli@latest memory search --query "trace spans for task TASK_ID" --namespace observability
bash
npx @claude-flow/cli@latest memory search --query "trace spans for task TASK_ID" --namespace observability