Thresholds¶
Thresholds define pass/fail criteria for your load test. When any
threshold breaches, rampa run exits with code 1.
Syntax¶
<aggregation>[(<parameter>)] <operator> <value>
Aggregation functions¶
Function |
Metric types |
Description |
|---|---|---|
|
Trend |
Mean value |
|
Trend |
Minimum value |
|
Trend |
Maximum value |
|
Trend |
Median (p50) |
|
Trend |
Nth percentile (e.g. |
|
Counter |
Total count |
|
Rate |
Pass ratio (0.0–1.0) |
|
Gauge |
Current value |
Operators¶
<, <=, >, >=, ==, !=
Examples¶
config = rampa.Config(
thresholds={
"http_req_duration": [
"p(95)<500", # 95th percentile under 500ms
"avg<200", # Average under 200ms
"max<2000", # No request over 2 seconds
],
"http_req_failed": [
"rate<0.01", # Less than 1% failure rate
],
"checks": [
"rate>0.99", # At least 99% of checks pass
],
"iterations": [
"count>=100", # At least 100 iterations completed
],
},
)
In a script¶
Define config at module level:
import rampa
config = rampa.Config(
thresholds={
"http_req_duration": ["p(95)<500"],
},
)
@rampa.scenario(executor="constant-vus", vus=10, duration="30s")
async def default(worker: rampa.Worker) -> None:
await worker.http.get("https://api.example.com/data")