# =============================================================================
# GoodGo Platform - Prometheus Configuration
# =============================================================================
# EN: Scrape configuration for all core microservices and infrastructure.
# VI: Cau hinh thu thap metrics cho tat ca dich vu va ha tang.
# =============================================================================

global:
  scrape_interval: 15s
  evaluation_interval: 15s
  scrape_timeout: 10s
  external_labels:
    cluster: 'goodgo'
    environment: 'development'

# ---------------------------------------------------------------------------
# Alert Rules
# ---------------------------------------------------------------------------
rule_files:
  - 'rules/*.yml'
  - 'alert-rules.yml'

# ---------------------------------------------------------------------------
# Alertmanager (configure when ready)
# ---------------------------------------------------------------------------
alerting:
  alertmanagers:
    - static_configs:
        - targets: ['alertmanager:9093']

# ---------------------------------------------------------------------------
# Scrape Targets
# ---------------------------------------------------------------------------
scrape_configs:
  # -------------------------------------------------------------------------
  # Prometheus self-monitoring
  # -------------------------------------------------------------------------
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']

  # -------------------------------------------------------------------------
  # Core Microservices (8 production-ready)
  # -------------------------------------------------------------------------
  - job_name: 'iam-service'
    metrics_path: /metrics
    scrape_interval: 15s
    static_configs:
      - targets: ['iam-service-net:8080']
        labels:
          service: 'iam'
          tier: 'core'

  - job_name: 'merchant-service'
    metrics_path: /metrics
    scrape_interval: 15s
    static_configs:
      - targets: ['merchant-service-net:8080']
        labels:
          service: 'merchant'
          tier: 'core'

  - job_name: 'order-service'
    metrics_path: /metrics
    scrape_interval: 15s
    static_configs:
      - targets: ['order-service-net:8080']
        labels:
          service: 'order'
          tier: 'core'

  - job_name: 'fnb-engine'
    metrics_path: /metrics
    scrape_interval: 15s
    static_configs:
      - targets: ['fnb-engine-net:8080']
        labels:
          service: 'fnb'
          tier: 'core'

  - job_name: 'wallet-service'
    metrics_path: /metrics
    scrape_interval: 15s
    static_configs:
      - targets: ['wallet-service-net:8080']
        labels:
          service: 'wallet'
          tier: 'core'

  - job_name: 'catalog-service'
    metrics_path: /metrics
    scrape_interval: 15s
    static_configs:
      - targets: ['catalog-service-net:8080']
        labels:
          service: 'catalog'
          tier: 'core'

  - job_name: 'inventory-service'
    metrics_path: /metrics
    scrape_interval: 15s
    static_configs:
      - targets: ['inventory-service-net:8080']
        labels:
          service: 'inventory'
          tier: 'core'

  - job_name: 'chat-service'
    metrics_path: /metrics
    scrape_interval: 15s
    static_configs:
      - targets: ['chat-service-net:8080']
        labels:
          service: 'chat'
          tier: 'core'

  # -------------------------------------------------------------------------
  # Infrastructure
  # -------------------------------------------------------------------------
  - job_name: 'traefik'
    metrics_path: /metrics
    static_configs:
      - targets: ['traefik:8080']
        labels:
          service: 'traefik'
          tier: 'infra'

  - job_name: 'redis'
    metrics_path: /metrics
    static_configs:
      - targets: ['redis-exporter:9121']
        labels:
          service: 'redis'
          tier: 'infra'

  - job_name: 'rabbitmq'
    metrics_path: /metrics
    scrape_interval: 30s
    static_configs:
      - targets: ['rabbitmq:15692']
        labels:
          service: 'rabbitmq'
          tier: 'infra'
