This project demonstrates a setup for reproducing a Datadog Celery issue.
- Clone the repository:
git clone <repository-url> cd datadog-celery-issue
- Create a virtual environment using uv:
uv venv source .venv/bin/activate # On Windows use `.venv\Scripts\activate`
- Install dependencies using uv:
uv pip sync requirements.txt
- Set up environment variables:
Create a
.envfile in the root of the project and add the necessary environment variables. For example:# Example .env file DD_API_KEY=<your_datadog_api_key> DD_SITE=<your_datadog_site> # Add other necessary environment variables for RabbitMQ, etc.
This application consists of two main components: a Producer and a Consumer.
The producer is a Uvicorn application. To run it:
uv run uvicorn producer.main:app --reloadYou can also set the DD_SERVICE environment variable to test-producer-service before running.
The consumer is a Celery worker. To run it:
uv run celery -A consumer.main.app worker -Q celery.consumerYou can also set the DD_SERVICE environment variable to test-consumer-service before running.
Alternatively, you can use the provided VSCode launch configurations:
- Open the project in VSCode.
- Go to the "Run and Debug" view (usually a play button icon with a bug on the sidebar).
- Select either "Producer" or "Consumer" from the dropdown menu.
- Click the green play button to start the selected component.
The launch configurations will automatically use the .env file and set the appropriate DD_SERVICE environment variable.