Question
In Module 5 (Monitoring), we use OpenTelemetry to instrument our RAG system. I see the terms "trace" and "span" used throughout the lesson. What exactly is the difference between them?
Answer
From the OpenTelemetry setup in the Module 5 homework:
-
A trace is the end‑to‑end story of a single request as it moves through your system. For our RAG system, one trace corresponds to one RAG call (a user question going through search, prompt building, and LLM generation).
-
A span is one operation within a trace. A trace is made of one or more spans, organized as a tree. Each span has a name, a start time, an end time, and a set of attributes (key‑value pairs) that record metadata like tokens used or cost.
In our homework, we create one span for each RAG step: rag (the parent), search, and llm (its children). This allows us to see the timing and attributes of each step individually, while still understanding the overall request context.
Source: Module 5 – Monitoring, section "OpenTelemetry" in the homework instructions.
Course
LLM Zoomcamp
Module
05 – Monitoring
Related Links
Question
In Module 5 (Monitoring), we use OpenTelemetry to instrument our RAG system. I see the terms "trace" and "span" used throughout the lesson. What exactly is the difference between them?
Answer
From the OpenTelemetry setup in the Module 5 homework:
A trace is the end‑to‑end story of a single request as it moves through your system. For our RAG system, one trace corresponds to one RAG call (a user question going through search, prompt building, and LLM generation).
A span is one operation within a trace. A trace is made of one or more spans, organized as a tree. Each span has a name, a start time, an end time, and a set of attributes (key‑value pairs) that record metadata like tokens used or cost.
In our homework, we create one span for each RAG step:
rag(the parent),search, andllm(its children). This allows us to see the timing and attributes of each step individually, while still understanding the overall request context.Source: Module 5 – Monitoring, section "OpenTelemetry" in the homework instructions.
Course
LLM Zoomcamp
Module
05 – Monitoring
Related Links