Full lesson
Explore the full explanation, examples, and visuals at your own pace.
Add to Cart: one request, three services
General knowledgeA trace is the recorded path of one request through many services. A shopper clicks Add to Cart. The request hits the API gateway, the front door of the system. It forwards to the Cart Service, which saves the item in the Database. A trace records that whole journey.
Observability: understand a system from outside by asking why this is happening
Observability means understanding a system from its outputs. You can ask why something is happening, even for unknown unknowns, problems you never planned for.
Three telemetry signals
Telemetry is just data a system emits about itself. It comes in three signals. A metric is a number over time, like error rate. A log is one timestamped message. A trace follows a single Add to Cart request across services.
- Metrics: numbers aggregated over time
- Logs: timestamped messages from components
- Traces: one request's path through services
OpenTelemetry produces and ships the data
General knowledgeOpenTelemetry handles the data, not the dashboard. Your app is instrumented, and the SDK, a library inside your app, exports telemetry. The Collector, a proxy that receives and processes it, sends it on to a backend. Tools like Jaeger store and display it. OpenTelemetry isn't the backend.
Why logs alone fall short
Say Add to Cart sometimes saves the wrong shoes. The gateway, cart service, and database each write their own log, but those logs usually lack context, like where a call came from. On the right, one trace joins the same three steps in order, tied to a single request.
One request, one trace
Follow the Add to Cart request from the Shopper to the API Gateway, the Cart Service, and the Database, then back with the response. All of those hops belong to one trace. Each hop is a step called a span, and we'll look at spans next lesson. A trace is one request's travel log.
Illustrative timings: where did the time go?
General knowledgeThese timings are illustrative. The whole request takes 450 milliseconds, and the steps nest inside it: API Gateway 430, Cart Service 400, Database save 340. Most of the time sits in the database save. That tells you where to investigate first, even for a problem you can't reproduce locally.
Chart values
| Step | Milliseconds |
|---|---|
| Whole request | 450 |
| API Gateway | 430 |
| Cart Service | 400 |
| Database save | 340 |
A trace is one request's travel log across every service.
A trace is one request's travel log across every service. So when a multi-service request misbehaves, open its trace before digging through scattered logs.
