v0.37.0
版本发布时间: 2022-03-15 17:50:17
grafana/k6最新发布版本:v0.54.0(2024-09-30 17:50:44)
k6 v0.37.0 is here! 🎉 Mainly it contains fixes and ongoing efforts with refactoring.
New Features!
Added experimental basic event loop (#882)
We added basic event loop support in k6 (#2228 and #2373) :tada: This was just the first step and isn't used by any of the existing k6 JS APIs yet. For now, it is only available to xk6 extensions like this one that adds support for setTimeout()
, setInterval()
, clearTimeout()
and clearInterval()
.
Expect to see more changes related to event loops in the next k6 releases, where event loops will start being used by some core k6 modules! For example, by improving some existing JavaScript APIs to have support for callbacks or return Promise
values, so they can be used asynchronously. We expect this change will unlock a lot of previously difficult use cases (see #882), though we'll likely iterate on these new APIs as experimental extensions for a while, to stabilize them before we merge them into the core.
:information_source: If you are an extension developer, please use it and give your feedback. But take into consideration that it's likely that the current Go API may change.
Added an option to output k6 logs to a file through --log-output (#2285)
This is on top of the already supported options for sending logs to stdout/stderr and to Grafana Loki. This new feature speaks for itself with simple usage examples:
k6 run --log-output file=./k6.log --logformat json ./examples/stages.js
And one more with a defined minimal log level:
k6 run --log-output file=./k6.log,level=info --logformat json ./examples/stages.js
Thanks, @alyakimenko for the contribution!
Docs: Using file output
Breaking changes
Introduced stricter thresholds parsing (#2400)
In the past, thresholds were evaluated using a JavaScript runtime. For a multitude of reasons, this wasn't satisfying. As of v0.37.0, thresholds are now parsed directly in Go. As a result, k6 will now return an error message on thresholds that do not strictly match the documented specification, instead of just silently ignoring them. Another change is that when a non syntactically correct threshold expression is detected, k6 will immediately interrupt its execution before even starting the load test run.
Below you can find examples of the thresholds expressions that won't work anymore:
export const options = {
thresholds: {
"http_req_duration": [
// although the aggregation method and values are correct,
// the equal sign is invalid; use == or ===
"rate=200",
// thresholds do not support javascript expressions anymore
"throw new Error('wat')",
// it fails, as foo is not a valid threshold expression's aggregation method keyword
"foo>500",
],
},
};
Extensions
v0.37.0
finalizes (#2376) the switching of our internal modules (gRPC module refactoring) to a new Go/JavaScript module API.
:warning: It's important to highlight that the old API (e.g. methods like context.WithRuntime
, common.Bind
and others #2384) is deprecated and will be removed in the next k6 release (v0.38.0
). For this release, every extension that isn't using the new API will get a warning message like this:
WARN[0000] Module 'k6/x/sql' is using deprecated APIs that will be removed in k6 v0.38.0, for more details on how to update it see https://k6.io/docs/extensions/guides/create-an-extension/#advanced-javascript-extension
We did migrations for some xk6 extensions (see connected issues to the task #2344). The pull requests can serve as examples on how to transition your extension to the new API.
Docker Repository
We migrated our Docker Hub repository from loadimpact/k6
to grafana/k6 (#2377).
docker run -i grafana/k6 run - <script.js
We will continue publishing our docker image releases as both loadimpact/k6
and grafana/k6
for several more releases, but if you use the old one in your local or CI environments, please plan the migration.
Enhancements and UX improvements
- We continued work on the source map feature: add samples (#2339) and improve loading and parsing (#2355).
- Updated installation from source instructions (#2359). Thanks, @karitham, for making the change.
- Enabled more TC39 tests: optional-chaining (#2338) and async (#2396).
- We updated our Code of Conduct and a few GitHub URLs (#2416).
Bugs fixed!
-
http.head
started taking a body as a second argument (#2402) by mistake in v0.36.0. It is now back to its old signaturehttp.head(url, [params])
. - Fixed options.scenarios' JSON marshaling (#2392).
- Metrics' names display again in k6's Rest API (#2421).
- We improved argument validation for
check
(#2387),http.batch
(#2415) and metrics' constructors (#2427).
Internals
- We updated our CI to improve developer experience. Dependency and linter checks now run only for pull requests (#2403).
- This release also contains a few refactoring PRs that fix linters errors (#2334, #2331 and #2341), remove global variable usage (#2336, #2358, #2353 and #2357) and remove an unnecessary dependency (#2313) which makes our codebase more consistent and maintainable.
- The
headers
parameter in k6's GRPC module is marked as deprecated (#2370). - Switched
envconfig
to our own fork (#2337) in order to abstract theos
package and improve testability.
1、 k6-v0.37.0-checksums.txt 754B
2、 k6-v0.37.0-linux-amd64.deb 13.01MB
3、 k6-v0.37.0-linux-amd64.rpm 8.78MB
4、 k6-v0.37.0-linux-amd64.tar.gz 15.33MB
5、 k6-v0.37.0-linux-arm64.tar.gz 14.18MB
6、 k6-v0.37.0-macos-amd64.zip 15.06MB
7、 k6-v0.37.0-macos-arm64.zip 14.58MB
8、 k6-v0.37.0-windows-amd64.msi 15.86MB
9、 k6-v0.37.0-windows-amd64.zip 15.46MB