# Long soak test wired into observability: Prometheus scrape endpoint,
# JSONL archive, and StatsD — plus an abort threshold as a circuit breaker.
name: soak
description: 1h soak with metric exports

defaults:
  http:
    base_url: https://api.example.com

scenarios:
  soak:
    executor: constant-vus
    vus: 25
    duration: 1h
    think_time: { type: uniform, min: 500ms, max: 1500ms }
    flow:
      - request: { name: list, url: /api/v1/items }
      - request:
          name: detail
          url: /api/v1/items/1
          checks: [ { type: status, equals: 200 } ]

outputs:
  - { type: prometheus, listen: 127.0.0.1:9091 }
  - { type: json, path: soak-results.jsonl }
  - { type: statsd, address: 127.0.0.1:8125, prefix: loadr.soak. }
  # - { type: influxdb, url: http://influxdb:8086, database: loadr, token: "${env.INFLUX_TOKEN}" }
  # - { type: otlp, endpoint: http://otel-collector:4317 }

thresholds:
  http_req_failed:
    - { threshold: "rate<0.02", abort_on_fail: true, delay_abort_eval: 2m }
  http_req_duration: [ "p(95)<600", "p(99.9)<3000" ]
