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.
From the Main navigation, go to Manage > Cloud APM and select New Relic.
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.
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.
Create a new test with the test builder, or select a test that was already created with the Test Builder.
On the test builder sidebar, select the Cloud APM to enable the integration for the test.
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:
|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.
|credentials||The 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.
|includeDefaultMetrics||Whether it exports the default APM metrics: data_sent, data_received, http_req_duration, http_reqs, iterations, and vus. Default is true.|
|metrics||List of metrics to export. |
A subsequent section details how to specify metrics.
|includeTestRunId||Whether 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.
|resampleRate||The 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.|
|sourceMetric(required)||Name of k6 builtin or custom metric to export, optionally with tag filters. |
Tag filtering follows Prometheus selector syntax,
|targetMetric||Name of resulting metric in New Relic. Default is the name of the source metric with a k6_ prefix |
|keepTags||List 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.