Chapter 7 · Logging & Monitoring
Interview drill
4 questions from this chapter. Answer each one out loud first, then open it to compare.
-
7.1"How do you know your frontend is healthy in production?"
- Metrics first: JS error rate, failed request rate, and p75 Web Vitals, all sliced by release.
- Alert on user-visible symptoms rather than causes — checkout success rate beats CPU usage.
- Then logs and traces for depth, with a request id that connects a browser session to backend spans.
-
7.2"What do you log from the frontend, and what do you never log?"
- Always: error and stack, release id, route, device and connection, breadcrumbs, and feature-flag or experiment tags.
- Never: emails, phone numbers, payment data, auth tokens, or full URLs that may carry tokens in the query string.
- Scrub on the client before transmission, since server-side scrubbing still means the data left the device.
-
7.3"Design alerting for a checkout flow."
- One P1 on the business outcome: checkout completion rate below its normal band for five minutes.
- Supporting P2s on payment API error rate and p75 checkout LCP, so you learn why before the P1 fires.
- Every alert names an owner and links a runbook; anything without an action becomes a dashboard, not a page.
-
7.4"Production error rate just spiked. Walk me through your response."
- Acknowledge, then scope: how many users, which route, which release — and check what deployed in the last hour.
- Mitigate before diagnosing: roll back or kill the flag, so the investigation isn't racing against user impact.
- Then map the stack, reproduce with the right flags, add a failing test, fix, and run a blameless postmortem.