{"repo":"agfianf/fastapi-RED-metrics","free":true,"listed":false,"github":"https://github.com/agfianf/fastapi-RED-metrics","clone":"git clone https://github.com/agfianf/fastapi-RED-metrics.git","description":"implement RED metrics in fastapi integrate with Prometheus and Grafana","language":"Python","stars":40,"topics":["fastapi","grafana","monitoring","observability","prometheus"],"license":null,"category":"analytics","readme_excerpt":"FastAPI RED Metrics Read more explanation here This project demonstrates how to implement RED (Rate, Errors, Duration) metrics in a FastAPI application using Prometheus and Grafana. ⚡ How to Run 1. Make sure you have Docker and Docker Compose installed. 2. Clone this repository. 3. Navigate to the project directory. 4. Run make up 5. Access the FastAPI application at API Documentation http://localhost:18123/docs 6. Access Prometheus at http://localhost:9090 7. Access Grafana at http://localhost:3000 - Login (default credentials: admin/admin) - Go to Dashboard , select FastAPP RED Metrics Dashboard How Run the Simulation This project uses Locust for load testing (simulating real usage). When you run make simulate , Locust will: - Start 10 users (virtual clients) - Spawn rate of 1 user per second - Target the API at http://localhost:18123 - Run in headless mode (without Web UI) How to Implement to Your Own FastAPI Application 1. Install Dependencies : Add the required dependencies to your requirements.txt 2. copy metrics.py to your FastAPI application 3. in main.py , import and include the metrics middleware 🤔 What are RED Metrics? RED metrics are a set of metrics that provide a high-level overview of your service's performance: - Rate : The number of requests per second. - Errors : The number of failed requests per second. - Duration : The amount of time each request takes. Benefits of RED Metrics 1. Simplicity : RED metrics provide a clear and concise view of your service's ","default_branch":null,"files":null,"tree":[],"storefront":"/r/agfianf","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/agfianf/fastapi-RED-metrics/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}