Skip to content

Commit

Permalink
Merge branch 'main' into pepe/shared-javascript-api
Browse files Browse the repository at this point in the history
  • Loading branch information
heitortsergent committed Jul 22, 2024
2 parents fcf07a9 + ff51652 commit 1bfb0f3
Show file tree
Hide file tree
Showing 775 changed files with 36,601 additions and 576 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.cache/
public/
node_modules/
docs/sources/*/release-notes
docs/sources/get-started/run-cloud-tests-from-the-CLI.md
docs/sources/get-started/run-your-first-tests.md
docs/sources/*/using-k6/metrics/create-custom-metrics.md
Expand Down
4 changes: 4 additions & 0 deletions docs/sources/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,9 @@ module.exports = {
__ITER: 'readonly',
open: 'readonly',
window: 'readonly',
setInterval: 'readonly',
clearInterval: 'readonly',
setTimeout: 'readonly',
clearTimeout: 'readonly',
},
};
2 changes: 1 addition & 1 deletion docs/sources/next/get-started/_index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
weight: 01
weight: 150
title: Get started
---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ This example demonstrates how to use the this library to instrument every HTTP r

```javascript
import { check } from 'k6';
import pyroscope from 'https://jslib.k6.io/http-instrumentation-pyroscope/1.0.0/index.js';
import pyroscope from 'https://jslib.k6.io/http-instrumentation-pyroscope/1.0.1/index.js';
import http from 'k6/http';

// instrumentHTTP will ensure that all requests made by the http module
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This example demonstrates how to instantiate a client and use it to instrument H

```javascript
import { check } from 'k6';
import pyroscope from 'https://jslib.k6.io/http-instrumentation-pyroscope/1.0.0/index.js';
import pyroscope from 'https://jslib.k6.io/http-instrumentation-pyroscope/1.0.1/index.js';
import http from 'k6/http';

// Explicitly instantiating a Pyroscope client allows to distinguish
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This example demonstrates how to use the this library to instrument every HTTP r

```javascript
import { check } from 'k6';
import pyroscope from 'https://jslib.k6.io/http-instrumentation-pyroscope/1.0.0/index.js';
import pyroscope from 'https://jslib.k6.io/http-instrumentation-pyroscope/1.0.1/index.js';
import http from 'k6/http';

// instrumentHTTP will ensure that all requests made by the `http` module
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ weight: 04

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/).

## Migration from `k6/experimental/tracing`

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'`


## About trace contexts

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.
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/next/javascript-api/k6-browser/_index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 'k6/browser'
description: 'An overview of the browser-level APIs from browser module.'
weight: 01
weight: 02
---

