No results for

Powered byAlgolia

New Relic


This feature is being deprecated. If you're using Grafana Cloud k6, we recommend using Data source plugins for Grafana to visualize and correlate your APM and k6 metrics.

With this integration, you can export test result metrics from the k6 Cloud to the New Relic data platform.

⭐️  Cloud APM integrations are available on Pro and Enterprise plans, as well as the annual Team plan and Trial.

Set up Prometheus remote write integration in New Relic

With New Relic, you can set up a Prometheus remote write instance to collect data. k6 Cloud can export test-result metrics to this Prometheus instance to flow data into New Relic.

Necessary New Relic settings

To set up the New Relic integration for k6 Cloud, you need the following settings from New Relic:

  • License Key
  • Prometheus remote write URL

The integration needs a New Relic license key to authenticate and authorize k6 metrics for ingestion.

Once you have the license key, launch a Prometheus instance and set up the remote write integration in New Relic. To do this, follow the New Relic instructions.

Export k6 Cloud metrics to New Relic

You must enable the New Relic integration for each test whose results you want to export.

After you set up the New Relic settings in the test, you can run a cloud test as usual. As the test runs, the k6 Cloud continuously sends the test-result metrics to New Relic.

Currently, there are two options to set up the Cloud APM settings in the test:

Export to New Relic with the test builder

First, you have to configure the New Relic integration for an organization.

  1. From the Main navigation, go to Manage > Cloud APM and select New Relic.

    Cloud APM - New Relic Form UI

  2. In this form, enter the URL and license key that you copied previously from New Relic.

    For more information on the other input fields, see configuration parameters.

  3. Save the New Relic configuration for the current organization.

Note that configuring New Relic settings for an organization does not enable the integration. You must enable it manually for each test using the test builder.

  1. Create a new test with the test builder, or select a test that was already created with the Test Builder.

  2. On the test builder sidebar, select the Cloud APM to enable the integration for the test.

    Cloud APM - New Relic Test Builder UI

Export to New Relic in a k6 script

If you script your k6 tests, you can configure the Cloud APM settings using the apm option in the k6 script.

The parameters to export k6 metrics to New Relic are as follows:

export const options = {
ext: {
loadimpact: {
apm: [
provider: 'prometheus',
// optional when `remoteWriteURL` includes the `X-License-Key` query param
credentials: {
token: '<YOUR_LICENSE_KEY>',
// optional parameters
metrics: ['http_req_sending', 'my_rate', 'my_gauge'], // ...
includeDefaultMetrics: true,
includeTestRunId: false,

Configuration parameters

provider(required)For this integration, the value must be prometheus.
remoteWriteURL(required)URL of the Prometheus remote write endpoint.
The prometheus_server query param must be included. The license key can optionally be included using the X-License-Key query param.
credentialsThe credentials to authenticate with New Relic. It has a token parameter to set the license key.
The credentials parameter is optional when the license key is passed via the X-License-Key query param on the remoteWriteURL parameter.
includeDefaultMetricsWhether it exports the default APM metrics: data_sent, data_received, http_req_duration, http_reqs, iterations, and vus. Default is true.
metricsList of metrics to export.
A subsequent section details how to specify metrics.
includeTestRunIdWhether all the exported metrics include a test_run_id tag whose value is the k6 Cloud test run id. Default is false.
Be aware that enabling this setting might increase the cost of your APM provider.
resampleRateThe rate by which the metrics are resampled and sent to the APM provider in seconds. Default is 3 and acceptable values are integers between 1 and 10.

Metric configuration

sourceMetric(required)Name of k6 builtin or custom metric to export, optionally with tag filters.
Tag filtering follows Prometheus selector syntax,
Example: http_reqs{name="",status!="500"}
targetMetricName of resulting metric in New Relic. Default is the name of the source metric with a k6_ prefix
Example: k6_http_reqs
keepTagsList of tags to preserve when exporting time series.

keepTags can have a high cost

Most cloud platforms charge clients based on the number of time series stored.

When exporting a metric, every combination of kept-tag values becomes a distinct time series in Prometheus. While this granularity can help test analysis, it will incur high costs with thousands of time series.

For example, if you add keepTags: ["name"] on http_* metrics, and your load test calls many dynamic URLs, the number of produced time series can build up very quickly. Refer to URL Grouping for how to reduce the value count for a name tag.

k6 recommends exporting only tags that are necessary and don't have many distinct values.

Metric configuration detailed example

export const options = {
ext: {
loadimpact: {
apm: [
// ...
includeDefaultMetrics: false,
includeTestRunId: true,
metrics: [
// keep vus metrics for whole test run
// total byte count for data sent/received by k6
// export checks metric, keeping 'check' (name of the check) tag
sourceMetric: 'checks',
keepTags: ['check'],
// export HTTP durations from 'default' scenario,
// keeping only successful response codes (2xx, 3xx), using regex selector syntax
sourceMetric: 'http_req_duration{scenario="default",status=~"[23][0-9]{2}"}',
targetMetric: 'k6_http_request_duration', // name of metric as it appears in New Relic
keepTags: ['name', 'method', 'status'],
// count HTTP responses with status 500
sourceMetric: 'http_reqs{status="500"}',
targetMetric: 'k6_http_server_errors_count',
keepTags: ['scenario', 'group', 'name', 'method'],

Read more