release notes/v0.21.0.md
v0.21.0 is here! :tada:
We're happy to see continued contributions from members of the community in this release, from 4 people outside of Load Impact this time around. A big thanks to the following people for contributing to this release: @antekresic, @cyberw, @danron and @jmccann. Also, thanks to everyone that contributed in other ways on Github, in Slack and for spreading the word about k6!
To see the current plan for the next release, check out this milestone, which we aim to make the v1.0 release!
Have a look at our roadmap for what's up ahead, beyond the v1.0 release.
--tag flag and tags option to set test-wide tags (#553)You can now specify any number of tags on the command line using the --tag NAME=VALUE flag. You can also use the tags option to the set tags in the code.
The specified tags will be applied across all metrics. However if you have set a tag with the same name on a request, check or custom metric in the code that tag value will have precedence.
Thanks to @antekresic for their work on this!
Docs: Test wide tags and Options
--summary-time-unit flag (#638)You can now specify the time unit used to show the summary trend stats. It can be: 's' for seconds, 'ms' for milliseconds or 'us' microseconds.
$ k6 run --summary-time-unit ms ~/script.js
Docs: Options
import http from "k6/http";
import { check } from "k6";
export default function() {
// Passing username and password as part of URL plus the auth option will authenticate using HTTP Digest authentication
let res = http.get("http://user:[email protected]/path", {auth: "ntlm"});
// Verify response
check(res, {
"status is 200": (r) => r.status === 200
});
}
Docs: HTTP Params
There is now support for correlating JSON values in recordings, replacing recorded request values with references to the previous response.
Thanks to @cyberw for their work on this!
Since InfluxDB indexes tags, highly variable information like vu, iter or even url may lead to high memory usage. The InfluxDB documentation recommends to use fields in that case, which is what k6 does now. There is a new INFLUXDB_TAGS_AS_FIELDS option (collectors.influxdb.tagsAsFields in the global k6 JSON config) that specifies which of the tags k6 emits will be sent as fields to InfluxDB. By default that's only url (but not name), vu and iter (if enabled).
Thanks to @danron for their work on this!
Previously the setup() and teardown() functions timed out after 10 seconds. Now that period is configurable via the setupTimeout and teardownTimeout script options or the K6_SETUP_TIMEOUT and K6_TEARDOWN_TIMEOUT environment variables. The default timeouts are still 10 seconds and at this time there are no CLI options for changing them to avoid clutter.
Metrics streamed to the Load Impact cloud can be partially aggregated to reduce bandwidth usage and processing times. Outlier metrics are automatically detected and excluded from that aggregation.
Docs: Load Impact Insights Aggregation
The default sleep time added at the end of the generated test has been changed from 2-4s to 20-40s to be more realistic (although still probably on the low end for some types of sites [1][2]).
[1] - https://moz.com/blog/ecommerce-benchmark-kpi-study-2017 [2] - https://www.brafton.com/blog/strategy/brafton-2017-content-marketing-benchmark-report/
It's now possible to add the remote server's IP address to the tags for HTTP and WebSocket metrics. The ip system tag is not included by default, but it could easily be enabled by modifying the systemTags option.
There is a new log format called raw. When used, it will print only the log message without adding any debug information like, date or the log level. It should be useful for debuging scripts when printing a HTML response for example.
$ k6 run --log-format raw ~/script.js
There is now support for outputing metrics to Apache Kafka! You can configure a Kafka broker (or multiple ones), topic and message format directly from the command line like this:
k6 --out kafka=brokers={broker1,broker2},topic=k6,format=json
The default format is json, but you can also use the InfluxDB line protocol for direct ingestion by InfluxDB:
k6 --out kafka=brokers=my_broker_host,topic=k6metrics,format=influxdb
You can even specify format options such as the tagsAsFields option for InfluxDB:
k6 --out kafka=brokers=someBroker,topic=someTopic,format=influxdb,influxdb.tagsAsFields={url,name,myCustomTag}
Docs: Apache Kafka output
Thanks to @jmccann for their work on this!
It's now possible to simultaneously send the emitted metrics to several outputs by using the CLI --out flag multiple times, for example:
k6 run --out json=test.json --out influxdb=http://localhost:8086/k6
Thanks to @jmccann for their work on this!
There's now a new CLI flag --exit-on-running when running cloud tests (k6 cloud ...) to have k6 exit when the test reaches the running state.
open function outside init context (#563)-race (#564)Selection.each(fn) function, which was returning only the first element. (#610)--no-color option is now being repected for the logs. (#634)no_compress and project_id and the payload_size InfluxDB option have been renamed to noCompress, projectID and payloadSize respectively, to match the other JS option names.