# Prometheus configuration for monitoring the Pige microservices
global:
  scrape_interval: 15s
  evaluation_interval: 15s

# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets: []

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"

# A scrape configuration containing exactly one endpoint to scrape:
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: "prometheus"
    static_configs:
      - targets: ["localhost:9090"]

  # Monitor Nginx API Gateway
  - job_name: "nginx"
    static_configs:
      - targets: ["nginx:80"]
    metrics_path: /health
    scrape_interval: 30s

  # Monitor Auth Service
  - job_name: "auth-service"
    static_configs:
      - targets: ["auth-service:8000"]
    metrics_path: /metrics
    scrape_interval: 15s
    scrape_timeout: 10s

  # Monitor Account Service
  - job_name: "account-service"
    static_configs:
      - targets: ["account-service:8000"]
    metrics_path: /metrics
    scrape_interval: 15s
    scrape_timeout: 10s

  # Monitor Data Service
  - job_name: "data-service"
    static_configs:
      - targets: ["data-service:8000"]
    metrics_path: /metrics
    scrape_interval: 15s
    scrape_timeout: 10s

  # Monitor Frontend
  - job_name: "frontend"
    static_configs:
      - targets: ["frontend:3000"]
    metrics_path: /api/metrics
    scrape_interval: 30s

  # Monitor MongoDB
  - job_name: "mongodb"
    static_configs:
      - targets: ["mongodb:27017"]
    scrape_interval: 30s

  # Monitor Redis
  - job_name: "redis"
    static_configs:
      - targets: ["redis:6379"]
    scrape_interval: 30s

  # Monitor Kafka
  - job_name: "kafka"
    static_configs:
      - targets: ["kafka:9092"]
    scrape_interval: 30s

  # Monitor Elasticsearch
  - job_name: "elasticsearch"
    static_configs:
      - targets: ["elasticsearch:9200"]
    metrics_path: /_prometheus/metrics
    scrape_interval: 30s