This is a FastAPI-based e-commerce simulation instrumented with a full observability stack.
-
Clone the repository:
git clone https://github.com/cyberkid042/observability-ecommerce-app.git cd observability-ecommerce-app -
Install dependencies:
pip install -r requirements.txt -
Run the database setup:
python database.py -
Run the development server:
uvicorn main:app --reload -
Access the API:
- GET / : Returns a welcome message
- GET /products : List all products
- POST /checkout : Create new order (JSON: {"product_id": int, "quantity": int})
- GET /orders : List all orders
- GET /error : Simulate application error
- GET /metrics : Prometheus metrics endpoint
-
Build and run all services:
docker-compose up --build -
Access services:
- FastAPI: http://localhost:8000
- Prometheus: http://localhost:9090
- Jaeger UI: http://localhost:16686
Run unit tests:
pytest
- Structured JSON Logging: Request ID and response time logging
- OpenTelemetry Tracing: Distributed tracing with Jaeger
- Prometheus Metrics: Request count, latency histogram, error rate
- Docker Compose: Pre-configured services for full observability stack
GET /- Welcome messageGET /products- List all productsPOST /checkout- Create order (body: {"product_id": int, "quantity": int})GET /orders- List all ordersGET /error- Simulate errorGET /metrics- Prometheus metrics
- Start the server and visit http://127.0.0.1:8000/
- Use tools like curl or Postman to test endpoints
- View traces in Jaeger UI
- Query metrics in Prometheus
Screenshots of Prometheus/Jaeger dashboards will be added as the observability stack is implemented.