Skip to content

shosseini811/DevOps-Projects

Repository files navigation

FastAPI Monitoring and Logging Demo

This project demonstrates a production-ready FastAPI setup with monitoring and logging capabilities.

Features

  • FastAPI backend with structured logging
  • Prometheus metrics integration
  • Grafana dashboards for visualization
  • Docker and Docker Compose setup
  • Built-in health checks and monitoring endpoints

Prerequisites

  • Docker and Docker Compose
  • Python 3.9+ (for local development)

Quick Start

  1. Clone the repository
  2. Run the stack:
    docker-compose up --build

Accessing Services

Monitoring Endpoints

Development

  1. Create a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  2. Install dependencies:

    pip install -r requirements.txt
  3. Run the application:

    python src/main.py

Logging

The application uses structured logging with the following features:

  • Request/response logging with timing
  • JSON format for easy parsing
  • Correlation IDs for request tracking

Metrics

The following metrics are available:

  • Request latency
  • Request counts by endpoint
  • HTTP status codes
  • System metrics (CPU, memory)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published