Skip to content
Ameen Abozaid
MID-047

Observability

  • 9 Lessons
  • 3.5 h practice (estimate)
On this page 8 topics

Overview

Topics

  • Logs
  • metrics
  • traces
  • correlation IDs
  • OpenTelemetry

Learn first

3.5 h of practice (estimate)

Learning outcomes

  1. Explain the roles of logs, metrics, and traces and the questions each answers.
  2. Instrument services with OpenTelemetry (auto and manual spans) and propagate context over HTTP and Kafka.
  3. Correlate logs with traces through trace and span IDs.
  4. Add business-meaningful custom metrics with Micrometer.

Lessons

  1. 01Monitoring vs observability
  2. 02Logs, metrics, traces
  3. 03OpenTelemetry concepts
  4. 04Instrumenting Spring services
  5. 05Context propagation through Kafka
  6. 06Correlating logs and traces
  7. 07Custom metrics with Micrometer
  8. 08Demo: following one order through four services
  9. 09Demo: finding a slow span in a saga

Lab and exercises

Lab

MID-047-LAB1 · Traceable Shop

Outcomes: 1–4 · Time: ~3.5 h Instrument gateway, services, and Kafka so traces appear in Jaeger or Tempo; add trace ids to logs; add business metrics for orders placed and failed. Acceptance: any order ID can be traced end to end.

Exercises (assessment: diagnose an issue from telemetry alone)

IDOutcomeTask
MID-047-EX011For five questions (error count, request path, exact exception, time per step, slow tail), name the signal that answers it.
MID-047-EX022Enable auto-instrumentation for orders and view a trace in Jaeger or Tempo.
MID-047-EX032Add a manual span "reserve-stock" with an order.id attribute.
MID-047-EX042Propagate trace context through Kafka and show one trace across producer and consumer.
MID-047-EX053Add trace_id and span_id to JSON logs; find all logs of one request.
MID-047-EX064Add a counter shop.orders tagged result; explain why customerId must not be a tag.
MID-047-EX071–4Given screenshots of traces, logs, and metrics from a slow-checkout incident, write a diagnosis with evidence.
Show solutions
  • EX01 Counts: metric; path: trace; exact exception: log; time per step: trace; slow tail: metric histogram or percentile.
  • EX02 Run the OTel Java agent or the Micrometer Tracing bridge with an exporter to the collector; verify the supported setup for the Boot version.
  • EX03 tracer.spanBuilder(...) with makeCurrent() and end() in finally, as in the lecture.
  • EX04 Use the instrumented Kafka client or Spring Kafka observation support so headers carry traceparent; check the consumer span's trace id equals the producer's.
  • EX05 Add trace and span ids to the MDC through the tracing bridge and a JSON encoder; search by trace id.
  • EX06 Counter.builder("shop.orders").tag("result","failed"); customer id yields unbounded series.
  • EX07 Pattern: symptom (metric), narrowing (traces), cause (widest span), confirmation (logs); propose one fix.

Outcome 1 is also checked by quiz Q01-Q03.

Quiz

Outcomes: O1 logs, metrics, traces · O2 OpenTelemetry and propagation · O3 log-trace correlation · O4 custom metrics.

A self-check for you: nothing is graded, saved or sent anywhere. Choose an answer, then check it. You can try again as often as you like.

  1. 1Which signal shows where a request spent its time across services?O1
  2. 2Counting orders is best done with:O1
  3. 3Observability differs from monitoring because it:O1
  4. 4A trace is made of:O2
  5. 5Trace context between HTTP services travels in:O2
  6. 6A trace that stops at the broker usually means:O2
  7. 7A manual span is useful for:O2
  8. 8To join logs to traces, each log line needs:O3
  9. 9Which is a safe metric tag?O4
  10. 10Why avoid high-cardinality labels?O4

Practical part

Seven exercises MID-047-EX01 to EX07 (EX07 is the diagnosis from telemetry alone) plus the Traceable Shop lab. Pass: at least five exercises including EX07, and a lab where any order id can be traced end to end.

Common mistakes

High-cardinality metric labels; traces broken at the message broker; logging instead of metrics for counts.

Assessment

Diagnose an issue from telemetry alone.

Career relevance

Incident handling (MID-050) and the MID gate.

Type to search levels, phases, modules and lessons.