release notes/v0.34.0.md
k6 v0.34.0 is here! :tada: It introduces the already announced k6/execution API and includes some more enhancements and a bunch of minor bug fixes.
k6/executionThe k6/execution module allows the fetching of information about the current VU, instance (mostly relevant in distributed/cloud) or scenario execution state through a series of exported properties.
Some of the previously suggested solutions with the globally available __VU and __ITER values, such as for getting a unique object per iteration from an array or SharedArray, can be done by using the scenario.iterationInTest property, which is guaranteed to be unique across VUs, even for distributed or cloud tests. For example:
import exec from "k6/execution";
import { SharedArray } from "k6/data";
const data = new SharedArray("my dataset", function(){
return JSON.parse(open('my-large-dataset.json'));
})
export const options = {
scenarios :{
"use-all-the-data": {
executor: "shared-iterations",
vus: 100,
iterations: data.length,
maxDuration: "1h"
}
}
}
export default function() {
// this is unique even in the cloud
var item = data[exec.scenario.iterationInTest];
http.post("https://httpbin.test.k6.io/anything?endpoint=amazing", item)
}
You can read the full documentation here.
POST HTTP request method instead of GET for pushing logs to Loki (#2100).blacklistIPs option using the CIDR notation in JSON (#2083).ext.loadimpact option has the same precedence as the script configuration during the consolidation process (#2099).common.Bind, which also gives JS modules and extensions easy access to some useful internal objects and runtime information (#2108). This API is not yet stable, it's very likely to change more in future k6 versions.