release notes/v0.45.0.md
k6 v0.45.0 is here 🎉! This release includes:
There is a new experimental module k6/experimental/grpc. It is a copy of the k6/net/grpc module with added stream support #2020.
This example shows server streaming:
import { Client, Stream } from 'k6/experimental/grpc';
import { sleep } from 'k6';
const COORD_FACTOR = 1e7;
// to run this sample, you need to start the grpc server first.
// to start the grpc server, run the following command in k6 repository's root:
// go run -mod=mod examples/grpc_server/*.go
// (golang should be installed)
const GRPC_ADDR = __ENV.GRPC_ADDR || '127.0.0.1:10000';
const GRPC_PROTO_PATH = __ENV.GRPC_PROTO_PATH || '../../grpc_server/route_guide.proto';
let client = new Client();
client.load([], GRPC_PROTO_PATH);
export default () => {
client.connect(GRPC_ADDR, { plaintext: true });
const stream = new Stream(client, 'main.FeatureExplorer/ListFeatures', null);
stream.on('data', function (feature) {
console.log(
'Found feature called "' +
feature.name +
'" at ' +
feature.location.latitude / COORD_FACTOR +
', ' +
feature.location.longitude / COORD_FACTOR
);
});
stream.on('end', function () {
// The server has finished sending
client.close();
console.log('All done');
});
stream.on('error', function (e) {
// An error has occurred and the stream has been closed.
console.log('Error: ' + JSON.stringify(e));
});
// send a message to the server
stream.write({
lo: {
latitude: 400000000,
longitude: -750000000,
},
hi: {
latitude: 420000000,
longitude: -730000000,
},
});
sleep(0.5);
};
You can just replace k6/net/grpc import with k6/experimental/grpc to use the new functionality. Documentation for the module is available here.
In the future, this functionality will be moved to the k6/net/grpc module.
For years users have wanted to be able to update the test that is saved in the cloud but not run it at this exact point.
This is now possible by adding --upload-only when invoking k6 cloud as in k6 cloud --upload-only script.js.
This is likely going to be most useful in a CI on the actual test script project. Now that CI can just run k6 cloud --upload-only new-version-of-script.js on "release".
And later on that newer version will be used. For example by a scheduled run.
Support for high-cardinality metrics metadata was added in v0.41.0, but it wasn't accessible from test scripts. It's now possible to set or delete metadata for the whole VU with a similar API as used for tags:
import exec from "k6/execution";
export default () => {
exec.vu.metrics.metadata["my_cool_id"] = "a very unique value";
// all metrics from here on will have this metadata set
delete exec.vu.metrics.metadata["my_cool_id"];
// all metrics from here on will *not* have the metadata set
}
This also introduces the sub-object metrics on the vu object.
Apart from metadata it has another property tags. This is meant to be the new way to set tags instead of using exec.vu.tags.
There are no current plans to replace exec.vu.tags with exec.vu.metrics.tags.
JSON.parse will now fail with a friendlier error message.Locator.WaitFor for detached and hidden states.null.scenarios for usage by browser module.the. Thank you, @cuishuang 🙇..golangci.yml for PRs from forks..golangci.yml.k6/data module tests.We're excited to share our public roadmap, outlining the upcoming features and improvements we have planned.
We hope this updated roadmap provides a clear overview of our plans for k6's future development. As always, we welcome feedback, corrections, and suggestions to make this roadmap more comprehensive, accessible, and valuable for the k6 community.
Work on a new version of the cloud output has been ongoing over this cycle.
While functionally it is now mostly complete, we feel like more testing is still needed and some smaller issues need to be ironed out.
Over the next cycle we will be testing it internally, and in v0.46.0 it will be generally available as the default Cloud output. It will still be possible to use the current version via an option, but we plan to gradually deprecate it.
The new output has some benefits over the previous one:
This in general makes the payload sent for tests with a lot of samples much smaller, which also in most cases has turned out to lower the CPU and memory usage.
Other related PRs: #3041, #3061, #3063, #3072, #3082, #3083, #3085, #3098, #3105