Skip to content
Back to skills

K6 Knowledge Patch

ASecurity

Grafana k6

  • 25 stars
  • 0 votes
  • 0 copies
  • 7 views
  • Added September 5, 2026
developmentjavascriptgojavabashexpresstestingapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 8 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill k6-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of K6 Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for K6 Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-k6-knowledge-patch-nevaberry-plugins/badge)](https://www.skillsdirectory.com/skills/nevaberry-k6-knowledge-patch-nevaberry-plugins)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: k6-knowledge-patch
description: Grafana k6
version: "2.4.0"
license: MIT
metadata:
  author: Nevaberry
---


# Grafana k6 Knowledge Patch

Load this skill when migrating k6 scripts, configuring local or Cloud runs,
writing browser tests, provisioning extensions, or updating metrics integrations.
Use the topic references for complete API details, examples, and version-specific behavior.

## Reference index

| Reference | Topics |
| --- | --- |
| [Migration and compatibility](references/migration-and-compatibility.md) | Removed commands, configuration paths, module imports, output migrations, support guarantees |
| [CLI, configuration, and execution](references/cli-config-and-execution.md) | Scenario selection, feature flags, summaries, execution status, HTTP API, config permissions |
| [Cloud and secrets](references/cloud-and-secrets.md) | Stacks, projects, resource listings, local execution, logs, credentials, secret sources |
| [Extensions and dependencies](references/extensions-and-dependencies.md) | Provisioning, manifests, archives, subcommands, Go extensions, DNS, builds, containers |
| [Browser testing](references/browser-testing.md) | Locators, frames, waits, events, routing, headers, sessions, screenshots, browser metrics, assertions |
| [Metrics, outputs, and runtime](references/metrics-outputs-and-runtime.md) | Thresholds, exporters, tracing, logs, HTTP/gRPC, TLS, WebSockets, JavaScript, crypto |

## Breaking changes and deprecations

### Execution and configuration migrations

For k6 v2, apply these command and configuration migrations:

| Previous usage | Guidance |
| --- | --- |
| `externally-controlled` | Removed; choose an executor matching the load profile, such as `ramping-vus` or `constant-arrival-rate`. |
| `k6 pause`, `k6 resume`, `k6 scale`, `k6 status` | Removed. |
| `k6 login cloud` | Use `k6 cloud login`. |
| `k6 login influxdb` | Configure the InfluxDB output through `K6_INFLUXDB_*` environment variables. |
| `k6 cloud script.js` | Use `k6 cloud run script.js`. |
| `--upload-only` | Use `k6 cloud upload script.js`. |
| `options.ext.loadimpact` | Move Cloud settings to `options.cloud`. |
| `{USER_CONFIG_DIR}/loadimpact/config.json` | Move to `{USER_CONFIG_DIR}/k6/config.json` before upgrading; automatic migration was removed. |

All `k6 cloud` commands require a configured stack, including `k6 cloud upload`.
For noninteractive `k6 cloud login`, pass `--token` and `--stack` together.
Passing run flags such as `--vus` directly to `k6 cloud` reports `unknown flag`
and exits with a nonzero status.

The HTTP API server is opt-in. Supply an address to start it:

```bash
k6 run --address=localhost:6565 script.js
```

`K6_ADDRESS=localhost:6565` also enables it.

### Module and Go-extension migrations

- Replace `k6/experimental/webcrypto` imports with the global `crypto` object.
- `k6/experimental/redis` is deprecated and will be removed in a future release;
  migrate to `k6/x/redis`.
- Change `k6/experimental/websockets` imports to stable `k6/websockets`, which has
  the same API. The experimental import path is scheduled for removal.
- For k6 v2 extensions, change `go.k6.io/k6` dependencies and imports to
  `go.k6.io/k6/v2`, such as `go.k6.io/k6/v2/js/modules`.
- The easyjson-generated `MarshalJSON` and `UnmarshalJSON` methods were removed
  from affected public Go types. Use `encoding/json` through `json.Marshal(value)`
  and `json.Unmarshal(data, &value)`.
- Sobek converts nil slices to `null` or `undefined`; return a non-nil empty slice
  for `[]`. `Runtime.ToValue()` dereferences one pointer level; dereference
  additional pointer levels before conversion.

### Metrics output and summary migrations

- The built-in `influxdb` and `experimental-prometheus-rw` outputs warn about
  deprecation and are scheduled for removal in k6 v3. Migrate with `--out opentelemetry`.
- `experimental-opentelemetry` still works as a deprecated alias of the stable output.
- Use `K6_OTEL_EXPORTER_PROTOCOL=grpc` or `K6_OTEL_EXPORTER_PROTOCOL=http/protobuf`
  in place of `K6_OTEL_EXPORTER_TYPE`; the `exporterType` configuration option was removed.
- Remove `K6_OTEL_SINGLE_COUNTER_FOR_RATE`. Rate exports always use one counter
  with a `condition` attribute of `zero` or `nonzero`; migrate queries using
  `<metric>.occurred` or `<metric>.total`.
- Replace `browser_web_vital_fid` with `browser_web_vital_inp` in thresholds and
  downstream integrations. The reference preserves the announced removal plan.
- Use `--summary-mode=disabled` or `K6_SUMMARY_MODE=disabled` instead of deprecated
  `--no-summary` or `K6_NO_SUMMARY`. Switch `--summary-mode=legacy` to `compact` or `full`;
  removal of `legacy` was planned for v2.0.

### Extension provisioning switches

For k6 v2, drop `K6_BINARY_PROVISIONING` and `K6_ENABLE_COMMUNITY_EXTENSIONS`;
automatic resolution includes community extensions by default.
Set `K6_AUTO_EXTENSION_RESOLUTION=false` to disable automatic resolution.
Earlier opt-in behavior is documented in the extension reference.

## Select scenarios and enable features

Use `--scenario` with comma-separated configured names on `k6 run`, `k6 cloud run`,
or `k6 archive`. Selected scenarios keep their settings and archives retain the selection.
Leave load shortcuts such as `--vus` and `--duration` unset. k6 warns and skips
thresholds scoped to excluded scenarios while keeping global thresholds and other filters.

```bash
k6 run --scenario homepage,contacts script.js
k6 run --once --scenario homepage,contacts script.js
```

`--once` runs a single iteration with one VU using `shared-iterations`, preserving
the scenario's function and browser settings. It accepts scripts with at most one
scenario by default; combine it with `--scenario` to run each selected scenario once.
It also works on `k6 cloud run` and `k6 archive`.

Enable flags with `--features` (comma-separated or repeated), `K6_FEATURES`, or
the `features` key in `config.json`. `k6 features` lists flags and lifecycle stages.
Enabled flags appear as metric tags and carry over to archives and Cloud workers.

| Experimental flag | Behavior |
| --- | --- |
| `native-histograms` | Switches Trend metrics to native histograms. |
| `merge-run-tags` | Merges run tags by key across config layers; the higher-priority layer wins conflicts. |
| `freeze-env` | Freezes `__ENV`; strict-mode writes throw a `TypeError`. |
| `async-metric-context` | Allows async `group()` callbacks, retaining group tags across `await`; `group_duration` lasts until the callback's promise settles. |
| `native-tracing` | With a traces output, emits `k6.run` → `scenario` → `vu` → `iteration` spans, with browser spans under the iteration. |

For async metric context, custom tags and metadata propagate through promises,
timers, WebSocket listeners, and gRPC stream listeners. Changes stay local to the
callback and its asynchronous descendants.

```bash
k6 run --features=native-tracing --traces-output=otel=http://localhost:4318 script.js
```

## Browser testing quick reference

- Use semantic `getBy*()` locators on pages, frames, locators, and `FrameLocator`
  instances; `getByRole()` supports role filters such as `name`, `checked`, and `level`.
- `locator.count()` returns immediately and includes hidden matches.
  `nth(index)`, `first()`, and `last()` narrow by position.
- Filter with `hasText` or `hasNotText`, each a string or regular expression.
  Chain `frameLocator(selector)` for nested iframes.
- `locator.boundingBox()` uses auto-waiting and returns `null` for invisible elements.
  `locator.isInViewport({ ratio, timeout })` waits for attachment, then measures
  intersection once; the default ratio of `0` matches any visible pixel.
- Start `page.waitForRequest()`, `page.waitForResponse()`, or `page.waitForEvent()`
  before the action that triggers the corresponding request, response, or event.
- `page.route(pattern, handler)` accepts a glob or regular expression. Handlers can
  abort, continue with request overrides, or fulfill with a mock response.
  `page.unroute()` takes the same pattern; `page.unrouteAll()` removes all page routes.
- `chromium.connectOverCDP()` accepts a runtime WebSocket endpoint, including a
  session URL obtained in `setup()`. k6 closes the connection at iteration end;
  `browser.close()` can release it earlier.
- The preview `k6-testing` library exports `expect()` for protocol values and
  browser locators. Await browser assertions.

In v2.4.0, `browser_data_received` uses DevTools' encoded transfer size when each
response finishes, including redirects. Recheck thresholds and baselines,
especially for compressed responses.

## Cloud runs and secrets

Select a default stack during `k6 cloud login`; override it with `K6_CLOUD_STACK_ID`
or `options.cloud.stackID`. An explicit project must belong to the selected stack.

| Resource | Command and machine-readable form |
| --- | --- |
| Projects | `k6 cloud project list`; `--format=json` |
| Load tests | `k6 cloud test list`; `--json` |
| Public and private load zones | `k6 cloud load-zone list`; `--json` |

For local execution, v2 Cloud runs can fetch Cloud-managed secrets through
`secrets.get()` by default; opt out with `--no-cloud-secrets`.
On v1.8.1, the Cloud secret source defaults to off for `k6 cloud run --local-execution`,
allowing explicitly configured secret sources.

`k6 cloud run --local-execution` streams logs to Cloud by default; opt out with
`--no-cloud-logs`. `K6_CLOUD_PUSH_REF_ID` reuses an existing Cloud run.
An orchestrator can pass scoped push credentials through `K6_CLOUD_METRICS_PUSH_URL`
and `K6_CLOUD_TEST_RUN_TOKEN`. See the Cloud reference for secret-lookup diagnostics.

## Extensions and summaries

Automatic provisioning discovers ES module imports and leading `"use k6 with …"`
directives. For CommonJS `require()`, declare the extension in a directive at the
start of the entry script or an imported module, after any shebang, whitespace, or comments.

```javascript
"use k6 with k6/x/redis"
const redis = require('k6/x/redis');
```

Use `k6 deps` to inspect script or archive dependencies; `--json` gives machine-readable output.
`K6_DEPENDENCIES_MANIFEST` supplies default version constraints for dependencies
already declared without an explicit version. `k6 x` lists built-in and registry
subcommands and caches the catalog for network-free tab completion.

The end-of-test summary groups metrics by scenario, group, and category.
`compact` is the default; `full` adds detail, orders groups as in the script,
and indents nested groups. Set `handleSummaryTimeout` or `K6_HANDLE_SUMMARY_TIMEOUT`
to change the time limit for `handleSummary()`.

## Transport, diagnostics, and runtime details

Set `tlsAIAFetch: true` to opt into fetching missing intermediate certificates
for HTTP and gRPC while still verifying the server's identity. With it enabled,
intermediates in PKCS#7/CMS bundles, including PEM-armored bundles, are supported.

Enable `--http-debug-redact` with `--http-debug`, or set `K6_HTTP_DEBUG_REDACT=true`
or `httpDebugRedact: true`. Redaction defaults to off. It masks the credential
headers listed in the runtime reference in HTTP headers and gRPC metadata,
preserving authentication schemes, cookie names, and cookie attributes.
Full debug logs can still expose secrets in query strings and bodies.

Read `response.error?.details` for structured gRPC error payloads from
`grpc-status-details-bin`. Standard types and custom types loaded through the
client are resolved; the error code and message remain available if detail conversion fails.

`GET /v1/status` exposes `data.attributes.execution_result`: `null` until the
exit code is known, then an object containing `exit_code`, readable while the
process remains alive under `--linger`.

Files in this skill

  • SKILL.md7.8 KB
  • coverage.json1.7 KB
  • references/browser-testing.md6.1 KB
  • references/cli-config-and-execution.md4.7 KB
  • references/cloud-and-secrets.md4.1 KB
  • references/extensions-and-dependencies.md5.2 KB
  • references/metrics-outputs-and-runtime.md4.5 KB
  • references/migration-and-compatibility.md4.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.