Skip to main content

Celery with your own prometheus metrics

Project description

Celery Prometheus

This module expose the Prometheus HTTP server to expose metrics of your Celery backends.

To install celery-prometheus with pip, use the command:

pip install celery-prometheus

With Poetry:

poetry add celery-prometheus

Usage

To setup celery-prometheus to your backend, simply call the method add_prometheus_option after the init of the Celery object.

Example:

from celery import Celery
from celery_prometheus import add_prometheus_option

app = Celery()
add_prometheus_option(app)

# Rest of your code ...

Before starting your backend, you will need to expose the PROMETHEUS_MULTIPROC_DIR environment variable to indicate which folder the Prometheus Client will use to store the metrics (see Multiprocess Mode (E.g. Gunicorn) of the Promehteus Client documentation).

To start and expose the Prometheus HTTP Server, you need to use the --prometheus-collector-addr argument when starting your Celery backend:

export PROMETHEUS_MULTIPROC_DIR=/var/cache/my_celery_app
celery worker -A my_celery_backend.backend --prometheus-collector-addr 0.0.0.0:6543

Now that your backend is started, you can configure your Prometheus scrappers to scrappe your Celery backend.

Contributions

This project is open to external contributions. Feel free to submit us a Pull request if you want to contribute and improve with us this project.

In order to maintain an overall good code quality, this project use the following tools:

Linting and formatting tools are configured to match the current default rules of Black.

We also use Mypy as a static type checker.

Please ensure to run these tools before commiting and submiting a Pull request. In case one of these mentionned tools report an error, the CI will automatically fail.

If you're making your first contribution to this project, please add your name to the contributors list.

License

This project is released by Gandi.net tech team under the BSD-3 license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

celery_prometheus-1.0.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

celery_prometheus-1.0.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file celery_prometheus-1.0.1.tar.gz.

File metadata

  • Download URL: celery_prometheus-1.0.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.3 Linux/6.3.2-arch1-1

File hashes

Hashes for celery_prometheus-1.0.1.tar.gz
Algorithm Hash digest
SHA256 3fe65670a8253f5e9c45a94d1db8f3559d1fcf0c7e56fcab3bbc12ede3a32662
MD5 cb2d7137da5c3c5a98d513c504ecbc78
BLAKE2b-256 c980db202bb7fb4cfb612ddbc659ee85e821f88cad9c52205f8166ccac5aab85

See more details on using hashes here.

File details

Details for the file celery_prometheus-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: celery_prometheus-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.3 Linux/6.3.2-arch1-1

File hashes

Hashes for celery_prometheus-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8f8d79737f614a4ab2c3f5d6cea8bb1509c6e278d00aae7e9e7e1e1a61c37131
MD5 a929aaff37d6288342ed4083d9e3a97a
BLAKE2b-256 51cc2b2a6e5651462b3b4377f8a2d028dd3a91a9e531b4de8d7e6fcabf1b7f26

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page