k6
k6 copied to clipboard
Refactor group and check to not be tightly coupled
What?
Group and check were tightly coupled between them and also to the end of test summary and the REST API.
This change the tight coupling is removed. Group and check no longer interact with each other while being run.
In order to keep the same end of test summary and REST API behavior the code makes the same aggregation it used to be but only based on the metrics emitted by check
and group
.
There are several breaking changes still in it as a bunch of things are no longer useful, and technically not implementable if we want to remove the tight coupling.
The only one that is relevant though is that
lib.State
no longer has Group
.
There are 2 extensions using that and both of them use it to use the "magic" that tight group
and check
together.
Why?
The previous code apart from having problems code smell wise, meant that you can't implement this functionality in JS.
Which also means that they act very strangely especially as if you do not look closely it just seems like they set a few tags and emit metrics.
While working on #2728 it became apparent that it is unlikely we will get a perfect solution and one of the big problems is that you can't even experiment without having to write a fairly complicated async go code.
So this also makes that issue a bit more actionable. And definitely a thing that now people can have not perfect or even 80%, but still workable for them solutions.
Checklist
- [x] I have performed a self-review of my code.
- [ ] I have added tests for my changes.
- [x] I have run linter locally (
make lint
) and all checks pass. - [x] I have run tests locally (
make tests
) and all tests pass. - [x] I have commented on my code, particularly in hard-to-understand areas.
Related PR(s)/Issue(s)
#2869