# browser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ weight: 04
| [scrollIntoViewIfNeeded([options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/elementhandle/scrollintoviewifneeded) | Scrolls the element into view if needed. |
| [selectOption(values[, options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/elementhandle/selectoption) | Selects the `select` element's one or more options which match the values. |
| [selectText([options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/elementhandle/selecttext) | Selects the text of the element. |
| [setChecked(checked[, options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/elementhandle/setchecked) | Sets the `checkbox` or `radio` input element's value to the specified checked or unchecked state. |
| setChecked(checked[, options]) | Sets the `checkbox` or `radio` input element's value to the specified checked or unchecked state. |
| [setInputFiles(file[, options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/elementhandle/setinputfiles) | Sets the file input element's value to the specified files. |
| [tap(options)](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/elementhandle/tap) | Taps the element. |
| [textContent()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-browser/elementhandle/textcontent) | Returns the text content of the element. |
Expand All @@ -49,8 +49,6 @@ weight: 04

## Examples

{{< code >}}

```javascript
import { check } from 'k6';
import { browser } from 'k6/browser';
Expand Down Expand Up @@ -84,7 +82,7 @@ export default async function () {
const submitButton = await page.$('input[type="submit"]');

await Promise.all([page.waitForNavigation(), submitButton.click()]);
const text = await p.$('h2');
const text = await page.$('h2');
const content = await text.textContent();
check(page, {
header: () => text == 'Welcome, admin!',
Expand All @@ -95,9 +93,7 @@ export default async function () {
}
```

{{< /code >}}

{{< code >}}
<!-- eslint-skip -->

```javascript
import { browser } from 'k6/browser';
Expand Down Expand Up @@ -167,5 +163,3 @@ export default function () {
}
}
```

{{< /code >}}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ weight: 04

# tracing

{{< docs/shared source="k6" lookup="experimental-module.md" version="<K6_VERSION>" >}}
{{< docs/shared source="k6" lookup="experimental-tracing-module.md" version="<K6_VERSION>" >}}

With this experimental module, you can _instrument_ HTTP requests so that they emit traces as the test runs.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ weight: 02

# Client

{{< docs/shared source="k6" lookup="experimental-tracing-module.md" version="<K6_VERSION>" >}}

`Client` is an HTTP client constructor that attaches tracing information to its requests. Use it to include a tracing context in HTTP requests so that tracing backends (such as [Grafana Tempo](https://grafana.com/oss/tempo/)) can incorporate their results.

The `Client` class acts as a drop-in replacement for the standard `http` module and attaches a [trace context](https://www.w3.org/TR/trace-context/) to the requests headers, and add a `trace_id` to HTTP-related k6 output's data points metadata. It currently supports the [W3C Trace Context](https://www.w3.org/TR/trace-context/) and [Jaeger](https://www.jaegertracing.io/docs/1.21/client-libraries/#propagation-format) trace context propagation formats. For details about propagation, refer to [About trace contexts](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/tracing#about-trace-contexts).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ weight: 01

# instrumentHTTP

{{< docs/shared source="k6" lookup="experimental-tracing-module.md" version="<K6_VERSION>" >}}

The `instrumentHTTP` function instruments the k6 http module with tracing capabilities. It transparently replaces each of the k6 http module functions with versions that automatically attach a trace context to every request. Instrumented functions include [del](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/del),[get](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/get),[head](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/head),[options](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/options),[patch](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/patch),[post](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/post),[put](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/head), and [request](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/request).

The `instrumentHTTP` automatically adds tracing information to HTTP requests performed using the `k6/http` module functions (mentioned above).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ weight: 03

# Options

{{< docs/shared source="k6" lookup="experimental-tracing-module.md" version="<K6_VERSION>" >}}

Use the `Options` object to configure the tracing instrumentation behavior. It is used during the instantiation of a [`Client`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/tracing/client) instance and also as a parameter to the [`instrumentHTTP`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/tracing/instrumenthttp) function. It controls the general behavior of the tracing instrumentation and is unspecific to any particular tracing client instance.

## Options
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 'AesCbcParams'
description: 'AesCbcParams represents the object that should be passed as the algorithm parameter into the encrypt and decrypt operation when using the AES-CBC algorithm.'
weight: 07
weight: 04
---

# AesCbcParams
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 'AesCtrParams'
description: 'AesCtrParams represents the object that should be passed as the algorithm parameter into the encrypt and decrypt operation when using the AES-CTR algorithm.'
weight: 06
weight: 05
---

# AesCtrParams
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 'AesGcmParams'
description: 'AesGcmParams represents the object that should be passed as the algorithm parameter into the encrypt and decrypt operation when using the AES-GCM algorithm.'
weight: 08
weight: 06
---

# AesGcmParams
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 'AesKeyGenParams'
description: 'AesKeyGenParams represents the object that should be passed as the algorithm parameter into the generateKey operation, when generating an AES key.'
weight: 04
weight: 07
---

# AesKeyGenParams
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
title: 'Crypto'
description: 'Crypto offers basic cryptography features.'
weight: 01
weight: 01
---

# Crypto
Expand All @@ -11,15 +10,13 @@ weight: 01

## Properties

| Name | Type | Description |
| :-------------- | :------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------- |
| `Crypto.subtle` | [SubtleCrypto](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/webcrypto/subtlecrypto) | The SubtleCrypto interface provides access to common cryptographic primitives, such as hashing, signing, encryption, or decryption. |
| Name | Description |
| :------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [subtle](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/webcrypto/subtlecrypto) | The [SubtleCrypto](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/webcrypto/subtlecrypto) interface provides access to common cryptographic primitives, such as hashing, signing, encryption, or decryption. |

## Methods

| Name | Type | Description |
| :--------------------------------------------------------------------------------------------- | :---------------------------------------------------------- | :---------- |
| `Crypto.getRandomValues()` | [ArrayBuffer] |
| (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) | Returns an array of cryptographically secure random values. |
| `Crypto.randomUUID()` | [ArrayBuffer] |
| (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) | Returns a randomly generated, 36 character long v4 UUID. |
| Name | Description |
| :----------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------- |
| [getRandomValues()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/webcrypto/crypto/getrandomvalues/) | Returns an array of cryptographically secure random values. |
| [randomUUID()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/webcrypto/crypto/randomuuid/) | Returns a randomly generated, 36 character long v4 UUID. |
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 'CryptoKey'
description: 'CryptoKey represents a cryptographic key used for encryption, decryption, signing, or verification.'
weight: 03
weight: 02
---

# CryptoKey
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 'CryptoKeyPair'
description: 'CryptoKeyPair represents an asymmetric key pair with public and private keys.'
weight: 03
weight: 08
---

# CryptoKeyPair
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 'EcdhKeyDeriveParams'
description: 'EcdhKeyDeriveParams is a parameter used for derive bits operation.'
weight: 03
weight: 10
---

# EcdhKeyDeriveParams
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 'EcdsaParams'
description: 'EcdsaParams is a parameter used for sign or verify operations.'
weight: 03
weight: 11
---

# EcdsaParams
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 'EcKeyGenParams'
description: 'EcKeyGenParams represents the object that should be passed as the algorithm parameter into the generateKey operation, when generating ECDH or ECDSA key pairs.'
weight: 04
weight: 09
---

# EcKeyGenParams
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 'HmacKeyGenParams'
description: 'HmacKeyGenParams represents the object that should be passed as the algorithm parameter into the generateKey operation, when generating an HMAC key.'
weight: 05
weight: 12
---

# HmacKeyGenParams
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 'JsonWebKey'
description: 'JsonWebKey represents object/dictionary generated by exporting a CryptoKey or used as an input parameter for key import.'
weight: 05
weight: 13
---

# JsonWebKey
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
title: 'SubtleCrypto'
description: 'SubtleCrypto offers low-level cryptographic functions.'
weight: 02
weight: 02
weight: 03
---

# SubtleCrypto
Expand Down
Loading

0 comments on commit 1bfb0f3

Please sign in to comment.