Metrics & thresholds
Interpret metrics and set pass/fail rules for runs and scoped measurements.
On this page
Choose the right working directory. Examples using
npm runshortcuts,node bin/loadstride.js, or top-levelstarter-kit/paths run from the LoadStride source checkout. Those shortcuts do not exist in your application’s package.json. Installed-package users runnpx --no-install loadstridefrom their application directory. See Getting started for both options.
Metrics and pass/fail
| Metric | Fields | Meaning |
|---|---|---|
http_reqs |
count, rate |
Requests and requests per second |
http_req_duration |
min, avg, max, p(50), p(95), p(99) |
Full request latency in milliseconds |
http_req_failed |
count, rate |
Transport errors or final HTTP status outside 200–399 |
iterations_started |
count, rate |
Iteration functions started, including errors or cancellations |
dropped_iterations |
count, rate |
Arrival slots skipped due to capacity or scheduling delays |
scheduling_delay |
min, avg, max, p(50), p(95), p(99) |
Delay from scheduled slot to dispatch, in milliseconds; arrival mode only |
iteration_duration |
min, avg, max, p(50), p(95), p(99) |
Whole iteration duration, including sleeps, exceptions, and cancellation, in milliseconds |
iterations |
count, rate |
Successfully completed iteration functions |
iteration_errors |
count |
Iteration exceptions, excluding cancellation |
checks |
passed, failed, rate |
Predicate results and fraction passing |
data_received |
bytes, rate |
Decoded response bytes and bytes per second |
Rates use elapsed load time, including the drain period. Failed and timed-out requests are included in latency statistics. Percentiles come from Node’s bounded HDR histogram and have quantization error; they are not exact stored-sample percentiles. No requests means no latency observations, so latency thresholds fail. A request can satisfy a custom check and still count as an HTTP failure. Scheduling-delay thresholds also fail when there are no dispatch observations.
Thresholds accept <, <=, >, >=, and == against nonnegative numeric values.
All configured thresholds must pass. Without thresholds, request/check failures
and dropped iterations are reported but do not independently fail a run. Uncaught iteration errors
always fail a run. Include checks: ['rate==1'] and a request failure threshold
when these should gate CI. In arrival mode, add dropped_iterations: ['count==0']
to fail CI when the requested workload could not be delivered.
The report also includes a status-code breakdown, up to ten error messages, event-loop utilization, and p99 event-loop delay. These generator diagnostics help assess saturation; they do not guarantee that the generated load is accurate.
CLI exit codes: 0 passed, 1 threshold or iteration failure, 2 configuration,
hook, or runtime error, 130 cancellation or expired graceful stop.
Scoped thresholds
Use options.scopedThresholds to enforce requirements on a single endpoint or
named transaction. Keep existing options.thresholds for overall metrics. Every
configured rule must pass: a failed scoped rule marks the run failed and makes the
CLI exit with code 1. Rules are evaluated at the end; they do not stop load early.
export const options = {
vus: 2, iterations: 10,
thresholds: { http_req_failed: ['rate==0'] },
scopedThresholds: [
{
scope: 'endpoint', source: 'http', method: 'POST', name: '/api/login',
thresholds: {
duration: ['p(95)<500'],
failures: ['rate<0.01'],
samples: ['count>=10'],
},
},
{
scope: 'transaction', name: 'checkout',
thresholds: {
duration: ['p(99)<2000'], failures: ['count==0'], checks: ['rate==1'],
},
},
],
};
These are illustrative requirements, not recommended latency limits for every app. The workload must actually call the selected endpoint and transaction. For example:
export default async function ({ http, check, transaction }) {
const base = process.env.TARGET_URL ?? 'http://127.0.0.1:3001';
await transaction('checkout', async () => {
const response = await http.post(`${base}/api/login`, JSON.stringify({
username: 'demo-user', password: 'demo-password',
}), { name: '/api/login', headers: { 'content-type': 'application/json' } });
check(response, { 'login returned 200': r => r.status === 200 });
});
}
Exact matching
An endpoint rule requires all of scope, source, method, name, and
thresholds. source is http (Node HTTP helpers) or browser (Playwright
network observations). Method is normalized to uppercase. Method and name are
exact matches, not patterns: * is not a wildcard.
The name is the explicit HTTP request name when supplied. Otherwise it is the
automatic URL origin/path, without credentials/query/fragment, truncated to 200
characters. For a browser navigation to http://127.0.0.1:3001, use that origin
plus / as the endpoint name. Names containing commas, colons, or quotes are just
ordinary strings; there is no selector-string syntax to escape.
A transaction rule requires scope: 'transaction', name, and thresholds.
It does not accept endpoint source or method. Names follow the existing metric
label rules: nonblank, at most 200 characters, no control characters, whitespace
trimmed. Unknown entry properties and unsupported metrics are configuration errors.
Metrics and units
| Scoped metric | Fields usable in expressions | Meaning |
|---|---|---|
duration |
min, avg, max, p(50), p(95), p(99) |
Milliseconds; failed requests/calls are included |
failures |
count, rate |
Failed requests or transaction calls; rate is the failure fraction from 0 to 1 |
samples |
count, rate |
Request/call count; rate is count per elapsed report second, including drain |
checks |
passed, failed, rate |
Transaction-only checks; rate is the success fraction from 0 to 1 |
Expressions use <, <=, >, >=, or == with nonnegative numbers, like existing
aggregate thresholds. Duration percentiles come from merged histogram samples,
not averaged per-scenario percentiles. Transaction durations and checks remain
inclusive for nesting. Endpoint failures follow HTTP status/transport semantics;
transaction failures mean thrown errors or failed checks in their scope. A caught
transaction error can now fail the run if its scoped failure rule is breached,
even when the iteration itself completes successfully.
Missing measurements fail
Every scoped rule requires at least one matching request/call. Missing names fail
with No matching samples, even for failures: ['count==0'] or
samples: ['count==0']. This prevents typos and skipped flows from passing without
evidence. Transaction checks rules additionally require a check observation and
otherwise fail with No checks observed. Playwright expect assertions can fail
a transaction by throwing, but are not counted as LoadStride check observations.
JSON scoped threshold results are appended to the existing thresholds array.
They retain metric, expression, actual, and passed and add:
{
"scope": { "type": "endpoint", "source": "http", "method": "POST", "name": "/api/login" },
"observed": false,
"actual": null,
"passed": false,
"reason": "No matching samples"
}
Observed rules have observed: true and a numeric actual value. Console and HTML
identify the endpoint/transaction beside each rule and show missing-data reasons.
Report format remains version 1; older reports with only aggregate rules render
unchanged.
Multiple scenarios and bounded labels
Top-level scoped rules evaluate the merged run. A scenario’s own scopedThresholds
evaluate only that scenario and are not inherited by other scenarios. All local
and overall rules must pass. Other scenarios continue after a local rule failure.
Cancelled scenarios that never start have no samples and cannot pass their rules.
Configured names reserve slots in the existing limits of 100 endpoint identities and 100 transaction names per accumulator. The engine allocates their histograms only when observed. Targets of merged-run rules are reserved in every scenario before load, so a late request/call cannot be lost in overflow. Other labels may therefore enter overflow sooner. Counts, bytes, and timing for overflow are still retained; overflow rows are never used as substitutes for a selected name.
Limits: 100 scope entries, 20 expressions per metric per entry, and 1,000 total
scoped rules per configuration. The union of global/local reserved identities in
any scenario must fit the existing 100-per-kind limits; invalid unions fail before
setup or load starts. Duplicate targets share one reservation. [] disables scoped
rules; null is invalid.
Configure these rules in JavaScript test options (or programmatic run overrides), not new CLI flags or environment variables. Engine/scenario normalization preserves the option. General metric tags, wildcard matching, scoped custom metrics, and automatic route normalization remain outside this implementation.
Try the bundled examples
## Terminal 1
npm run demo:auth-server
## Terminal 2
npm run test:transactions
The API demo includes endpoint and transaction limits. The browser demo includes
transaction limits: npm run browser:demo -- --vus 2 --iterations 4 after browser
installation. Adjust requirements in the scripts to your app’s expected behavior.
Based on the released v0.2.0 guide. View source on GitHub.