0%
Structured Logs and Distributed Traces

Logs and Traces

From “the service is unhealthy” to “this specific request failed, and here's where.”

10-15 min

Structured Logs and Distributed Traces

Metrics answer one question: is the service healthy? They can't answer the next one: why did this particular request fail? That follows directly from their nature. A metric aggregates; a 99th percentile tells you that one request in a hundred takes longer than two seconds, but never which ones or why.

This lesson therefore closes the loop opened by the introduction: metrics detect, logs explain a single case, and traces explain a single case spread across several services. The three complement one another and none replaces another — but they aren't deployed at the same time, and confusing the last two is costly.

The Structured Log and Its One Essential Field

A free-text log is readable by a human who already knows what they're looking for. A structured log is queryable, which is a different matter entirely.

# Avant : lisible, mais inexploitable en masse.
logger.info(f"Paiement refuse pour {client.id} : {erreur}")

Comments

Comments are powered by GitHub Discussions

Sign in with GitHub to join the discussion

Link copied!