Module Review: Foundations
[!NOTE] This module explores the core principles of Module Review: Foundations, deriving solutions from first principles and hardware constraints to build world-class, production-ready expertise.
1. Key Takeaways
- Observability is not Monitoring: Monitoring tells you when something is wrong; observability allows you to ask why it went wrong.
- The Three Pillars:
- Traces: Request-scoped path of execution (Distributed).
- Metrics: Aggregated numerical data (Trends).
- Logs: Discrete events with context (Details).
- Context Propagation: The mechanism (usually HTTP headers like
traceparent) that passes the Trace ID from service to service. - Spans: The building blocks of a trace. Each span represents an operation and has a parent-child relationship.
- OpenTelemetry: The vendor-neutral standard for generating and collecting this data.
2. Flashcards
What is a Trace?
A representation of a request's execution path through a distributed system. It is composed of a tree of Spans.
What is Context Propagation?
The mechanism of moving the Trace ID and Span ID from one service to another, usually via HTTP headers.
What is a Span?
The basic unit of work in a trace. It represents a single operation (like a DB query or HTTP request) and contains start/end times.
What is the difference between Metrics and Logs?
Metrics are numerical aggregations (cheap, good for trends). Logs are detailed event records (expensive, good for specific errors).
What is W3C Trace Context?
The standard HTTP header format (`traceparent`) used by OpenTelemetry to propagate context.
3. Cheat Sheet
| Signal | Best For | Data Structure | Example |
|---|---|---|---|
| Trace | Latency analysis, Root cause finding | Tree of Spans | “Checkout took 2s because Payment Service was slow” |
| Metric | Alerting, Capacity planning, Trends | Aggregated Numbers | “Error rate is 5%”, “CPU is 90%” |
| Log | Debugging specific errors | Structured Event | “NullPointerException at line 45”, “User 123 logged in” |
OTel Terminology
- Attribute: Key-value pair (metadata).
- Event: A timestamped annotation on a Span.
- Link: A connection to another Span (causal or otherwise).
- Resource: Attributes describing the source (service name, host).