diff --git a/benchmarking/README.md b/benchmarking/README.md index f23a5be..36e8ec6 100644 --- a/benchmarking/README.md +++ b/benchmarking/README.md @@ -3,5 +3,5 @@ We are using [k6](https://k6.io/) for our benchmarking. To run one of the perfor tests you can do: ``` -k6 run -e PAG_HOST=http://localhost --vus 10 --duration 30s benchmarking/perf1.js +k6 run -e PAG_HOST=http://localhost --vus 10 --duration 30s benchmarking/labels.js ``` \ No newline at end of file diff --git a/benchmarking/perf1.js b/benchmarking/labels.js similarity index 100% rename from benchmarking/perf1.js rename to benchmarking/labels.js diff --git a/benchmarking/no_labels.js b/benchmarking/no_labels.js new file mode 100644 index 0000000..072718a --- /dev/null +++ b/benchmarking/no_labels.js @@ -0,0 +1,36 @@ +import http from 'k6/http'; +import { check } from 'k6'; + +function getRandInteger(min, max) { + return Math.floor(Math.random() * (max - min) ) + min; +} + +/* +Original prom-agg-gateway doesn't support labels so this perf test +is here mostly to compare against them. +*/ +export default function () { + const url = `${__ENV.PAG_HOST}/metrics/`; + + const randomMetric1 = getRandInteger(1, 50) + const randomMetric2 = getRandInteger(1000, 3000) + const randomMetric3 = getRandInteger(3000, 4000) + + const payload = ` + # TYPE some_metric counter + some_metric{label="val1"} ${randomMetric1} + # TYPE another_metric gauge + # HELP another_metric Just an example. + another_metric ${randomMetric2} + k6_http_requests_total{method="post",code="200"} ${randomMetric3} + ` + + const params = { + headers: { + 'Content-Type': 'application/json', + }, + }; + + const res = http.post(url, payload, params); + check(res, { 'status was 200ish': (r) => r.status < 300 }); +}