-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
statsd output shows vus > 1 after simulation exit #2527
Comments
HI @abadelt, this seems to be because k6 is not guranteed to emit VUS with a value of zero. This is mostly because the This likely can be fixed by just emitting one more time before exiting 🤷 , but I don't really think the core team will priorize this highly. I don't remember anyone else reporting this and it seems to only matter in your case and even then I don't think it's that big of an issue, or do you disagree? You can potentially propose a PR, and we will look into it. Some other related issues which might resolve it:
I see that you tried to work around this with stages, but unfortunately it turns out there is an issue with that as you can see in #2531. That issue as well seems ... low priority to me and touches code that is very sensitive so it's kind of high risk. I have made a small patch that seems to work. I've also probably missed some strange corner case that might mean that the changes need to be way bigger and more complicated. My only proposal for some kind of workaroudn this will be to use |
Hi @mstoykov, thank you for the fast and detailed reply - highly appreciated! |
Hi @abadelt, I was recently told, by @bboreham, about the stastd_exporter You will need to come up with a number, but I would expect that in most cases |
Per @olegbespalov and @javaducky, this issue should probably be part of the StatsD project. Feel free to transfer it here: |
Closing in favor of LeonAdato/xk6-output-statsd#27 |
Brief summary
When running k6 with "--out statsd", and scraping statsd from prometheus, the vusers typically stay > 0 after the simulation exits.
Since Prometheus then keeps scraping the same (last) value, also the Grafana dashboards will show vusers > 0 continuously even when no simulation is running at all.
The "last" vus reported by a k6 execution value is sometimes 1, sometimes a higher value, depending on the stages and the number of users configured there. I tried various configurations, e.g. a longer stage with target 0 at the end. I also played around with different values for gracefulStop, but in my understanding that will only make a difference anyway if iterations don't finish by themselves in time.
Even if k6 clearly states in the logs that the current number of users is zero at the end, the last pushes to statsd before exiting will report vus > 0 for at least 9 out of 10 k6 executions.
This is an example what the k6 log shows at the end for a simple simulation:
running (05.1s), 0/2 VUs, 1 complete and 0 interrupted iterations
getEndpointList ✓ [======================================] 0/2 VUs 5s
followed by the statistics:
I would expect that k6 reports vus=0 here before exiting.
k6 version
v0.38.1
OS
macOS 12.3.1
Docker version and image (if applicable)
No response
Steps to reproduce the problem
Run this sample script and check the k6_vus metric reported to statsd (I tested with a local statsd running in a podman container - hence providing the metrics at http://localhost:9102/metrics):
Expected behaviour
k6_vus = 0 (in statsd) when k6 exits - as shown by the statsd metrics endpoint (e.g. http://localhost:9102/metrics):
Actual behaviour
k6_vus > 0 most of the time after k6 has exited:
The text was updated successfully, but these errors were encountered: