Skip to content

Observability: Tracing

Document ID: OBS-003
File Path: docs/14-observability/tracing.md
Version: 1.0.0
Status: Draft
Owner: Platform Operations Team
Last Updated: 2026-06-27


This document defines distributed tracing across the Wovyr AI Platform — how a single request is traced end to end through services, and how traces correlate with logs and metrics.


Tracing uses OpenTelemetry with W3C Trace Context propagation. Every service is instrumented to create and propagate spans, exporting via OTLP to a tracing backend (Tempo/Jaeger).


A user request produces one trace spanning every hop:

trace: agent.run
├─ api-gateway: authn/authz
├─ agent-runtime: plan
│ ├─ memory-engine: retrieve (vector + rank)
│ ├─ llm-gateway: chat (route → provider)
│ └─ tool-runtime: execute (sandbox → tool)
└─ agent-runtime: respond

This makes “why was this run slow/expensive?” answerable by inspecting span durations and attributes.


Client → API Gateway (generates trace_id + request_id)
→ service A → service B → datastores

Context flows via headers on REST/gRPC and metadata on Event Bus messages, so async work (workflow steps, cost events) joins the same trace where applicable.


AttributeExample
wovyr.tenantacme
wovyr.principalagent:order-assistant
wovyr.resource.idrun_01H...
wovyr.subsystemllm-gateway
Semantic conventionshttp.*, rpc.*, db.*

Sensitive values are never placed in span attributes (same masking rules as logging).


  • trace_id appears in every log line.
  • Metrics histograms carry trace exemplars.
  • The dashboard links a metric/alert → trace → logs using the shared IDs.

Subsystems emit meaningful spans, e.g.:

  • LLM Gateway: routing decision, provider call, failover hops (routing observability)
  • Tool Runtime: dispatch → authorize → schedule → sandbox → execute (tracing)
  • Memory Engine: embed → search → rank → compress

  • Head-based sampling by default (configurable rate) to bound volume.
  • Tail-based sampling can retain all error/slow traces regardless of rate.
  • Errors and high-latency requests are always sampled.

Because model and tool calls are spans with cost attributes, a trace shows the cost breakdown of a single request, complementing aggregate cost metrics.




VersionDateDescription
1.0.02026-06-27Initial Tracing specification