|
1 | 1 | ---
|
2 | 2 | title: Extensions
|
3 |
| -description: 'The k6 extension ecosystem enables developers and testers to extend k6 to cover use cases not supported natively in the core. Explore the endless possibilities of k6 and xk6.' |
| 3 | +description: 'The k6 extension ecosystem enables developers and testers to extend k6 to cover use cases not supported natively in the core.' |
4 | 4 | weight: 700
|
5 | 5 | ---
|
6 | 6 |
|
7 | 7 | # Extensions
|
8 | 8 |
|
9 |
| -Expand the potential use cases for k6. |
| 9 | +<!-- TODO: Add content --> |
10 | 10 |
|
11 |
| -## Quickstart |
| 11 | +{{< section >}} |
12 | 12 |
|
13 |
| -<div class="nav-cards"> |
14 |
| - <a href=explore/ class="nav-cards__item nav-cards__item--guide"> |
15 |
| - <h4>🔎 Explore</h4> |
16 |
| - <p>A list of more than 50 available extensions.</p> |
17 |
| - </a> |
18 |
| - <a href=build-k6-binary-using-go/ class="nav-cards__item nav-cards__item--guide"> |
19 |
| - <h4>🧩 Bundle</h4> |
20 |
| - <p>Combine multiple extensions into a custom k6 binary.</p> |
21 |
| - </a> |
22 |
| - <a href=create/ class="nav-cards__item nav-cards__item--guide"> |
23 |
| - <h4>🏗️ Create</h4> |
24 |
| - <p>Learn how to make your own k6 extension.</p> |
25 |
| - </a> |
26 |
| -</div> |
27 |
| - |
28 |
| -## Custom k6 builds |
29 |
| - |
30 |
| -With k6 extensions, you can create custom k6 binaries to support your specific reliability-testing needs. |
31 |
| - |
32 |
| -Currently, k6 supports two ways to extend its native functionality: |
33 |
| - |
34 |
| -- **JavaScript extensions** extend the JavaScript APIs available to your test scripts. Add support for new network protocols, improve performance compared to equivalent JS libraries, or add features. |
35 |
| - |
36 |
| -- **Output extensions** send metrics to a custom file format or service. Add custom processing and dispatching. |
37 |
| - |
38 |
| -- **Secret Source extensions** provide secrets to your tests. |
39 |
| - |
40 |
| -## xk6 makes custom binaries |
41 |
| - |
42 |
| -[xk6](https://github.com/grafana/xk6/) is command-line tool and framework written in Go. With xk6, you build custom k6 binaries that bundle one or more extensions written in Go. You have two options for creating k6 binaries: using [Go and xk6](https://grafana.com/docs/k6/<K6_VERSION>/extensions/build-k6-binary-using-go/) or [Docker](https://grafana.com/docs/k6/<K6_VERSION>/extensions/build-k6-binary-using-docker/): |
43 |
| - |
44 |
| -{{< code >}} |
45 |
| - |
46 |
| -```go-and-xk6 |
47 |
| -xk6 build \ |
48 |
| - --with github.com/grafana/[email protected] \ |
49 |
| - --with github.com/grafana/xk6-output-prometheus-remote |
50 |
| -``` |
51 |
| - |
52 |
| -```docker-in-linux |
53 |
| -docker run --rm -u "$(id -u):$(id -g)" -v "${PWD}:/xk6" grafana/xk6 build \ |
54 |
| - --with github.com/grafana/[email protected] \ |
55 |
| - --with github.com/grafana/xk6-output-prometheus-remote |
56 |
| -``` |
57 |
| - |
58 |
| -{{< /code >}} |
59 |
| - |
60 |
| -<br/> |
61 |
| - |
62 |
| -## Extension use cases |
63 |
| - |
64 |
| -The extensions ecosystem provides endless possibilities to expand the functionality for your k6 testing. Some reasons you might want to extend k6 include the following: |
65 |
| - |
66 |
| -- **To add support for a new network protocol** |
67 |
| - |
68 |
| - For example, [xk6-dns](https://github.com/grafana/xk6-dns) lets users resolve DNS names to IP addresses in k6 scripts. With xk6-dns, you can assert the performance of custom DNS servers under load, and provide a way to resolve DNS names to IP addresses using a specific DNS server. |
69 |
| - |
70 |
| -- **To incorporate a client library for test dependency** |
71 |
| - |
72 |
| - Everyone wants to run their services in Kubernetes these days. With [xk6-kubernetes](https://github.com/grafana/xk6-kubernetes), your JavaScript tests can interface directly with Kubernetes resources using functionality typically restricted to kubectl. Prepare isolated Namespaces for each test run, or inject environment variables as ConfigMaps. |
73 |
| - |
74 |
| -- **To format and send metrics to the output of your choice** |
75 |
| - |
76 |
| - Suppose your company has consolidated its observability metrics into Prometheus. Use [xk6-output-prometheus-remote](https://github.com/grafana/xk6-output-prometheus-remote) to publish your k6 test metrics to Prometheus as well! |
77 |
| - |
78 |
| -- **To improve script performance and efficiency** |
79 |
| - |
80 |
| - Perhaps your company uses OpenTelemetry to trace service requests through layers of microservices. Using [xk6-distributed-tracing](https://github.com/grafana/xk6-distributed-tracing), you can update the http client to link your test requests as the origin for your traces—no need to add JavaScript code to supply the required trace headers. |
81 |
| - |
82 |
| -Next, [Explore the available extensions](https://grafana.com/docs/k6/<K6_VERSION>/extensions/explore) to see how you can expand your use of k6 right now. |
0 commit comments