-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
k6 browser: Display Metrics and new Options page (#1667)
* v0.52.x: New `Browser options` page * Display the browser metric table on the `Browser metrics` docs * Update `Browser options` * Port changes to `next` * Update the latest `K6_BROWSER_TIMEOUT` description * Apply suggestions from code review * Apply to v0.52.x * Update code sample for browser options --------- Co-authored-by: Heitor Tashiro Sergent <[email protected]>
- Loading branch information
1 parent
a6b91e0
commit c4de131
Showing
22 changed files
with
396 additions
and
274 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
title: browser/options | ||
--- | ||
|
||
| Environment Variable | Description | | ||
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ||
| K6_BROWSER_ARGS | Extra command line arguments to include when launching browser process. See [this link](https://peter.sh/experiments/chromium-command-line-switches/) for a list of Chromium arguments. Note that arguments should not start with `--` (see the command example below). | | ||
| K6_BROWSER_DEBUG | All CDP messages and internal fine grained logs will be logged if set to `true`. | | ||
| K6_BROWSER_EXECUTABLE_PATH | Override search for browser executable in favor of specified absolute path. | | ||
| K6_BROWSER_HEADLESS | Show browser GUI or not. `true` by default. | | ||
| K6_BROWSER_IGNORE_DEFAULT_ARGS | Ignore any of the [default arguments](https://grafana.com/docs/k6/<K6_VERSION>/using-k6-browser/options/#default-arguments) included when launching a browser process. | | ||
| K6_BROWSER_TIMEOUT | Default timeout for initializing the connection to the browser instance. `'30s'` if not set. | | ||
| K6_BROWSER_TRACES_METADATA | Sets additional _key-value_ metadata that is included as attributes in every span generated from browser module traces. Example: `K6_BROWSER_TRACES_METADATA=attr1=val1,attr2=val2`. This only applies if traces generation is enabled, refer to [Traces output](https://grafana.com/docs/k6/<K6_VERSION>/using-k6/k6-options/reference#traces-output) for more details. | | ||
|
||
The following command passes the browser options as environment variables to launch a headful browser with custom arguments. | ||
|
||
{{< code >}} | ||
|
||
```bash | ||
$ K6_BROWSER_HEADLESS=false K6_BROWSER_ARGS='show-property-changed-rects' k6 run script.js | ||
``` | ||
|
||
```docker | ||
# WARNING! | ||
# The grafana/k6:master-with-browser image launches a Chrome browser by setting the | ||
# 'no-sandbox' argument. Only use it with trustworthy websites. | ||
# | ||
# As an alternative, you can use a Docker SECCOMP profile instead, and overwrite the | ||
# Chrome arguments to not use 'no-sandbox' such as: | ||
# docker container run --rm -i -e K6_BROWSER_ARGS='' --security-opt seccomp=$(pwd)/chrome.json grafana/k6:master-with-browser run - <script.js | ||
# | ||
# You can find an example of a hardened SECCOMP profile in: | ||
# https://raw.githubusercontent.com/jfrazelle/dotfiles/master/etc/docker/seccomp/chrome.json. | ||
docker run --rm -i -e K6_BROWSER_HEADLESS=false -e K6_BROWSER_ARGS='show-property-changed-rects' grafana/k6:master-with-browser run - <script.js | ||
``` | ||
|
||
```windows | ||
C:\k6> set "K6_BROWSER_HEADLESS=false" && set "K6_BROWSER_ARGS='show-property-changed-rects' " && k6 run script.js | ||
``` | ||
|
||
```windows-powershell | ||
PS C:\k6> $env:K6_BROWSER_HEADLESS="false" ; $env:K6_BROWSER_ARGS='show-property-changed-rects' ; k6 run script.js | ||
``` | ||
|
||
{{< /code >}} |
13 changes: 13 additions & 0 deletions
13
docs/sources/next/shared/browser/web-vital-core-metrics.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
title: browser/webvital-core-metrics | ||
--- | ||
|
||
<!-- vale off --> | ||
|
||
| Metric name | Description | | ||
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| browser_web_vital_cls | Measures the visual stability on a webpage by quantifying the amount of unexpected layout shift of visible page content. Refer to [Cumulative Layout Shift](https://web.dev/cls/) for more information. | | ||
| browser_web_vital_fid | Measures the responsiveness of a web page by quantifying the delay between a user’s first interaction, such as clicking a button, and the browser’s response. Refer to [First Input Delay](https://web.dev/fid/) for more information. | | ||
| browser_web_vital_lcp | Measures the time it takes for the largest content element on a page to become visible. Refer to [Largest Contentful Paint](https://web.dev/lcp/) for more information. | | ||
|
||
<!-- vale on --> |
13 changes: 13 additions & 0 deletions
13
docs/sources/next/shared/browser/web-vital-other-metrics.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
title: browser/webvital-other-metrics | ||
--- | ||
|
||
<!-- vale off --> | ||
|
||
| Metric name | Description | | ||
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| browser_web_vital_fcp | Measures the time it takes for the browser to render the first DOM element on the page, whether that's a text, image or header. Refer to [First Contentful Paint](https://web.dev/fcp/) for more information. | | ||
| browser_web_vital_inp | An experimental metric that measures a page's responsiveness. Refer to [Interaction to Next Paint](https://web.dev/inp/) for more information. | | ||
| browser_web_vital_ttfb | Measures the time it takes between the browser request and the start of the response from a server. Refer to [Time to First Byte](https://web.dev/ttfb/) for more information. | | ||
|
||
<!-- vale on --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.