Add Prometheus Metrics Exporter for Celery #42
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
This PR integrates a Prometheus metrics exporter to collect and expose performance data related to Celery tasks.
Technical Details:
src/metrics/exporter.py
. This exporter leverages theprometheus_client
library to collect various metrics related to Celery tasks, such as task sent, received, started, succeeded, failed, rejected, revoked, and retried counts, as well as task runtime. The exporter exposes these metrics on port 8080, allowing Prometheus to scrape them.exporter.py
script establishes a connection to the Celery broker and listens for task and worker events. It processes these events to update the Prometheus metrics accordingly.Dockerfile
has been created insrc/metrics/Dockerfile
to build and run the metrics exporter as a standalone container. This allows for independent deployment and scaling of the metrics exporter./metrics
has been added and routed to the metrics exporter. This endpoint serves the Prometheus metrics, allowing them to be scraped by Prometheus.prometheus-client
package has been added as a dependency inpyproject.toml
andpoetry.lock
files.