---
title: "Grafana Cloud Prometheus | Grafana k6 documentation"
description: "How to upload the test result metrics to Grafana Cloud using Grafana Cloud Prometheus and the k6 output for Prometheus remote write'"
---

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

# Grafana Cloud Prometheus

> Caution
> 
> This page includes instructions for running a local test that sends the test results to a Prometheus instance in Grafana Cloud.
> 
> For running and managing cloud tests in Grafana Cloud, check out [Grafana Cloud k6](/docs/grafana-cloud/testing/k6/).

You can send your k6 results to a Prometheus instance running in [Grafana Cloud](/products/cloud) for visualization and analysis. By bringing k6 metrics into Grafana, you can correlate them with other observability metrics.

While this topic uses Grafana Cloud as an example, this approach is compatible with any remote write capable Prometheus installation.

## Set up Grafana Cloud Prometheus

Before you start, you need the following:

- A Grafana Cloud account ([sign up](/products/cloud/)). The free plan includes 10,000 Prometheus series.
- The URL, username, and password of your Grafana Cloud Prometheus instance to configure the integration.

After you’ve set up your account, follow these steps:

1. Log in to `Grafana.com` and visit the [Cloud Portal](/docs/grafana-cloud/fundamentals/cloud-portal/). Select the **Details** of your Prometheus service.
2. Copy the URL of the Remote Write Endpoint, along with the Username and Instance ID.
3. In the **Password / API Token** section, create and copy a [Grafana Cloud Access Policy Token](/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/) with the `metrics:write` scope (permission). The token will be used as a password.

## Run the test

Now, pass the Username, Access Policy Token, and Remote Write Endpoint of the Grafana Cloud Prometheus Configuration to the k6 binary:

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

```bash
K6_PROMETHEUS_RW_USERNAME=USERNAME \
K6_PROMETHEUS_RW_PASSWORD=ACCESS_POLICY_API_TOKEN \
K6_PROMETHEUS_RW_SERVER_URL=REMOTE_WRITE_ENDPOINT \
k6 run -o experimental-prometheus-rw script.js
```

## Visualize test results

To visualize test results with Grafana, you can import the [k6 Prometheus dashboard by Grafana k6](/grafana/dashboards/19665-k6-prometheus/).

On the Dashboards UI:

- Click `New` and select `Import`.
- Paste the Grafana URL or ID of the dashboard, and click `Load`.
- Select the Prometheus data source, and click `Import`.

Optionally, when running the test, you can set the `testid` tag as a [wide test tag](/docs/k6/latest/using-k6/tags-and-groups/#test-wide-tags) to filter results of a particular test run on this dashboard (or in PromQL queries). `testid` can be any unique string that allows you to identify the test run.

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

```bash
K6_PROMETHEUS_RW_USERNAME=USERNAME \
K6_PROMETHEUS_RW_PASSWORD=ACCESS_POLICY_API_TOKEN \
K6_PROMETHEUS_RW_SERVER_URL=REMOTE_WRITE_ENDPOINT \
k6 run -o experimental-prometheus-rw --tag testid=TEST_ID script.js
```

Additionally, you can also use the [Explore UI](/docs/grafana/latest/explore/) to query k6 time series, design your visualization panels, and add them to any of your existing dashboards.

All the k6 time series have a **k6\_** prefix. For more details, refer to the documentation on the [mapping of k6 metrics with Prometheus metrics](/docs/k6/latest/results-output/real-time/prometheus-remote-write/#metrics-mapping).

It’s also important to understand the default [Trend metric conversion](/docs/k6/latest/results-output/real-time/prometheus-remote-write/#trend-metric-conversions) process and the format and querying limitations. The [`K6_PROMETHEUS_RW_TREND_STATS` option](/docs/k6/latest/results-output/real-time/prometheus-remote-write/#options) allows you to convert trend metrics to multiple Prometheus time series. For instance, `K6_PROMETHEUS_RW_TREND_STATS=p(95),p(99),max,min` transforms each k6 trend metric into four Prometheus metrics as follows:

- `k6_*_p95`
- `k6_*_p99`
- `k6_*_max`
- `k6_*_min`
