# Chapter 11: Observability and Debugging in Production — Logs, Metrics, Traces, and the Difference Between Guessing and Knowing

> From *The Confident Learner: Tech and Domain Fundamentals for the AI Era* by Dharanova Pioneer, a free online book.
> Web page: https://elephantbamboo.com/chapters/11 · Licence: CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0/)

**What this chapter covers:** Logs, metrics and traces, and the debugging discipline that turns guessing into knowing when a production bug will not reproduce.

*The opening of the chapter follows. The full chapter is free to read with a Google sign-in at the web page above.*

---

## The bug that two engineers had already failed to fix

Lavanya had been at the bus-ticket booking platform in Kochi for about ten months when the bug landed on her desk. It did not land gently. It arrived with a history. It had been open for two weeks, and two engineers before her had already tried and failed to fix it, which is a particular kind of pressure for someone ten months into their first job.

The bug was this. Roughly one in every few hundred bookings failed at the final step. The customer's money was taken. The seat was held. But the confirmation SMS and the ticket never arrived, and the booking sat in a "pending" state forever until a support person noticed it and fixed it by hand. It was not tied to any one bus operator. It was not tied to any one payment method. It was not tied to any one route or time of day that anyone could find. It was just there, quietly, a steady trickle of customers who had paid and received nothing.

Lavanya did exactly what college had taught her to do, and she did it well. She tried to reproduce it. She made a hundred test bookings on her own machine. Every single one succeeded. She read the booking code carefully, line by line. It looked correct. She added print statements at every step of the booking flow, deployed them, and watched the output. The output was thousands of successful bookings per hour scrolling past, and somewhere in that flood were the few that failed, and she had no way to pick them out. She was trying to find one specific straw by examining a haystack one straw at a time, while more hay poured in.
