# Scrape every briven service's /metrics endpoint. Container names match
# the apps/*/Dockerfile compose service names — adjust the static_configs
# targets if the deploy uses different DNS names.

global:
  scrape_interval: 15s
  evaluation_interval: 15s
  external_labels:
    env: production

alerting:
  alertmanagers:
    - static_configs:
        - targets: ['alertmanager:9093']

rule_files:
  - /etc/prometheus/rules/*.yml

scrape_configs:
  - job_name: prometheus
    static_configs:
      - targets: ['localhost:9090']

  # Service-name targets — docker compose with `--project-name briven` and
  # the compose.dokploy.yml file (no container_name) creates `api`,
  # `runtime`, `realtime` as resolvable service DNS names on
  # dokploy-network. We also list the briven-*-1 container names as a
  # fallback so the scrape works whether observability runs alongside
  # the managed compose project or as a sibling stack.
  - job_name: api
    metrics_path: /metrics
    static_configs:
      - targets: ['briven-api-1:3001', 'api:3001']
        labels:
          service: api

  - job_name: runtime
    metrics_path: /metrics
    static_configs:
      - targets: ['briven-runtime-1:3003', 'runtime:3003']
        labels:
          service: runtime

  - job_name: realtime
    metrics_path: /metrics
    static_configs:
      - targets: ['briven-realtime-1:3004', 'realtime:3004']
        labels:
          service: realtime

  # postgres-exporter sidecar; not in this compose project — operator
  # adds it alongside the Postgres container in the data-plane compose.
  - job_name: postgres
    metrics_path: /metrics
    static_configs:
      - targets: ['postgres-exporter:9187']
        labels:
          service: postgres

  # Host metrics (node-exporter) and per-container metrics (cAdvisor).
  # Both run in this compose project; see compose.yml.
  - job_name: node
    static_configs:
      - targets: ['node-exporter:9100']
        labels:
          service: host

  - job_name: cadvisor
    static_configs:
      - targets: ['cadvisor:8080']
        labels:
          service: containers
