# Prometheus configuration — LLMHosts.com (T-12)

global:
  scrape_interval: 15s
  evaluation_interval: 15s
  scrape_timeout: 10s

rule_files:
  - "alert-rules.yml"

alerting:
  alertmanagers:
    - static_configs:
        - targets:
            - llmhosts-alertmanager:9093

scrape_configs:
  # Prometheus self-monitoring
  - job_name: "prometheus"
    static_configs:
      - targets: ["localhost:9090"]
        labels:
          service: "prometheus"

  # Node Exporter — host-level metrics (CPU, memory, disk, network)
  # node-exporter runs on host network, so use host.docker.internal
  - job_name: "node-exporter"
    static_configs:
      - targets: ["host.docker.internal:9100"]
        labels:
          service: "node-exporter"

  # LLMHosts FastAPI proxy — prometheus_client /metrics endpoint
  # Prometheus joins llmhosts-internal network to reach the container
  - job_name: "llmhosts-proxy"
    metrics_path: /metrics
    static_configs:
      - targets: ["llmhosts:4000"]
        labels:
          service: "llmhosts-proxy"

  # LLMHosts FastAPI proxy — custom /metrics/prometheus endpoint
  # Exposes LLM-specific metrics (cost, savings, cache, tokens, backends)
  - job_name: "llmhosts-custom"
    metrics_path: /metrics/prometheus
    static_configs:
      - targets: ["llmhosts:4000"]
        labels:
          service: "llmhosts-custom"

  # AlertManager
  - job_name: "alertmanager"
    static_configs:
      - targets: ["llmhosts-alertmanager:9093"]
        labels:
          service: "alertmanager"

  # Token (Next.js frontend) — in-process metrics
  - job_name: "token-metrics"
    metrics_path: /api/token/metrics
    static_configs:
      - targets: ["llmhosts-frontend:3000"]
        labels:
          service: "token"

  # Loki
  - job_name: "loki"
    static_configs:
      - targets: ["llmhosts-loki:3100"]
        labels:
          service: "loki"
