# Prometheus Configuration
#
# This file configures Prometheus to scrape metrics from HotPlex Worker Gateway.
#
# See: https://prometheus.io/docs/prometheus/latest/configuration/configuration/

global:
  scrape_interval: 15s
  evaluation_interval: 15s
  external_labels:
    cluster: 'hotplex'
    environment: 'docker'

# Alertmanager configuration (optional - disabled by default)
# alertmanagers:
#   - static_configs:
#       - targets: []

# Load rules once and periodically evaluate them
rule_files:
  # - /etc/prometheus/rules/*.yml

# Scrape configurations
scrape_configs:
  # Scrape Prometheus itself
  - job_name: 'prometheus'
    static_configs:
      - targets: ['localhost:9090']
    metrics_path: /metrics

  # Scrape HotPlex Worker Gateway
  - job_name: 'hotplex'
    static_configs:
      - targets: ['gateway:9999']
    metrics_path: /admin/metrics
    scrape_interval: 10s
    scrape_timeout: 5s
    honor_labels: true
    relabel_configs:
      # Add cluster label from external_labels
      - replacement: '${cluster}'
        target_label: cluster
      # Normalize instance label
      - source_labels: [__address__]
        regex: '(.+):\d+'
        replacement: '${1}'
        target_label: instance
