Celery
Installation
The latest scout-apm
package supports Celery 3.1+.
AInstall the scout-apm
package:
pip install scout-apm
BConfigure Scout 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')
# If you are using app.config_from_object() to point to your Django settings
# and have configured Scout there, configuring here is not necessary:
Config.set(
key="[AVAILABLE IN THE SCOUT UI]",
name="Same as Web App Name",
monitor=True,
)
# This attaches the instrumentation to your app and makes Scout work:
scout_apm.celery.install(app)
The app
argument is optional and was added in version 2.12.0, but you should provide it for complete instrumentation.
If you wish to configure Scout via environment variables, use SCOUT_MONITOR
, SCOUT_NAME
, and SCOUT_KEY
instead of calling Config.set
.
Heroku Customers: If you've installed Scout via the Heroku Addon, the provisioning process automatically sets
SCOUT_MONITOR
and SCOUT_KEY
via config vars. Only SCOUT_NAME
is additionally required.
CDeploy.
It takes approximately five minutes for your data to first appear within the Scout UI.
Tasks will appear in the "Background Jobs" area of the Scout UI.