k6 extensions allow using functionality not supported natively in k6. They are standalone Go projects that can call internal Go APIs in k6 to provide new functionality.
Before k6 extensions, extending k6 with custom functionality that isn't available in the open-source tool has been possible in one of two ways:
- By forking the k6 repository and doing the changes in Go.
Both methods have some drawbacks:
- k6 might not accept contributions if they don't align with the long-term vision.
To address these issues and allow the community to adapt k6 to their needs, we released the xk6 framework and the concept of k6 extensions, providing the freedom to experiment with novel integrations with k6.
Its main features are:
- Ease of use: with a few commands even less technical users should be able to build their own k6 binaries, given that they have the Go toolchain installed and any dependencies required by a specific extension.
- Simple API for Go programmers that handles the Go<->JS translation, with the ability to call any public k6 Go API. Extensions are first-class components along with other built-in modules.
- Cross-platform like Go and runs great on macOS, Windows and Linux.
The currently supported extension types are:
While k6 has built-in support for many popular output backends, this list will undoubtedly not be exhaustive. Support for new systems and novel ways of handling the metric data generated by k6 can be easily added with Output extensions. These receive metric samples from k6, and are able to do any processing or further dispatching.
k6 extensions work for local execution, i.e. running a script with a k6 binary built by xk6 on your own infrastructure. The k6 Kubernetes operator also supports custom k6 binaries with extensions.
In k6 Cloud, only supported k6 extensions are available for Enterprise customers.
For all k6 Cloud users, it is possible to run a binary built with xk6 and send metrics produced by extension code to the Cloud using the cloud output.