Celery
How do I instrument Celery with Scout?
Scout supports Celery 3.1+. Setup:
- Install scout-apm:
pip install scout-apm- Configure in your Celery application file:
import scout_apm.celery
from scout_apm.api import Config
from celery import Celery
app = Celery('tasks', backend='redis://localhost', broker='redis://localhost')
Config.set(
key="[YOUR KEY FROM SCOUT UI]",
name="Same as Web App Name",
monitor=True,
)
scout_apm.celery.install(app)- Deploy. Tasks appear in “Background Jobs” within about five minutes.
Should I pass the app to scout_apm.celery.install()?
Yes. The app argument was added in version 2.12.0. While optional for backwards compatibility, providing it enables complete instrumentation.
Can I configure Celery with environment variables?
Yes. Use SCOUT_MONITOR, SCOUT_NAME, and SCOUT_KEY instead of calling Config.set.
How do I use Scout with Django Celery?
If using app.config_from_object() to point to Django settings and you’ve configured Scout there, you don’t need to call Config.set separately in Celery. Just call:
scout_apm.celery.install(app)What app name should I use for Celery?
Use the same app name as your web application. This groups web requests and background jobs together in the Scout UI, giving you a complete picture of your application’s performance.
Where do Celery tasks appear in Scout?
Celery tasks appear in the “Background Jobs” area of the Scout UI, separate from web endpoint metrics.