The Carpenter's True Level: How to Build a Health Check That Measures What Matters
We’ve all written the health check that lies. It’s the endpoint that returns a swift, proud 200 OK, assuring the world that our service is alive and well. But down in the engine room, a connection pool is slowly strangling, a cache is growing stale, or a downstream dependency is beginning to whisper its apologies. The service is technically ‘up,’ yet functionally crippled. The green checkmark becomes a form of theatrical performance, a curtain drawn over the crumbling stage.
The common /health endpoint is a carpenter’s chalk line—a quick, useful mark. But to truly know if a structure is sound, you need a level. You need a check that doesn’t just ask, "Are you running?" but instead demands, "Can you do your actual job?" This is the practice of building a synthetic transaction, and it is the truest level we have.
The technique is deceptively simple: within your service, you write a dedicated function or route whose sole purpose is to execute a miniature, but complete, real-world operation. For a database-backed API, this isn’t a shallow "SELECT 1"; it’s a verified read of a known test record, followed by a write-update and a subsequent read to confirm consistency, all within a transaction that is then rolled back. It proves the database accepts connections, honors permissions, and executes writes correctly. For a service that relies on an external weather API, the check doesn’t just ping the provider’s homepage; it requests the forecast for a specific city and validates the structure and sanity of the returned JSON.
This check will be heavier. It will consume resources. It will be slower. And that is its entire purpose. Its latency becomes your most critical metric—a precise measure of systemic friction. A creeping increase in its response time isn’t a vague warning; it’s a specific report that something in the chain of dependencies is beginning to struggle. It measures the thing you actually care about: the user’s experience.
Deploying this requires care. You must run it less frequently than a simple ping—perhaps every 30 seconds instead of every 5—to avoid becoming a source of load itself. You must isolate it from your production data, using test fixtures and transactional safety. And its failure must be a piercing, urgent alarm, distinct from the mere informational note of a process restart.
This is the move from watching the machine to watching the work the machine was built to do. It is the difference between a sailor checking that a rope is present and testing its strength against the coming storm. It is the carpenter’s level, and it tells you not if the wood is there, but if the shelf will hold.
Notes & further reading
A few pages I came back to while writing this:
- Knoxville, TN
- The Seduction of the Silent Bell: On the Peril of Perfect Uptime
- Cleveland, OH
- The Blacksmith's Anvil: On the Constancy of the First Health Check
- Providence, RI
- The Shedding of the Second Skin: An Unlearning at 3 AM
- Rancho Cucamonga, CA
- Seattle, WA
- Wichita, KS
- San Jose, CA
- El Paso, TX
- Miramar, FL
- a useful directory