Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grafana docs: fix links #1406

Merged
merged 10 commits into from
Nov 13, 2023
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions docs/sources/next/examples/cookies-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ export default function () {

**Relevant k6 APIs**:

- [http.cookieJar()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/cookiejar)
- [http.cookieJar()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/cookiejar-method)
- [http.CookieJar](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/cookiejar)

- [set(url, name, value, [options])](/javascript-api/k6-http/cookiejar/cookiejar-set)
- [set(url, name, value, [options])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/cookiejar/cookiejar-set)
- [delete(url, name)](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/cookiejar/cookiejar-delete)
- [clear(url)](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/cookiejar/cookiejar-clear)
4 changes: 2 additions & 2 deletions docs/sources/next/examples/correlation-and-dynamic-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ export default function () {
### Extracting values/tokens from form fields

You can choose from two different approaches when deciding how to handle form submissions.
Either you use the higher-level [Response.submitForm([params])](/javascript-api/k6-http/response/response-submitform) API
Either you use the higher-level [Response.submitForm([params])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/response/response-submitform) API
or you extract necessary hidden fields etc. and build a request yourself and then send it using the
appropriate `http.*` family of APIs, like [http.post(url, [body], [params])](/javascript-api/k6-http/post).
appropriate `http.*` family of APIs, like [http.post(url, [body], [params])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/post).

#### Extracting .NET ViewStates, CSRF tokens and other hidden input fields

Expand Down
2 changes: 1 addition & 1 deletion docs/sources/next/examples/data-parameterization.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This will, in turn, make your test more realistic.
## Performance implications of `SharedArray`

Each VU in k6 is a separate JS VM. To prevent multiple copies of the whole data file,
[SharedArray](/javascript-api/k6-data/sharedarray) was added. It does have some CPU overhead in accessing elements compared to a normal non shared
[SharedArray](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-data/sharedarray) was added. It does have some CPU overhead in accessing elements compared to a normal non shared
array, but the difference is negligible compared to the time it takes to make requests. This becomes
even less of an issue compared to not using it with large files, as k6 would otherwise use too much memory to run, which might lead to your script not being able to run at all or aborting in the middle if the system resources are exhausted.

Expand Down
6 changes: 3 additions & 3 deletions docs/sources/next/examples/data-uploads.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ In the example above we use the [http.file()](https://grafana.com/docs/k6/<K6_VE
API to wrap the file contents in a [FileData](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/filedata) object.
When passing a JS object as the body parameter to [http.post()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/post),
or any of the other HTTP request functions, where one of the property values is a
[FileData](/javascript-api/k6-http/filedata) a multipart request will be constructed
[FileData](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/filedata) a multipart request will be constructed
and sent.

### Relevant k6 APIs

- [open(filePath, [mode])](/javascript-api/init-context/open)
- [http.file(data, [filename], [contentType])](/javascript-api/k6-http/file)
- [open(filePath, [mode])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/init-context/open)
- [http.file(data, [filename], [contentType])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/file)

## Advanced multipart request

Expand Down
2 changes: 1 addition & 1 deletion docs/sources/next/examples/distribute-workloads.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Distribute workloads across VUs
excerpt: How to configure different amounts of traffic for different VU behaviors
slug: /examples/distribute-workloads
slug: /distribute-workloads
weight: 24
---

Expand Down
4 changes: 2 additions & 2 deletions docs/sources/next/examples/html-forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ weight: 07

Scripting example on how to handle HTML forms.

In many cases using the [Selection](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-html/selection) API (jQuery API clone) to interact with HTML data is enough, but for some use cases, like with forms, we can make things easier providing a higher-level API like the [Response.submitForm( [params] )](/javascript-api/k6-http/response/response-submitform) API.
In many cases using the [Selection](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-html/selection) API (jQuery API clone) to interact with HTML data is enough, but for some use cases, like with forms, we can make things easier providing a higher-level API like the [Response.submitForm( [params] )](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/response/response-submitform) API.

{{< code >}}

Expand All @@ -33,7 +33,7 @@ export default function () {

**Relevant k6 APIs**:

- [Response.submitForm([params])](/javascript-api/k6-http/response/response-submitform)
- [Response.submitForm([params])](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-http/response/response-submitform)
- [Selection.find(selector)](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-html/selection/selection-find)
(the [jQuery Selector API](http://api.jquery.com/category/selectors/) docs are also a good
resource on what possible selector queries can be made)
2 changes: 1 addition & 1 deletion docs/sources/next/javascript-api/init-context/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ For details about the runtime, refer to the [Test lifecycle](https://grafana.com

| Function | Description |
| ------------------------------------------------------------- | ---------------------------------------------------- |
| [open( filePath, [mode] )](/javascript-api/init-context/open) | Opens a file and reads all the contents into memory. |
| [open( filePath, [mode] )](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/init-context/open) | Opens a file and reads all the contents into memory. |
17 changes: 10 additions & 7 deletions docs/sources/next/javascript-api/init-context/open.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,23 @@ excerpt: 'Opens a file and reads all the contents into memory.'

Opens a file, reading all its contents into memory for use in the script.

> #### Use [SharedArray](/javascript-api/k6-data/sharedarray/) for CSV and JSON files
>
> `open()` often consumes a large amount of memory because every VU keeps a separate copy of the file in memory.
> To reduce the memory consumption, we strongly advise the usage of [SharedArray](/javascript-api/k6-data/sharedarray/) for CSV, JSON and other files intended for script parametrization.
{{% admonition type="note" %}}

<blockquote mod='attention' title='Function available only in init context'>
`open()` often consumes a large amount of memory because every VU keeps a separate copy of the file in memory.

To reduce the memory consumption, we strongly advise the usage of [SharedArray](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-data/sharedarray) for CSV, JSON and other files intended for script parametrization.

{{% /admonition %}}

{{% admonition type="caution" %}}

This function can only be called from the init context (aka _init code_), code in the global context that is, outside of the main export default function { ... }.

By restricting it to the init context, we can easily determine what local files are needed to run the test and thus what we need to bundle up when distributing the test to multiple nodes in a clustered/distributed test.

See the example further down on this page. For a more in-depth description, see [Test lifecycle](/using-k6/test-lifecycle).
See the example further down on this page. For a more in-depth description, see [Test lifecycle](https://grafana.com/docs/k6/<K6_VERSION>/using-k6/test-lifecycle).

</blockquote>
{{% /admonition %}}

| Parameter | Type | Description |
| --------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ excerpt: 'KMSClient.generateDataKey generates a symmetric data key for use outsi

| Type | Description |
| :-------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------- |
| Promise<[KMSDataKey](/javascript-api/jslib/aws/kmsclient/kmsdatakey)> | A Promise that fulfills with a [KMSDataKey](/javascript-api/jslib/aws/kmsclient/kmskey) object. |
| Promise<[KMSDataKey](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/kmsclient/kmsdatakey)> | A Promise that fulfills with a [KMSDataKey](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/kmsclient/kmskey) object. |

### Example

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ excerpt: "KMSClient.listKeys lists all the KMS keys in the caller's AWS account

| Type | Description |
| :-------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------- |
| Promise<[KMSKey[]](/javascript-api/jslib/aws/kmsclient/kmskey)> | A Promise that fulfills with an array of [`KMSKey`](/javascript-api/jslib/aws/kmsclient/kmskey) objects. |
| Promise<[KMSKey[]](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/kmsclient/kmskey)> | A Promise that fulfills with an array of [`KMSKey`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/kmsclient/kmskey) objects. |

### Example

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
title: 'KMSDataKey'
slug: 'kmsdatakey'
head_title: 'KMSDataKey'
description: 'KMSDataKey is returned by the KMSClient.*DataKey methods that query KMS data keys'
excerpt: 'KMSDataKey is returned by the KMSClient.*DataKey methods that query KMS data keys'
---

# KMSDataKey

`KMSClient.*DataKey` methods, querying Key Management Service data keys, return some KMSDataKey instances.
The KMSDataKey object describes an Amazon Key Management Service data key.
For instance, the [`generateDataKey`](/javascript-api/jslib/aws/kmsclient/kmsclient-generatedatakey/) returns the generated KMSDataKey object.
For instance, the [`generateDataKey`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/kmsclient/kmsclient-generatedatakey/) returns the generated KMSDataKey object.

| Name | Type | Description |
| :-------------------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------ |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: 'KMSKey'
slug: 'kmskey'
head_title: 'KMSKey'
description: 'KMSKey is returned by the KMSClient.* methods that query KMS keys'
excerpt: 'KMSKey is returned by the KMSClient.* methods that query KMS keys'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ title: 'S3Client.abortMultipartUpload(bucketName, objectKey, uploadId)'
head_title: 'S3Client.abortMultipartUpload(bucketName, objectKey, uploadId)'
slug: 's3client-abortmultipartupload'
description: 'S3Client.abortMultipartUpload aborts a multipart upload to a bucket'
excerpt: 'S3Client.abortMultipartUpload aborts a multipart upload to a bucket'
---

# S3Client.abortMultipartUpload(bucketName, objectKey, uploadId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ title: 'S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts)
head_title: 'S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts)'
slug: 's3client-completemultipartupload'
description: 'S3Client.completeMultipartUpload uploads a multipar object to a bucket'
excerpt: 'S3Client.completeMultipartUpload uploads a multipart object to a bucket'
---

# S3Client.completeMultipartUpload(bucketName, objectKey, uploadId, parts)
Expand All @@ -17,7 +16,7 @@ excerpt: 'S3Client.completeMultipartUpload uploads a multipart object to a bucke
| bucketName | string | Name of the bucket to delete the object to. |
| objectKey | string | Name of the uploaded object. |
| uploadId | number | UploadId of the multipart upload to complete. |
| parts | Array<[S3Part](/javascript-api/jslib/aws/s3client/s3part)> | The [S3Part](/javascript-api/jslib/aws/s3client/s3part)s to assemble. |
| parts | Array<[S3Part](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/s3client/s3part)> | The [S3Part](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/s3client/s3part)s to assemble. |

### Returns

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ title: 'S3Client.copyObject'
head_title: 'S3Client.copyObject'
slug: 's3client-copyobject'
description: 'S3Client.copyObject copies an object from a bucket to another'
excerpt: 'S3Client.copyObject copies an object from a bucket to another'
---

# S3Client.copyObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ title: 'S3Client.createMultipartUpload(bucketName, objectKey)'
head_title: 'S3Client.createMultipartUpload(bucketName, objectKey)'
slug: 's3client-createmultipartupload'
description: 'S3Client.createMultipartUpload creates a multipart upload for an object key to a bucket'
excerpt: 'S3Client.createMultipartUpload creates a multipart upload to a bucket'
---

# S3Client.createMultipartUpload(bucketName, objectKey)
Expand All @@ -19,7 +18,7 @@ excerpt: 'S3Client.createMultipartUpload creates a multipart upload to a bucket'

| Type | Description |
| :----------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------- |
| Promise<[S3MultipartUpload](/javascript-api/jslib/aws/s3client/s3multipartupload)> | A Promise that fulfills with a [S3MultipartUpload](/javascript-api/jslib/aws/s3client/s3multipartupload) representing a S3 Multipart Upload. |
| Promise<[S3MultipartUpload](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/s3client/s3multipartupload)> | A Promise that fulfills with a [S3MultipartUpload](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/s3client/s3multipartupload) representing a S3 Multipart Upload. |

### Example

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ title: 'S3Client.deleteObject(bucketName, objectKey)'
head_title: 'S3Client.deleteObject(bucketName, objectKey)'
slug: 's3client-deleteobject'
description: 'S3Client.deleteObject deletes an object from a bucket'
excerpt: 'S3Client.deleteObject deletes an object from a bucket'
---

# S3Client.deleteObject(bucketName, objectKey)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ title: 'S3Client.getObject(bucketName, objectKey)'
head_title: 'S3Client.getObject(bucketName, objectKey)'
slug: 's3client-getobject'
description: 'S3Client.getObject downloads an object from a bucket'
excerpt: 'S3Client.getObject downloads an object from a bucket'
---

# S3Client.getObject(bucketName, objectKey)
Expand All @@ -21,7 +20,7 @@ excerpt: 'S3Client.getObject downloads an object from a bucket'

| Type | Description |
| :----------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------- |
| Promise<[Object](/javascript-api/jslib/aws/s3client/object)> | A Promise that fulfills with an [Object](/javascript-api/jslib/aws/s3client/object) describing and holding the downloaded content. |
| Promise<[Object](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/s3client/object)> | A Promise that fulfills with an [Object](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/s3client/object) describing and holding the downloaded content. |

### Example

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ title: 'S3Client.listBuckets()'
head_title: 'S3Client.listBuckets()'
slug: 's3client-listbuckets'
description: 'S3Client.listBuckets lists the buckets the authenticated user has access to'
excerpt: 'S3Client.listBuckets lists the buckets the authenticated user has access to'
---

# S3Client.listBuckets()
Expand All @@ -14,7 +13,7 @@ excerpt: 'S3Client.listBuckets lists the buckets the authenticated user has acce

| Type | Description |
| :------------------------------------------------------------------ | :---------------------------------------------------------------------------------------------------- |
| Promise<Array<[Bucket](/javascript-api/jslib/aws/s3client/bucket)>> | A Promise that fulfills with an array of [Bucket](/javascript-api/jslib/aws/s3client/bucket) objects. |
| Promise<Array<[Bucket](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/s3client/bucket)>> | A Promise that fulfills with an array of [Bucket](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/s3client/bucket) objects. |

### Example

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: 'S3Client.listObjects(bucketName, [prefix])'
head_title: 'S3Client.listObjects(bucketName, [prefix])'
slug: 's3client-listobjects'
description: 'S3Client.listObjects lists the objects contained in a bucket'
excerpt: 'S3Client.listObjects lists the objects contained in a bucket'
---

# S3Client.listObjects(bucketName, [prefix])
Expand All @@ -20,7 +20,7 @@ excerpt: 'S3Client.listObjects lists the objects contained in a bucket'

| Type | Description |
| :------------------------------------------------------------------ | :---------------------------------------------------------------------------------------------------- |
| Promise<Array<[Object](/javascript-api/jslib/aws/s3client/object)>> | A Promise that fulfills with an array of [Object](/javascript-api/jslib/aws/s3client/object) objects. |
| Promise<Array<[Object](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/s3client/object)>> | A Promise that fulfills with an array of [Object](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/aws/s3client/object) objects. |

### Example

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ title: 'S3Client.putObject(bucketName, objectKey, data)'
head_title: 'S3Client.putObject(bucketName, objectKey, data)'
slug: 's3client-putobject'
description: 'S3Client.putObject uploads an object to a bucket'
excerpt: 'S3Client.putObject uploads an object to a bucket'
---

# S3Client.putObject(bucketName, objectKey, data)
Expand Down
Loading
Loading