apps/learning-api/monitoring/README.md

Monitoring Stack

This directory contains all monitoring infrastructure for the learning-api project.

Monitoring Stack

This directory contains all monitoring infrastructure for the learning-api project.

Components

Core Monitoring

  • Prometheus: Metrics collection and storage
  • Grafana: Visualization dashboards
  • Pushgateway: For batch job metrics
  • Flower: Celery task monitoring UI

Quick Start

  1. Start monitoring stack:
    cd monitoring
    docker-compose up -d
    
  2. Access services:
  3. Build custom images (optional):
    cd monitoring
    ./build-metrics.sh
    

Environment Variables

Set these in your .env file:

CELERY_BROKER_URL=redis://redis:6379/0
CELERY_RESULT_BACKEND=redis://redis:6379/0
PUSHGATEWAY_URL=http://pushgateway:9091
FLOWER_USER=admin
FLOWER_PASSWORD=admin

Files Structure

monitoring/
├── docker-compose.yml          # Main monitoring stack
├── prometheus.yml              # Prometheus configuration
├── grafana-celery-dashboard.json # Pre-built Grafana dashboard
├── build-metrics.sh           # Build script for custom images
├── push-metrics-to-acr.sh     # Azure Container Registry push script
├── docker/                    # Dockerfiles for custom builds
│   ├── prometheus.Dockerfile
│   ├── grafana.Dockerfile  
│   ├── flower.Dockerfile
│   └── pushgateway.Dockerfile
├── grafana/                   # Grafana provisioning configs
└── prometheus/                # Prometheus rules and configs

Usage

The monitoring stack is separate from your main application. Run it independently:

# Start only monitoring
cd monitoring && docker-compose up -d

# Start main application  
cd .. && docker-compose up -d

# Both stacks will connect via the external 'learning' network