I'm trying to capture http_errors with a custom tag to differentiate their status code, within my script I'm creating const httpErrors = new Counter("http_errors");. Then within the default function after doing a check y use:
if (!success) {
httpErrors.add(1, { status_code: `${res.status}` });
}
But all I'm getting in pushgateway metrics is http_errors{instance="",job="k6_tests"} 2.0029295916436496
I run de following command:
K6_WEB_DASHBOARD=true K6_WEB_DASHBOARD_EXPORT=./reports/api_spins/smoke-test-report.html K6_PUSHGATEWAY_URL=http://localhost:9091 K6_JOB_NAME=k6_tests k6 run --out csv=./reports/api_spins/smoke_test_results.csv --out output-prometheus-pushgateway ./dist/tests/api_spins/smoke_test.es.js
this is my k6 install:
xk6 build --with github.com/martymarron/xk6-output-prometheus-pushgateway@latest --with github.com/grafana/xk6-faker@latest --with github.com/grafana/xk6-dashboard@latest
I checked with --verbose but xk6-output-prometheus-pushgateway is not adding any label or tags, I want to get something like: http_errors{instance="",job="k6_tests",status_code="400"} 2.0029295916436496