apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
  name: arc-listeners
  namespace: monitoring
  labels:
    app.kubernetes.io/part-of: osdc-monitoring
spec:
  namespaceSelector:
    matchNames:
      - arc-systems
  selector:
    matchLabels:
      app.kubernetes.io/component: runner-scale-set-listener
  podMetricsEndpoints:
    - port: metrics
      interval: 3m
      scrapeTimeout: 10s
      metricRelabelings:
        # Keep only operationally important listener metrics
        # Drops low-value gauges (idle/busy/registered/min/max runners)
        - action: keep
          sourceLabels: [__name__]
          regex: "gha_assigned_jobs|gha_completed_jobs_total|gha_started_jobs_total|gha_running_jobs|gha_job_execution_duration_seconds_(sum|count)|gha_job_startup_duration_seconds_(sum|count)|gha_capacity_.*"
        # Drop instance label — pod IP changes on restart, adds no value
        - action: labeldrop
          regex: "instance"
