# Time-series report demo: a ramp-up / spike / ramp-down profile that produces
# an interesting shape over time. Run it, export the summary, then render the
# self-contained HTML report — every metric is charted against elapsed time
# (throughput, latency p50/p95/p99, active VUs, error rate), not just shown as
# an end-of-run average.
#
#   loadr run --summary-export results.json examples/24-timeseries-report.yaml
#   loadr report results.json -o report.html
#   open report.html   # hover the charts to read off any point in the run
#
# The summary JSON carries a top-level `timeline` array (one point per snapshot
# interval) that drives the charts; the aggregate tables remain exact.
name: timeseries-report
description: ramp -> spike -> recover, charted over time

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

scenarios:
  # A ramping VU profile: gentle warm-up, a sharp spike, then recovery. The
  # changing concurrency makes throughput, latency and active-VU charts move.
  browse:
    executor: ramping-vus
    start_vus: 0
    stages:
      - { duration: 10s, target: 25 }   # warm up
      - { duration: 10s, target: 25 }   # steady baseline
      - { duration: 5s,  target: 120 }  # spike!
      - { duration: 10s, target: 120 }  # sustained spike
      - { duration: 5s,  target: 25 }   # back off
      - { duration: 10s, target: 25 }   # verify recovery
    flow:
      - request:
          name: feed
          url: /feed
          checks:
            - { type: status, equals: 200 }
      - think_time: { type: constant, duration: 200ms }
      - request:
          name: view-item
          url: /items/42
          checks:
            - { type: status, equals: 200 }
      - think_time: { type: uniform, min: 100ms, max: 400ms }

thresholds:
  http_req_failed: [ "rate<0.05" ]
  http_req_duration: [ "p(95)<1500" ]
