Modern QA2026How Traces, Spans, and Context Work Together — tiles
Log inJoin
30 / 67 · 06 Observability-Driven Testing · Distributed Tracing with OpenTelemetry← prev⊞ allnext →☰ Read as one page

5.3How Traces, Spans, and Context Work Together

User clicks "Submit Order"
    |
    v
[TRACE: order-submit-abc123] -------- spans the entire request flow
    |
    +---> [Service: API Gateway]
    |         LOG: "Received POST /orders from user_id=42"
    |         METRIC: http_requests_total{method="POST", path="/orders"} +1
    |
    +---> [Service: Order Service]
    |         LOG: "Creating order for user_id=42, items=3, total=$149.99"
    |         METRIC: order_creation_duration_seconds = 0.045
    |         SPAN: order-service.create_order (45ms)
    |
    +---> [Service: Payment Service]
    |         LOG: "Charging $149.99 to card ending 4242"
    |         METRIC: payment_processing_duration_seconds = 1.2
    |         SPAN: payment-service.charge (1200ms)  <-- slow!
    |
    +---> [Service: Inventory Service]
              LOG: "Reserved 3 items for order_id=ORD-789"
              METRIC: inventory_reservations_total +3
              SPAN: inventory-service.reserve (23ms)

The trace reveals the payment service is the bottleneck (1200ms out of ~1300ms total). The metric confirms this is a trend. The log provides specific context for debugging.