Make failures diagnosable
Use structured signals without leaking sensitive data.
Identify the operation
A user-facing error should carry a correlation ID that operators can find in logs. Include operation name, outcome, duration, and a safe identifier such as an internal request ID. Avoid raw résumé text, passwords, payment tokens, and full request bodies. Useful observability starts with deciding which questions an operator must answer.
Separate signals
Logs explain individual events, metrics show rates and latency, and traces connect a request across services. A sudden retry spike and an elevated 409 rate mean different things. Alert on user-impacting symptoms and queue age, not every expected conflict. Keep labels low-cardinality so metrics remain affordable and usable.
logger()->warning('booking_conflict', [
'request_id' => $requestId,
'resource_id' => $resourceId,
]);
Rehearse an incident
Walk through one failed checkout in a test environment: can you locate the request, find the retry history, and tell whether a charge happened? Record gaps in the runbook. An observability plan is complete only when someone unfamiliar with the code can answer those questions within a reasonable time.
Check your understanding
Why should an expected booking conflict usually not trigger a 500-error alert?
Show explanation
It is a normal domain outcome. Monitor its rate separately and alert on unexpected failures or user impact.
You can read for free. Create an account to save your progress.
← Previous lesson: Verify webhooks and test failure paths Next lesson: Dispatch work after a transaction commits →Put this lesson into practice
A practice activity at this level in the same module.
Try: Deduplicate a payment webhookFurther reading
Primary references for this module. Check the current version when behavior or framework guidance may have changed.