Production and deployment
Add observability
Use structured logs, traces, request IDs, and platform metrics without leaking secrets, authorization values, or personal link data.
8 minute lesson
Distributed code needs enough context to connect a user-visible failure to one invocation and its downstream operations.
Enable observability deliberately, log structured safe fields, and propagate a request ID. Record route templates, status, duration, binding operation type, and error class—not raw tokens, secrets, or full private URLs.
Logs answer what happened in one execution; metrics reveal rate and trend; traces connect time spent across operations. Use all three for different questions. Include the Worker version or deployment ID so a spike can be tied to a release, and use the same job ID across the HTTP producer and Queue consumer.
wrangler tail is valuable for a live investigation, but events can be sampled and the stream is not durable storage. Configure retained Workers Logs and alerts for production signals. Deliberately trigger one safe 404 and one controlled dependency error, then confirm an operator can find them without searching for private user content.
Add one request log and one queue-job log, then inspect local output and a deployed tail.
Lesson completed