Skip to content

Instantly share code, notes, and snippets.

@averylizette
Last active November 10, 2019 00:27
Show Gist options
  • Save averylizette/24c8c85a49a40742d7dcb6a77f265dc7 to your computer and use it in GitHub Desktop.
Save averylizette/24c8c85a49a40742d7dcb6a77f265dc7 to your computer and use it in GitHub Desktop.
Config:
import http from "k6/http";
import { check } from "k6";
import { Rate } from "k6/metrics";
export let errorRate = new Rate("errors");
export let options = {
thresholds: {
"errors": ["rate<0.1"], // <10% errors
}
};
export default function() {
const result = check(http.get("http://localhost:3000/9999996/"), {
"status is 200": (r) => r.status == 200
})
errorRate.add(!result);
};
results:
Averys-MacBook-Air:Recommendations averylizette$ k6 run --vus 1 --duration 30s checks_thresholds.js
/\ |‾‾| /‾‾/ /‾/
/\ / \ | |_/ / / /
/ \/ \ | | / ‾‾\
/ \ | |‾\ \ | (_) |
/ __________ \ |__| \__\ \___/ .io
execution: local
output: -
script: checks_thresholds.js
duration: 30s, iterations: -
vus: 1, max: 1
done [==========================================================] 30s / 30s
✓ status is 200
checks.....................: 100.00% ✓ 12063 ✗ 0
data_received..............: 9.3 MB 311 kB/s
data_sent..................: 1.1 MB 35 kB/s
✓ errors.....................: 0.00% ✓ 0 ✗ 12063
http_req_blocked...........: avg=5.04µs min=2µs med=4µs max=1.97ms p(90)=6µs p(95)=6µs
http_req_connecting........: avg=35ns min=0s med=0s max=431µs p(90)=0s p(95)=0s
http_req_duration..........: avg=2.23ms min=801µs med=1.38ms max=216.24ms p(90)=3.24ms p(95)=4.85ms
http_req_receiving.........: avg=110.58µs min=52µs med=99µs max=16.4ms p(90)=146µs p(95)=176µs
http_req_sending...........: avg=24.55µs min=12µs med=22µs max=1.1ms p(90)=32µs p(95)=40µs
http_req_tls_handshaking...: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...........: avg=2.1ms min=679µs med=1.25ms max=216.11ms p(90)=3.08ms p(95)=4.66ms
http_reqs..................: 12063 402.097521/s
iteration_duration.........: avg=2.45ms min=965.28µs med=1.6ms max=216.44ms p(90)=3.51ms p(95)=5.1ms
iterations.................: 12063 402.097521/s
vus........................: 1 min=1 max=1
vus_max....................: 1 min=1 max=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment