Ready for Production#

This guide covers the essentials for running Oban in production: logging, job maintenance, and error monitoring.

Running Embedded#

If you’re running Oban embedded in your application instead of using the CLI, you’ll need to configure a few things manually.

Enable Logging#

Attach the telemetry logger during application startup:

from oban.telemetry import logger as telemetry_logger

telemetry_logger.attach()

The logger emits JSON-encoded structured logs at the INFO level by default. You can customize the log level:

telemetry_logger.attach(level=logging.DEBUG)

Configure Job Maintenance#

Pruning and orphan rescue are enabled by default, but you can customize them:

from oban import Oban

pool = await Oban.create_pool()

oban = Oban(
    pool=pool,
    queues={"default": 10},
    pruner={"max_age": 3_600},  # Keep jobs for 1 hour
    lifeline={"interval": 30},  # Check for orphans every 30 seconds
)

See the Job Maintenance guide for more details on job retention.

Ship It!#

Whether you’re using the CLI or embedded mode, you now have:

  • Structured logging for debugging and monitoring

  • Automatic job pruning to prevent unbounded table growth

  • Orphan recovery for interrupted jobs

The CLI handles all of this automatically, making it the recommended approach for most production deployments.