Skip to main content

02 – Foundations of Observability & Distributed Tracing

Learning Objectives

  • Explain logs, metrics, and traces and how they complement each other.
  • Describe the anatomy of a trace and span, and context propagation.
  • Understand common trace formats: OTLP, Jaeger, Zipkin.

Lecture Summary

  • Logs are detailed event records; metrics are aggregated time series; traces show request causality across services.
  • A trace contains spans (operations) with attributes, events, links, and parent/child relationships.
  • Propagation uses W3C Trace Context headers: traceparent and tracestate.
  • OTLP is the OpenTelemetry-native protocol; Tempo supports OTLP and Jaeger ingestion.

Visual Mental Model

  • Client → API Gateway → Service A → Service B → DB
  • Each arrow adds a span; the waterfall view exposes latency per hop.

Hands-on Lab: Inspect a Trace Payload

  1. Copy the JSON below to trace-sample.json.
  2. Identify the traceId, spanId, attributes, and parent relationships.
{
"resourceSpans": [
{
"resource": {"attributes": [{"key": "service.name", "value": {"stringValue": "orders"}}]},
"scopeSpans": [
{
"spans": [
{
"traceId": "0af7651916cd43dd8448eb211c80319c",
"spanId": "b9c7c989f97918e1",
"name": "GET /orders",
"kind": 2,
"attributes": [
{"key": "http.method", "value": {"stringValue": "GET"}},
{"key": "http.status_code", "value": {"intValue": 200}}
]
}
]
}
]
}
]
}

Deliverables

  • Short write-up describing the key parts of a trace.

Quiz (Self-check)

  • What headers carry trace context across service boundaries?
  • Which pillar would you use to track request per second? To debug a single slow request?

Resources

  • W3C Trace Context
  • OpenTelemetry Specifications

Visuals

Trace Lifecycle (sequence)

Observability Pillars