Dynamo Logging
Overview
Dynamo provides structured logging in both text as well as JSONL. When
JSONL is enabled, logs support trace_id and span_id fields for
distributed tracing. Span creation and exit events can be optionally
enabled via the DYN_LOGGING_SPAN_EVENTS environment variable.
Environment Variables
Getting Started Quickly
Start Observability Stack
For collecting and visualizing logs with Grafana Loki (Kubernetes), or viewing trace context in logs alongside Grafana Tempo, start the observability stack. See Observability Getting Started for instructions.
Enable Structured Logging
Enable structured JSONL logging:
Logs will be written to stderr in JSONL format with trace context.
Available Logging Levels
Example Readable Format
Environment Setting:
Resulting Log format:
Example JSONL Format
Environment Setting:
Resulting Log format:
Logging of Trace and Span IDs
When DYN_LOGGING_JSONL is enabled, all logs include trace_id and span_id fields, and spans are automatically created for requests. This is useful for short debugging sessions where you want to examine trace context in logs without setting up a full tracing backend and for correlating log messages with traces.
The trace and span information uses the OpenTelemetry format and libraries, which means the IDs are compatible with OpenTelemetry-based tracing backends like Tempo or Jaeger if you later choose to enable trace export.
Note: This section has overlap with Distributed Tracing with Tempo. For trace visualization in Grafana Tempo and persistent trace analysis, see Distributed Tracing with Tempo.
Configuration for Logging
To see trace information in logs:
This enables JSONL logging with trace_id and span_id fields. Traces appear in logs but are not exported to any backend.
Example Request
Send a request to generate logs with trace context:
Check the logs (stderr) for JSONL output containing trace_id, span_id, and x_request_id fields.
Trace and Span Information in Logs
This section shows how trace and span information appears in JSONL logs. These logs can be used to understand request flows even without a trace visualization backend.
Example Disaggregated Trace in Grafana
When viewing the corresponding trace in Grafana, you should be able to see something like the following:

Trace Overview
Dynamo creates distributed traces that span across multiple services in a disaggregated serving setup. The following sections describe the key spans you’ll see in Grafana when viewing traces for chat completion requests.
Available Spans in Disaggregated Mode
When running Dynamo in disaggregated mode, a typical request creates the following spans:
1. http-request (Frontend - Root Span)
The root span for the entire request lifecycle, created in the dynamo-frontend service.
Key Attributes:
- Service:
dynamo-frontend - Operation: Handles the HTTP request from client to completion
- Duration: Total end-to-end request time (includes prefill + decode)
- Method: HTTP method (typically
POST) - URI: Request endpoint (e.g.,
/v1/chat/completions) - Status: Request completion status
- Children: Typically 2-3 child spans (routing span + worker spans)
This span represents the complete request flow from when the frontend receives the HTTP request until the final response is sent back to the client.
2. prefill_routing (Frontend - Routing Span)
A child span of http-request, created in the dynamo-frontend service during the routing phase.
Key Attributes:
- Service:
dynamo-frontend - Operation: Routes the prefill request to an appropriate prefill worker
- Duration: Time spent selecting and the span of prefill.
- Parent:
http-requestspan
This span captures the routing logic and decision-making process and the request sent to the prefill worker.
3. handle_payload (Prefill Worker Span)
A child span of http-request, created in the dynamo-worker-vllm-prefill service.
Key Attributes:
- Service:
dynamo-worker-vllm-prefill(ordynamo-worker-sglang-prefillfor SGLang) - Operation: Processes the prefill phase of generation
- Duration: Time to compute prefill (typically milliseconds to seconds)
- Component:
prefill - Endpoint:
generate - Parent:
http-requestspan
This span represents the actual prefill computation on a prefill-specialized worker, including prompt processing and initial KV cache generation.
4. handle_payload (Decode Worker Span)
A child span of http-request, created in the dynamo-worker-vllm-decode service.
Key Attributes:
- Service:
dynamo-worker-vllm-decode(ordynamo-worker-sglang-decodefor SGLang) - Operation: Processes the decode phase of generation
- Duration: Time to generate all output tokens (typically seconds)
- Component:
decodeorbackend - Endpoint:
generate - Parent:
http-requestspan
This span represents the iterative token generation phase on a decode-specialized worker, which consumes the KV cache from prefill and produces output tokens.
Understanding Span Metrics
Each span provides several useful metrics:
The relationship Duration = Busy Time + Idle Time helps identify where time is spent and potential bottlenecks.
Custom Request IDs in Logs
You can provide a custom request ID using the x-request-id header. This ID will be attached to all spans and logs for that request, making it easier to correlate traces with application-level request tracking.
Example Request with Custom Request ID
All spans and logs for this request will include the x_request_id attribute with value 8372eac7-5f43-4d76-beca-0a94cfb311d0.
Frontend Logs with Custom Request ID
Notice how the x_request_id field appears in all log entries, alongside the trace_id (80196f3e3a6fdf06d23bb9ada3788518) and span_id: