---
title: "Version 0.48.0 release notes | Grafana k6 documentation"
description: "The release notes for Grafana k6 version 0.48.0"
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Version 0.48.0 release notes

k6 v0.48.0 is here 🎉! This release includes:

- Numerous long-awaited breaking changes.
- A new `k6 new` subcommand to generate a new test script.
- A new `k6/experimental/fs` module for file interactions.
- CPU and network throttling support for the k6 browser module.

## Breaking changes

This release includes several breaking changes, mainly cleaning up deprecations from previous versions. They should have a straightforward migration process, and not heavily impact existing users.

- [#3448](https://github.com/grafana/k6/pull/3448) limits metric names, aligning to both OpenTelemetry (OTEL) and Prometheus name requirements, while still being limited to 128 ASCII characters. Warnings about the limit started in [v0.45](https://github.com/grafana/k6/releases/tag/v0.45.0).
- [#3439](https://github.com/grafana/k6/pull/3439) changes the `Client` signature in `k6/experimental/redis` module. Refer to the module-related section below.
- [#3350](https://github.com/grafana/k6/pull/3350) removes the `grpc.invoke()`’s parameter `headers`, deprecated in k6 [v0.37](https://github.com/grafana/k6/releases/tag/v0.37.0). Use the `metadata` parameter instead.
- [#3389](https://github.com/grafana/k6/pull/3389) removes the `--logformat` flag, deprecated in [v0.38](https://github.com/grafana/k6/releases/tag/v0.38.0). Use the `--log-format` flag instead.
- [#3390](https://github.com/grafana/k6/pull/3390) removes all CSV output’s CLI arguments, deprecated in [v0.35](https://github.com/grafana/k6/releases/tag/v0.35.0). This change makes the CSV output consistent with other output formats.
- [#3365](https://github.com/grafana/k6/pull/3365) removes the `k6 convert` CLI command, deprecated in [v0.41](https://github.com/grafana/k6/releases/tag/v0.41.0). Use the [har-to-k6](https://github.com/grafana/har-to-k6) package instead.
- [#3451](https://github.com/grafana/k6/pull/3451) removes logic that would attempt to prepend a `https://` scheme to module specifiers that were not recognized. Deprecated in k6 [v0.25](https://github.com/grafana/k6/releases/tag/v0.25.0). Use full URLs if you want to load remote modules instead.

## New features

### Add `k6 new` subcommand [#3394](https://github.com/grafana/k6/pull/3394)

`k6` now has a `new` subcommand that generates a new test script. This is useful for new users who want to get started quickly, or for experienced users who want to save time when creating new test scripts. To use the subcommand, open your terminal and type:

Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```bash
k6 new [filename]
```

If no filename is provided, k6 uses `script.js` as the default filename. The subcommand will create a new file with the provided name in the current directory, and populate it with a basic test script that can be run with `k6 run`.

### Add a `k6/experimental/fs` module [#3165](https://github.com/grafana/k6/pull/3165)

`k6` now has a new `k6/experimenal/fs` module providing a memory-efficient way to handle file interactions within your test scripts. It currently offers support for opening files, reading their content, seeking through it, and retrieving metadata about them.

Unlike the traditional [open](/docs/k6/latest/javascript-api/init-context/open/) function, which loads a file multiple times into memory, the filesystem module reduces memory usage by loading the file as little as possible, and sharing the same memory space between all VUs. This approach significantly reduces the memory footprint of your test script and lets you load and process large files without running out of memory.

For more information, refer to the [module documentation](/docs/k6/latest/javascript-api/k6-experimental/fs/).

Expand to see an example of the new functionality.

This example shows the new module usage:

JavaScript ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```javascript
import fs from 'k6/experimental/fs';

// k6 doesn't support async in the init context. We use a top-level async function for `await`.
//
// Each Virtual User gets its own `file` copy.
// So, operations like `seek` or `read` won't impact other VUs.
let file;
(async function () {
  file = await open('bonjour.txt');
})();

export default async function () {
  // About information about the file
  const fileinfo = await file.stat();
  if (fileinfo.name != 'bonjour.txt') {
    throw new Error('Unexpected file name');
  }

  const buffer = new Uint8Array(128);

  let totalBytesRead = 0;
  while (true) {
    // Read into the buffer
    const bytesRead = await file.read(buffer);
    if (bytesRead == null) {
      // EOF
      break;
    }

    // Do something useful with the content of the buffer
    totalBytesRead += bytesRead;

    // If bytesRead is less than the buffer size, we've read the whole file
    if (bytesRead < buffer.byteLength) {
      break;
    }
  }

  // Check that we read the expected number of bytes
  if (totalBytesRead != fileinfo.size) {
    throw new Error('Unexpected number of bytes read');
  }

  // Seek back to the beginning of the file
  await file.seek(0, SeekMode.Start);
}
```

### Redis (m)TLS support and new Client constructor options [#3439](https://github.com/grafana/k6/pull/3439), [xk6-redis/#17](https://github.com/grafana/xk6-redis/pull/17)

In this release, the `k6/experimental/redis` module receives several important updates, including breaking changes.

#### Connection URLs

The `Client` constructor now supports connection URLs to configure connections to Redis servers or clusters. These URLs can be in the format `redis://[[username][:password]@][host][:port][/db-number]` for standard connections, or `rediss://[[username][]:password@]][host][:port][/db-number]` for TLS-secured connections. For more details, refer to the [documentation](/docs/k6/latest/javascript-api/k6-experimental/redis/).

##### Example usage

JavaScript ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```javascript
import redis from 'k6/experimental/redis';

const redisClient = new redis.Client('redis://someusername:somepassword@localhost:6379/0');
```

#### Revamped Options object

The `Client` constructor has been updated with a new [Options](/docs/k6/latest/javascript-api/k6-experimental/redis/redis-options/) object format. This change aligns the module with familiar patterns from Node.js and Deno libraries, offering enhanced flexibility and control over Redis connections. For more details, refer to the [documentation](/docs/k6/latest/javascript-api/k6-experimental/redis/redis-options/).

Expand to see an example of the new functionality.

This example shows the usage of the new `Options` object:

JavaScript ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```javascript
import redis from 'k6/experimental/redis';

const redisClient = new redis.Client({
  socket: {
    host: 'localhost',
    port: 6379,
  },
  username: 'someusername',
  password: 'somepassword',
});
```

#### (m)TLS support

The Redis module now includes (m)TLS support, enhancing security for connections. This update also improves support for Redis clusters and sentinel modes (failover). For connections using self-signed certificates, enable k6’s [insecureSkipTLSVerify](/docs/k6/latest/using-k6/k6-options/reference/#insecure-skip-tls-verify) option (set to `true`).

Expand to see an example of the new functionality.

This example shows the configuration of a TLS connection:

JavaScript ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```javascript
import redis from 'k6/experimental/redis';

const redisClient = new redis.Client({
  socket: {
    host: 'localhost',
    port: 6379,
    tls: {
      ca: [open('ca.crt')],
      cert: open('client.crt'), // client certificate
      key: open('client.key'), // client private key
    },
  },
});
```

### Add tracing instrumentation [#3445](https://github.com/grafana/k6/pull/3445)

`k6` now supports a new *traces output* option that allows you to configure the output for traces generated during its execution. This option can be set through the `--traces-output` argument in the `k6 run` command or by setting the `K6_TRACES_OUTPUT` environment variable.

Currently, no traces are generated by `k6` itself, but this feature represents the first step towards richer tracing functionalities in `k6` and its extensions.

By default traces output is set to `none`, and currently the only supported output is `otel` which uses the [opentelemetry-go](https://github.com/open-telemetry/opentelemetry-go)’s [Open Telemetry](https://opentelemetry.io/) API and SDK implementations. The format for the `otel` *traces output* configuration is the following:

![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```none
--traces-output=<endpoint>[,opt1=val1,opt2=val2]
```

Where `opt`s can be one of the following options:

- `proto`: Specifies the protocol to use in the connection to the traces backend. Supports `grpc` *(default)* and `http`.
- `header.<header_name>`: Specifies an additional header to include in the connection to the traces backend.

Example:

![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```none
K6_TRACES_OUTPUT=https://traces.k6.io/v1/traces,proto=http,header.Authorization=Bearer token
```

### Add support for browser module’s `page.throttleCPU` [browser#1095](https://github.com/grafana/xk6-browser/pull/1095)

The browser module now supports throttling the CPU from chrome/chromium’s perspective by using the `throttleCPU` API, which helps emulate slower devices when testing the website’s frontend. It requires an argument of type `CPUProfile`, which includes a `rate` field that is a slow-down factor, where `1` means no throttling, `2` means 2x slowdown, and so on. For more details, refer to the [documentation](/docs/k6/v0.48.x/javascript-api/k6-experimental/browser/page/throttlecpu/).

js ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```js
...
  const context = browser.newContext();
  const page = context.newPage();

  try {
    page.throttleCPU({ rate: 4 });
...
```

### Add support for browser module’s `page.throttleNetwork` [browser#1094](https://github.com/grafana/xk6-browser/pull/1094)

The browser module now supports throttling the characteristics of the network from chrome/chromium’s perspective by using the `throttleNetwork` API, which helps emulate slow network connections when testing the website’s frontend. It requires an argument of type `NetworkProfile`, with a definition of:

ts ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```ts
export interface NetworkProfile {
  /*
   * Minimum latency from request sent to response headers received (ms).
   */
  latency: number;

  /*
   * Maximal aggregated download throughput (bytes/sec). -1 disables download
   * throttling.
   */
  download: number;

  /*
   * Maximal aggregated upload throughput (bytes/sec). -1 disables upload
   * throttling.
   */
  upload: number;
}
```

You can either define your own network profiles or use the ones we have defined by importing `networkProfiles` from the `browser` module. For more details, refer to the [documentation](/docs/k6/v0.48.x/javascript-api/k6-experimental/browser/page/throttlenetwork/).

js ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```js
import { browser, networkProfiles } from 'k6/experimental/browser';
...
  const context = browser.newContext();
  const page = context.newPage();

  try {
    page.throttleNetwork(networkProfiles['Slow 3G']);
...
```

## k6’s documentation is moving under [grafana.com/docs/k6](/docs/k6/)

It’s not directly part of the k6 v0.48 release, but we believe it is worth mentioning that we’re moving the documentation from [k6.io/docs](https://k6.io/docs/) to [grafana.com/docs/k6](/docs/k6/).

The legacy documentation space `k6.io/docs` will be available for a while, but we encourage you to update your bookmarks and links to the new domain.

* * *

For a full list of changes, including UX improvements and bug fixes, refer to [full release notes](https://github.com/grafana/k6/blob/master/release%20notes/v0.48.0.md).
