<svg xmlns="http://www.w3.org/2000/svg" width="960" height="540" viewBox="0 0 960 540" role="img" aria-labelledby="title desc">
  <title id="title">跨服务请求的Trace传播路径</title>
  <desc id="desc">展示一次请求从网关进入多个微服务，Trace上下文在HTTP、gRPC、消息队列和数据库调用中传播。</desc>
  <rect width="960" height="540" fill="#f8fafc"/>
  <defs>
    <marker id="arrow" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto"><path d="M0,0 L0,6 L9,3 z" fill="#2563eb"/></marker>
    <style>text{font-family:Arial,'Microsoft YaHei',sans-serif;fill:#111827}.h{font-size:20px;font-weight:700}.t{font-size:15px;font-weight:700}.s{font-size:13px;fill:#4b5563}.svc{fill:#fff;stroke:#cbd5e1;stroke-width:1.5}.edge{fill:#dbeafe;stroke:#60a5fa}.dep{fill:#ecfdf5;stroke:#34d399}.line{stroke:#2563eb;stroke-width:2.5;fill:none;marker-end:url(#arrow)}.dash{stroke:#64748b;stroke-width:2;stroke-dasharray:6 5;fill:none}</style>
  </defs>
  <text x="44" y="45" class="h">一次请求在微服务中的追踪路径</text>
  <text x="44" y="70" class="s">trace_id 贯穿入口、服务调用、异步消息和外部依赖，Span 记录每一段耗时与状态。</text>

  <rect x="50" y="158" width="142" height="84" rx="14" class="edge"/>
  <text x="94" y="190" class="t">网关</text>
  <text x="74" y="216" class="s">root span</text>

  <rect x="272" y="92" width="158" height="92" rx="14" class="svc"/>
  <text x="314" y="125" class="t">订单服务</text>
  <text x="300" y="152" class="s">span: 校验订单</text>

  <rect x="514" y="92" width="158" height="92" rx="14" class="svc"/>
  <text x="556" y="125" class="t">库存服务</text>
  <text x="542" y="152" class="s">span: 锁定库存</text>

  <rect x="272" y="292" width="158" height="92" rx="14" class="svc"/>
  <text x="314" y="325" class="t">支付服务</text>
  <text x="300" y="352" class="s">span: 发起支付</text>

  <rect x="514" y="292" width="158" height="92" rx="14" class="dep"/>
  <text x="556" y="325" class="t">消息队列</text>
  <text x="542" y="352" class="s">context 注入消息</text>

  <rect x="742" y="182" width="158" height="92" rx="14" class="dep"/>
  <text x="790" y="215" class="t">数据库</text>
  <text x="770" y="242" class="s">db span / error</text>

  <path d="M192 200 C220 162 240 140 272 138" class="line"/>
  <path d="M430 138 H514" class="line"/>
  <path d="M192 210 C226 270 240 334 272 338" class="line"/>
  <path d="M430 338 H514" class="line"/>
  <path d="M672 138 C716 152 738 178 742 210" class="line"/>
  <path d="M672 338 C722 318 746 280 760 252" class="line"/>

  <path d="M120 266 C260 452 700 456 842 300" class="dash"/>
  <text x="392" y="466" class="s">同一 trace_id 关联多个 Span，形成可回放的调用时间线</text>
</svg>
