global:
  scrape_interval: 15s
  evaluation_interval: 15s
  external_labels:
    project: momentpay
    environment: production

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

rule_files:
  - "alert_rules/reversal_alerts.yml"
  - "alert_rules/switch_alerts.yml"
  - "alert_rules/beam_vm_alerts.yml"

scrape_configs:
  # Mercury Switch application — all metric families
  - job_name: mercury-switch
    metrics_path: /monitoring/metrics
    scrape_interval: 10s
    scrape_timeout: 5s
    static_configs:
      - targets:
          - "${MERCURY_HOST:-host.docker.internal}:${MERCURY_PORT:-4000}"
        labels:
          service: mercury-switch
          environment: production
    metric_relabel_configs:
      - source_labels: [__name__]
        regex: "iso8583_.*"
        target_label: component
        replacement: switch
      - source_labels: [__name__]
        regex: "network_.*"
        target_label: component
        replacement: upstream-networks
      - source_labels: [__name__]
        regex: "beam_.*"
        target_label: component
        replacement: beam-vm
      - source_labels: [__name__]
        regex: "reversal_.*"
        target_label: component
        replacement: reversal-system

  # Prometheus self-monitoring
  - job_name: prometheus
    static_configs:
      - targets:
          - localhost:9090

  # AlertManager self-monitoring
  - job_name: alertmanager
    static_configs:
      - targets:
          - alertmanager:9093
