#Celery CloudWatch
Monitor your celery application from within AWS CloudWatch!
##Metrics
The following events are tallied per task:
- CeleryEventSent
- CeleryEventStarted
- CeleryEventSucceeded
- CeleryEventFailed
You can then see how many tasks/day, tasks/week etc are being completed.
Also, we record the total waiting/running per task:
- CeleryNumWaiting
- CeleryNumRunning
Also, statistics on task duration are sent in the metrics:
- CeleryWaitingTime
- CeleryProcessingTime
These metrics are sent with all supported stats (No. Events, Sum, Max, Min), allowing you to gain insight into your task processing and match requests and capacity.
#Getting Started
-
Set up an IAM Role for your instance.
It must include a policy to perform 'PutMetricData', eg:
{ "Version": "2000-01-01", "Statement": [ { "Effect": "Allow", "Action": [ "cloudwatch:PutMetricData" ], "Resource": [ "*" ] } ] }
(Note: Alternatively, you can set up a
Userwith the same policy and provide access details that way) -
Install via
python-pip(and upgrade pip & boto)sudo apt-get install -y python-pip sudo pip install --upgrade pip boto # Install directly sudo pip install celery-cloudwatch # OR, install in a virtualenv sudo apt-get install -y python-virtualenv mkdir /var/python-envs virtualenv /var/python-envs/ccwatch source /var/python-envs/ccwatch/bin/activate pip install celery-cloudwatch
-
Create your own
boto.cfgat/etc/boto.cfg-[Credentials] # if not using an IAM Role - provide aws key/secret aws_access_key_id = xxx aws_secret_access_key = yyy [Boto] cloudwatch_region_name = my-region cloudwatch_region_endpoint = monitoring.my-region.amazonaws.com -
Create your own config file in
/etc/ccwatch.yamlccwatch: broker: null camera: celery_cloudwatch.CloudWatchCamera verbose: no camera: frequency: 60.0 verbose: no cloudwatch-camera: dryrun: no namespace: celery tasks: - myapp.mytasks.taskname - myapp.mytasks.anothertask - myapp.mytasks.thirdtask - name: myapp.secondarytasks dimensions: task: myapp.secondarytasks customDim: value - name: myapp.tertiarytasks dimensions: task: myapp.tertiarytasks customDim: value -
Install upstart
Create a file
/etc/init/celery-cloudwatch.conf-description "Celery CloudWatch" author "nathan muir <ndmuir@gmail.com>" setuid nobody setgid nogroup start on runlevel [234] stop on runlevel [0156] exec /var/python-envs/ccwatch/bin/ccwatch respawnthen-
sudo initctl reload-configuration sudo service celery-cloudwatch start
-
Start Celery your celery workers with the
-E(orCELERY_SEND_EVENTS=1andCELERY_TRACK_STARTED=1) options, and, start celery clients withCELERY_SEND_TASK_SENT_EVENT=1 -
All done! head over to your CloudWatch monitoring page to see the results!
Metadata
Release files for celery-cloudwatch 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| celery-cloudwatch-2.0.0.tar.gz | 10.4 kB | Without provenance | Details for celery-cloudwatch-2.0.0.tar.gz |
Release files / celery-cloudwatch-2.0.0.tar.gz
| Download URL | celery-cloudwatch-2.0.0.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1a4295b572868ff3044beb7aa755665f3538eb7c9349e2a22563bc7beb6a519a
|
|
BLAKE2b-256 checksum How to use checksums |
be039b5cd4f61745c7d5725927826efbead5f32e66b24fdec4e0205160c69eb5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.6.7
|
Security for celery-cloudwatch 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.