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

Document k6 cloud run --local-execution #1732

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions docs/sources/next/results-output/real-time/cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ When streaming the results to the cloud, the machine - where you execute the k6

## Streaming results vs. running on cloud servers

Don't confuse `k6 run --out cloud script.js` (what this page is about) with `k6 cloud run script.js`.
Don't confuse `k6 cloud run --local-execution script.js` (what this page is about) with `k6 cloud run script.js`.

Fundamentally the difference is the machine that the test runs on:

- `k6 run --out cloud` runs k6 locally and streams the results to the cloud.
- `k6 cloud run --local-execution` runs k6 locally and streams the results to the cloud.
- `k6 cloud run`, on the other hand, uploads your script to the cloud solution and runs the test on the cloud infrastructure. In this case you'll only see status updates in your CLI.

In all cases you'll be able to see your test results at [k6 Cloud](https://app.k6.io) or [Grafana Cloud](https://grafana.com/products/cloud/).

{{< admonition type="caution" >}}

Data storage and processing are primary cloud costs,
so `k6 run --out cloud` will consume VUH or test runs from your subscription.
so `k6 cloud run --local-execution` will consume VUH or test runs from your subscription.

{{< /admonition >}}

Expand All @@ -48,27 +48,27 @@ so `k6 run --out cloud` will consume VUH or test runs from your subscription.

1. Run the tests and upload the results

Now, k6 will authenticate you against the cloud service, and you can use the `--out` option to send the k6 results to the cloud as:
Now, k6 will authenticate you against the cloud service, and you can use the `--local-execution` option to send the k6 results to the cloud as:

{{< code >}}

```bash
$ k6 run --out cloud script.js
$ k6 cloud run --local-execution script.js
```

{{< /code >}}

Alternatively, you could skip the `k6 cloud login` command when passing your API token to the `k6 run` command as:
Alternatively, you could skip the `k6 cloud login` command when passing your API token to the `k6 cloud run` command as:

{{< code >}}

```bash
$ K6_CLOUD_TOKEN=<YOUR_API_TOKEN> k6 run --out cloud script.js
$ K6_CLOUD_TOKEN=<YOUR_API_TOKEN> k6 cloud run --local-execution script.js
```

{{< /code >}}

After running the command, the console shows an URL. Copy this URL and paste it in your browser's address bar to visualize the test results.
After running the command, the console shows a URL. Copy this URL and paste it in your browser's address bar to visualize the test results.

{{< code >}}

Expand All @@ -82,7 +82,7 @@ so `k6 run --out cloud` will consume VUH or test runs from your subscription.

![Grafana Cloud k6 Test Results](/media/docs/k6-oss/screenshot-stream-k6-results-to-grafana-cloud-k6.png)

When you send the results to the k6 Cloud with `k6 run --out`, data will be
When you send the results to the k6 Cloud with `k6 cloud run --local-execution`, data will be
continuously streamed to the cloud. While this happens the state of the test run
will be marked as `Running`. A test run that ran its course will be marked
`Finished`. The run state has nothing to do with the test passing any
Expand All @@ -102,6 +102,15 @@ data, setting the run state to `Timed out`. You can still analyze a timed out
test but you'll of course only have access to as much data as was streamed
before the network issue.

{{< admonition type="caution" >}}

The `k6 cloud run --local-execution script.js` command uploads the test archive k6 produces from your test script and resources to Grafana Cloud.

This behavior can be deactivated by adding the `--no-archive-upload` option to your
command: `k6 cloud run --local-execution --no-archive-upload script.js`.

{{< /admonition >}}

## Advanced settings

A few [environment variables](https://grafana.com/docs/k6/<K6_VERSION>/using-k6/environment-variables) can control how k6 streams results with `-o cloud`.
Expand Down
Loading