| 1 | // Every load test in this course ends with the same four numbers, and a count. |
| 2 | export function handleSummary(data) { |
| 3 | const m = data.metrics; |
| 4 | const ms = (v) => `${v.toFixed(1)} ms`; |
| 5 | const lines = [ |
| 6 | `requests per second ${m.http_reqs.values.rate.toFixed(0)}`, |
| 7 | `p50 ${ms(m.http_req_duration.values.med)}`, |
| 8 | `p99 ${ms(m.http_req_duration.values['p(99)'])}`, |
| 9 | `errors ${(m.http_req_failed.values.rate * 100).toFixed(2)} %`, |
| 10 | `failed ${m.http_req_failed.values.passes} of ${m.http_reqs.values.count}`, |
| 11 | ]; |
| 12 | return { stdout: `\n${lines.join('\n')}\n\n` }; |
| 13 | } |