DevPath
Mid lesson · 12 min

Observe queues and external calls

Use a few actionable signals to see when work is falling behind.

Measure the user's delay

For queued work, record time waiting, execution time, success rate, and age of the oldest pending item. A low error rate can still hide a stalled queue. For an external API, track timeout rate and latency by operation, not by arbitrary user identifier.

Log with restraint

Structured logs should include an operation ID, event type, attempt number, and safe outcome. Avoid raw payment details, uploaded documents, and personal data. A correlation ID lets an operator connect the request that enqueued work to the worker that processed it.

logger.info('payment_event_processed', extra={
    'event_id': event_id, 'attempt': attempt, 'outcome': outcome
})

Make alerts actionable

Alert on sustained queue age or a user-impacting failure rate rather than every retry. Write down who receives the alert and what they should check first. Rehearse a dependency outage: can you tell which events were retried, which completed, and which need manual intervention?

Check your understanding

Why track queue age in addition to error rate?

Show explanation

A queue can stop processing without producing errors. Age shows how long users have waited for pending work.

You can read for free. Create an account to save your progress.

← Previous lesson: Let async service work stop cleanly

Put this lesson into practice

A practice activity at this level in the same module.

Try: Add exponential backoff with jitter

Further reading

Primary references for this module. Check the current version when behavior or framework guidance may have changed.