Lesson 4.3

Logging, tracing, and health checks

Structured logs are queryable.

38mBeginner9.6k students

Overview

Diagnosable from the outside

Structured logs are queryable. A log line with fields for the route, status, duration, user, and correlation id can answer questions that a formatted sentence cannot.

A trace id propagated across service boundaries turns a multi-service request into a single timeline. Without it, correlating an error in one service to its cause in another is manual archaeology.

Health endpoints are for orchestrators. A readiness check that verifies the database connection is useful; a liveness check that does the same will restart your service every time the database hiccups.

In this lesson you will:

  • Log structured events, not sentences
  • Trace a request across services
  • Expose readiness and liveness endpoints

Resources

Previous Lesson
Logging, tracing, and health checks — API Design with Node.js — Vertex