# Errors Total
#
# Prometheus counter for proxy errors classified by cause, covering filter
# rejections, timeouts, unreachable upstreams and internal faults. Counted
# once per request against the first cause, so retries do not multiply the
# total. Scraped via the admin /metrics endpoint.
#
# Usage:
#   cargo run -p praxis-proxy -- -c examples/configs/observability/errors-total.yaml
#
# Exercise:
#   curl -s http://localhost:8080/healthy/
#   curl -s http://localhost:8080/broken/
#   curl -s http://localhost:9901/metrics | grep errors_total

admin:
  address: "127.0.0.1:9901"

insecure_options:
  allow_private_endpoints: true

listeners:
  - name: web
    address: "127.0.0.1:8080"
    filter_chains:
      - routing

filter_chains:
  - name: routing
    filters:
      - filter: router
        routes:
          - path_prefix: "/broken/"
            cluster: unreachable
          - path_prefix: "/"
            cluster: backend
      - filter: load_balancer
        clusters:
          - name: backend
            endpoints:
              - "127.0.0.1:3000"
          # Nothing listens here: requests to /broken/ fail to connect and
          # are counted as praxis_errors_total{type="upstream_unavailable"}.
          - name: unreachable
            endpoints:
              - "127.0.0.1:3999"
