Skip to content

Commit b926a85

Browse files
dgzlopescodebien
andauthored
Revamp extensions docs (#2030)
* Revamp extensions docs * Update docs/sources/k6/next/extensions/run/_index.md Co-authored-by: Ivan <[email protected]> * Update docs/sources/k6/next/extensions/run/_index.md Co-authored-by: Ivan <[email protected]> * Update docs/sources/k6/next/extensions/run/_index.md Co-authored-by: Ivan <[email protected]> * Update docs/sources/k6/next/extensions/run/_index.md Co-authored-by: Ivan <[email protected]> * Change structure of docs Signed-off-by: Daniel González Lopes <[email protected]> * Added missing parts to explore page * Fix the custom binary link --------- Signed-off-by: Daniel González Lopes <[email protected]> Co-authored-by: Ivan <[email protected]>
1 parent fc4335d commit b926a85

File tree

10 files changed

+132
-686
lines changed

10 files changed

+132
-686
lines changed
Lines changed: 3 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,12 @@
11
---
22
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.'
44
weight: 700
55
---
66

77
# Extensions
88

9-
Expand the potential use cases for k6.
9+
<!-- TODO: Add content -->
1010

11-
## Quickstart
11+
{{< section >}}
1212

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.

docs/sources/k6/next/extensions/create/_index.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
---
2-
title: 'Create a k6 extension'
3-
menuTitle: 'Create an extension'
2+
title: 'Create a new extension'
3+
menuTitle: 'Create a new extension'
44
description: 'Creating k6 extensions does not have to be a daunting task, but there are some prerequisites to succeed.'
55
weight: 04
66
---
77

8-
# Create a k6 extension
8+
# Create a new k6 extension
99

1010
If you find a gap in your testing process that no k6 extension can fix,
11-
consider building your own extension.
12-
13-
These tutorials show you how to create custom JavaScript and output extensions.
11+
consider building your own extension. Use the tutorials below to get started.
1412

1513
- [Create a JavaScript extension](https://grafana.com/docs/k6/<K6_VERSION>/extensions/create/javascript-extensions) to extend the JavaScript functionality of your script or add support for a new network protocol to test.
1614
- [Create an Output extension](https://grafana.com/docs/k6/<K6_VERSION>/extensions/create/output-extensions) to process the metrics emitted by k6 or publish them to unsupported backend stores.
15+
- [Create a Secret Source extension](https://grafana.com/docs/k6/<K6_VERSION>/extensions/create/secret-source_extensions) to provide secrets to your k6 script at runtime.
1716

1817
## Necessary knowledge
1918

docs/sources/k6/next/extensions/explanations/extension-graduation.md

Lines changed: 0 additions & 56 deletions
This file was deleted.

docs/sources/k6/next/extensions/explanations/extensions-registry.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -76,23 +76,6 @@ Our goal is to quickly understand the intent of the extension.
7676

7777
{{< /admonition >}}
7878

79-
## Extension Tiers
80-
81-
Extensions come from multiple sources.
82-
To help distinguish extensions, we're now categorizing each extension into a _tier_.
83-
Each tier definition is as follows:
84-
85-
- **Official Extensions**
86-
87-
_Official extensions_ are those owned and maintained by Grafana Labs.
88-
They will have official documentation and have support provided by members of the Grafana organization.
89-
90-
- **Community Extensions**
91-
92-
_Community extensions_ are created and maintained by an individual or group from the community at large.
93-
These have no implied warranty or level of support.
94-
The Grafana team will make best-effort assistance to keep popular projects in compliance.
95-
9679
## Potential for De-listing
9780

9881
Given our desire to provide the best developer experience when using k6, we reserve the right to de-list any extension we deem is no longer maintaining standards.

0 commit comments

Comments
 (0)