Skip to content

Commit 7d7085a

Browse files
Add link to GitHub source code for all jslib libraries (#1757)
* Add link to GitHub source code for all jslib libraries * Apply suggestions from code review Co-authored-by: Olha Yevtushenko <[email protected]> * Remove duplicate weight property * Apply to v0.54.x --------- Co-authored-by: Olha Yevtushenko <[email protected]>
1 parent 0b1c4d2 commit 7d7085a

File tree

12 files changed

+118
-77
lines changed

12 files changed

+118
-77
lines changed

docs/sources/next/javascript-api/jslib/aws/_index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,12 @@ title: aws
77

88
<!-- TODO: Add content -->
99

10+
{{< admonition type="note" >}}
11+
12+
The source code for this library can be found in the [grafana/k6-jslib-aws](https://github.com/grafana/k6-jslib-aws) GitHub repository.
13+
14+
{{< /admonition >}}
15+
16+
The `aws` module is an external JavaScript library that helps interact with a subset of AWS services in the context of k6 test scripts.
17+
1018
{{< section >}}

docs/sources/next/javascript-api/jslib/http-instrumentation-pyroscope/_index.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,35 @@
11
---
22
title: HTTP instrumentation for Pyroscope
33
menuTitle: http-instrumentation-pyroscope
4-
description: "k6 Pyroscope instrumentation API"
4+
description: 'k6 Pyroscope instrumentation API'
55
weight: 04
66
---
77

88
# HTTP instrumentation for Pyroscope
99

10+
{{< admonition type="note" >}}
1011

11-
With jslib, you can _instrument_ HTTP requests in a way that lets you tag Grafana Cloud Profiles with relevant information generated from k6 tests.
12+
The source code for this library can be found in the [grafana/jslib.k6.io](https://github.com/grafana/jslib.k6.io/tree/main/lib/http-instrumentation-pyroscope) GitHub repository.
13+
14+
{{< /admonition >}}
15+
16+
The `http-instrumentation-pyroscope` module allows you to _instrument_ HTTP requests in a way that lets you tag Grafana Cloud Profiles with relevant information generated from k6 tests.
1217

1318
## About baggage header
1419

15-
The _baggage header_ is a standardized HTTP header used to propagate distributed context. The [W3C specification](https://www.w3.org/TR/baggage/) goes into more detail on the specifics, but like many other headers, the baggage header is a list of key-value pairs.
20+
The _baggage header_ is a standardized HTTP header used to propagate distributed context. The [W3C specification](https://www.w3.org/TR/baggage/) goes into more detail on the specifics, but like many other headers, the baggage header is a list of key-value pairs.
1621

1722
This module, by default, adds three key-value pairs:
1823

19-
1. Scenario name
20-
2. Name of the request (URL if not set)
21-
3. Value of `__ENV.K6_CLOUDRUN_TEST_RUN_ID`, which is set automatically in Grafana Cloud k6.
22-
24+
1. Scenario name
25+
2. Name of the request (URL if not set)
26+
3. Value of `__ENV.K6_CLOUDRUN_TEST_RUN_ID`, which is set automatically in Grafana Cloud k6.
2327

2428
## API
2529

26-
| Class/Function | Description |
27-
| :--------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------ |
28-
| [instrumentHTTP](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/http-instrumentation-pyroscope/instrumenthttp) | Instruments the k6 http module with baggage header. |
30+
| Class/Function | Description |
31+
| :---------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------- |
32+
| [instrumentHTTP](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/http-instrumentation-pyroscope/instrumenthttp) | Instruments the k6 http module with baggage header. |
2933
| [Client](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/http-instrumentation-pyroscope/client) | Configurable Client that exposes instrumented HTTP operations. |
3034

3135
## Example

docs/sources/next/javascript-api/jslib/http-instrumentation-tempo/_index.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@ weight: 04
77

88
# HTTP instrumentation for Tempo
99

10-
With this jslib, you can _instrument_ HTTP requests so that they emit traces as the test runs. Use it to include a tracing context in HTTP requests, which can then be used by a tracing backend such as [Grafana Tempo](https://grafana.com/docs/grafana-cloud/testing/k6/analyze-results/integration-with-grafana-cloud-traces/).
10+
{{< admonition type="note" >}}
11+
12+
The source code for this library can be found in the [grafana/jslib.k6.io](https://github.com/grafana/jslib.k6.io/tree/main/lib/http-instrumentation-tempo/1.0.0) GitHub repository.
13+
14+
{{< /admonition >}}
15+
16+
The `http-instrumentation-tempo` module allows you to _instrument_ HTTP requests so that they emit traces as the test runs. Use it to include a tracing context in HTTP requests, which can then be used by a tracing backend such as [Grafana Tempo](https://grafana.com/docs/grafana-cloud/testing/k6/analyze-results/integration-with-grafana-cloud-traces/).
1117

1218
## Migration from `k6/experimental/tracing`
1319

1420
This jslib is a drop in replacement, so all you need to migrate to it is to replace `'k6/experimental/tracing'` import with `'https://jslib.k6.io/http-instrumentation-tempo/1.0.0/index.js'`
1521

16-
1722
## About trace contexts
1823

1924
A _trace context_ is a set of standardized HTTP headers added to a request that lets a tracing system correlate it with other requests as they navigate through a system. The trace context specifications, such as the supported [W3C Trace Context](https://www.w3.org/TR/trace-context/) and [Jaeger Trace Context](https://www.jaegertracing.io/docs/1.21/client-libraries/#propagation-format), define specific header names and an encoding format for the header values.

docs/sources/next/javascript-api/jslib/httpx/_index.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
11
---
2-
title: "httpx"
3-
description: "httpx is a wrapper library around the native k6 http module"
4-
weight: 02
2+
title: 'httpx'
3+
description: 'httpx is a wrapper library around the native k6 http module'
54
weight: 02
65
---
76

87
# httpx
98

10-
The `httpx` module is an external JavaScript library that wraps around the native [k6/http](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http) module.
11-
It's a http client with features that are not yet available in the native module.
9+
{{< admonition type="note" >}}
1210

13-
- ability to set http options globally (such as timeout)
14-
- ability to set default tags and headers that will be used for all requests
15-
- more user-friendly arguments to request functions (get, post, put take the same arguments)
11+
The source code for this library can be found in the [grafana/k6-jslib-httpx](https://github.com/k6io/k6-jslib-httpx) GitHub repository.
1612

17-
httpx module integrates well with the expect library.
13+
{{< /admonition >}}
1814

19-
The source code is [on GitHub](https://github.com/k6io/k6-jslib-httpx).
20-
Please request features and report bugs through [GitHub issues](https://github.com/k6io/k6-jslib-httpx/issues).
15+
The `httpx` module is an external JavaScript library that wraps around the native [k6/http](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http) module.
16+
It's an HTTP client with features that are not yet available in the native module.
2117

22-
{{< admonition type="caution" >}}
18+
- Ability to set HTTP options globally (such as timeout).
19+
- Ability to set default tags and headers that will be used for all requests.
20+
- More user-friendly arguments to request functions (get, post, put take the same arguments).
2321

24-
**This library is in active development.**
22+
The `httpx` module integrates well with the expect library.
2523

26-
This library is stable enough to be useful, but pay attention to the new versions released on [jslib.k6.io](https://jslib.k6.io).
24+
{{< admonition type="caution" >}}
2725

28-
This documentation is for the only last version only. If you discover that some of the following doesn't work, you might be using an older version.
26+
This library is in active development. It's stable enough to be useful, but you can watch the [GitHub repository](https://github.com/k6io/k6-jslib-httpx) to be notified when a new version is released.
2927

3028
{{< /admonition >}}
3129

docs/sources/next/javascript-api/jslib/k6chaijs/_index.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
11
---
2-
title: "k6chaijs"
3-
description: "Assertion library for k6"
4-
weight: 03
2+
title: 'k6chaijs'
3+
description: 'Assertion library for k6'
54
weight: 03
65
---
76

87
# k6chaijs
98

9+
{{< admonition type="note" >}}
10+
11+
The source code for this library can be found in the [grafana/k6-jslib-k6chaijs](https://github.com/grafana/k6-jslib-k6chaijs) GitHub repository.
12+
13+
{{< /admonition >}}
14+
1015
`k6chaijs` is a library to provide BDD assertions in k6 based on [ChaiJS](https://www.chaijs.com/). You can use `k6chaijs` as an alternative to [check](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6/check) and [group](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6/group).
1116

1217
With this library, you get the following:
1318

1419
- BDD style of assertions for more expressive language
15-
- chainable assertions
16-
- more powerful assertions functions such as: `deep`, `nested`, `ordered`, etc.
17-
- automatic assertion messages
18-
- [exception handling](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6chaijs/error-handling) for better test stability
20+
- Chainable assertions
21+
- More powerful assertions functions such as: `deep`, `nested`, `ordered`, etc.
22+
- Automatic assertion messages
23+
- [Exception handling](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6chaijs/error-handling) for better test stability
1924

2025
## Installation
2126

22-
There's nothing to install. This library is hosted on [jslib](https://jslib.k6.io/) and can be imported in the k6 script directly.
23-
24-
{{< code >}}
27+
This library is hosted on [jslib](https://jslib.k6.io/) and can be imported in directly in your k6 script.
2528

2629
```javascript
2730
import { describe, expect } from 'https://jslib.k6.io/k6chaijs/4.3.4.3/index.js';
2831
```
2932

30-
{{< /code >}}
31-
3233
Alternatively, you can use a copy of this file stored locally. The source code is available on [GitHub](https://github.com/grafana/k6-jslib-k6chaijs).
3334

3435
## Example

docs/sources/next/javascript-api/jslib/utils/_index.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ weight: 04
66

77
# utils
88

9-
The `utils` module contains number of small utility functions useful in every day load testing.
9+
{{< admonition type="note" >}}
10+
11+
The source code for this library can be found in the [grafana/k6-jslib-utils](https://github.com/k6io/k6-jslib-utils) GitHub repository.
1012

11-
> ⭐️ Source code available on [GitHub](https://github.com/k6io/k6-jslib-utils).
12-
> Please request features and report bugs through [GitHub issues](https://github.com/k6io/k6-jslib-utils/issues).
13+
{{< /admonition >}}
14+
15+
The `utils` module contains number of small utility functions useful in every day load testing.
1316

1417
| Function | Description |
1518
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

docs/sources/v0.54.x/javascript-api/jslib/aws/_index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,12 @@ title: aws
77

88
<!-- TODO: Add content -->
99

10+
{{< admonition type="note" >}}
11+
12+
The source code for this library can be found in the [grafana/k6-jslib-aws](https://github.com/grafana/k6-jslib-aws) GitHub repository.
13+
14+
{{< /admonition >}}
15+
16+
The `aws` module is an external JavaScript library that helps interact with a subset of AWS services in the context of k6 test scripts.
17+
1018
{{< section >}}

docs/sources/v0.54.x/javascript-api/jslib/http-instrumentation-pyroscope/_index.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,23 @@ weight: 04
77

88
# HTTP instrumentation for Pyroscope
99

10-
With jslib, you can _instrument_ HTTP requests in a way that lets you tag Grafana Cloud Profiles with relevant information generated from k6 tests.
10+
{{< admonition type="note" >}}
11+
12+
The source code for this library can be found in the [grafana/jslib.k6.io](https://github.com/grafana/jslib.k6.io/tree/main/lib/http-instrumentation-pyroscope) GitHub repository.
13+
14+
{{< /admonition >}}
15+
16+
The `http-instrumentation-pyroscope` module allows you to _instrument_ HTTP requests in a way that lets you tag Grafana Cloud Profiles with relevant information generated from k6 tests.
1117

1218
## About baggage header
1319

1420
The _baggage header_ is a standardized HTTP header used to propagate distributed context. The [W3C specification](https://www.w3.org/TR/baggage/) goes into more detail on the specifics, but like many other headers, the baggage header is a list of key-value pairs.
1521

1622
This module, by default, adds three key-value pairs:
1723

18-
1. Scenario name
19-
2. Name of the request (URL if not set)
20-
3. Value of `__ENV.K6_CLOUDRUN_TEST_RUN_ID`, which is set automatically in Grafana Cloud k6.
24+
1. Scenario name
25+
2. Name of the request (URL if not set)
26+
3. Value of `__ENV.K6_CLOUDRUN_TEST_RUN_ID`, which is set automatically in Grafana Cloud k6.
2127

2228
## API
2329

docs/sources/v0.54.x/javascript-api/jslib/http-instrumentation-tempo/_index.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ weight: 04
77

88
# HTTP instrumentation for Tempo
99

10-
With this jslib, you can _instrument_ HTTP requests so that they emit traces as the test runs. Use it to include a tracing context in HTTP requests, which can then be used by a tracing backend such as [Grafana Tempo](https://grafana.com/docs/grafana-cloud/testing/k6/analyze-results/integration-with-grafana-cloud-traces/).
10+
{{< admonition type="note" >}}
11+
12+
The source code for this library can be found in the [grafana/jslib.k6.io](https://github.com/grafana/jslib.k6.io/tree/main/lib/http-instrumentation-tempo/1.0.0) GitHub repository.
13+
14+
{{< /admonition >}}
15+
16+
The `http-instrumentation-tempo` module allows you to _instrument_ HTTP requests so that they emit traces as the test runs. Use it to include a tracing context in HTTP requests, which can then be used by a tracing backend such as [Grafana Tempo](https://grafana.com/docs/grafana-cloud/testing/k6/analyze-results/integration-with-grafana-cloud-traces/).
1117

1218
## Migration from `k6/experimental/tracing`
1319

docs/sources/v0.54.x/javascript-api/jslib/httpx/_index.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
11
---
2-
title: "httpx"
3-
description: "httpx is a wrapper library around the native k6 http module"
4-
weight: 02
2+
title: 'httpx'
3+
description: 'httpx is a wrapper library around the native k6 http module'
54
weight: 02
65
---
76

87
# httpx
98

10-
The `httpx` module is an external JavaScript library that wraps around the native [k6/http](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http) module.
11-
It's a http client with features that are not yet available in the native module.
9+
{{< admonition type="note" >}}
1210

13-
- ability to set http options globally (such as timeout)
14-
- ability to set default tags and headers that will be used for all requests
15-
- more user-friendly arguments to request functions (get, post, put take the same arguments)
11+
The source code for this library can be found in the [grafana/k6-jslib-httpx](https://github.com/k6io/k6-jslib-httpx) GitHub repository.
1612

17-
httpx module integrates well with the expect library.
13+
{{< /admonition >}}
1814

19-
The source code is [on GitHub](https://github.com/k6io/k6-jslib-httpx).
20-
Please request features and report bugs through [GitHub issues](https://github.com/k6io/k6-jslib-httpx/issues).
15+
The `httpx` module is an external JavaScript library that wraps around the native [k6/http](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http) module.
16+
It's an HTTP client with features that are not yet available in the native module.
2117

22-
{{< admonition type="caution" >}}
18+
- Ability to set HTTP options globally (such as timeout).
19+
- Ability to set default tags and headers that will be used for all requests.
20+
- More user-friendly arguments to request functions (get, post, put take the same arguments).
2321

24-
**This library is in active development.**
22+
The `httpx` module integrates well with the expect library.
2523

26-
This library is stable enough to be useful, but pay attention to the new versions released on [jslib.k6.io](https://jslib.k6.io).
24+
{{< admonition type="caution" >}}
2725

28-
This documentation is for the only last version only. If you discover that some of the following doesn't work, you might be using an older version.
26+
This library is in active development. It's stable enough to be useful, but you can watch the [GitHub repository](https://github.com/k6io/k6-jslib-httpx) to be notified when a new version is released.
2927

3028
{{< /admonition >}}
3129

0 commit comments

Comments
 (0)