No results for

Powered byAlgolia

Cloud APM

suggest edits

Cloud tests can export their metrics in near real-time to various APM platforms, allowing you to correlate and query testing metrics with other system metrics on your APM of choice:

Additionally, k6 Cloud supports exporting metrics to Prometheus instances using the remote write feature.

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

Configuration

The APM export functionality is configured on the test level; each test has to set up its APM settings to export the metrics of their test runs.

  • You can configure a test to export to multiple different APM providers.
  • You can configure the APM settings using the k6 Cloud app and test builder or scripting the k6 test.

For more detailed instructions, refer to the documentation of your APM: Azure Monitor, DataDog, Grafana Cloud, or New Relic.

Default APM Metrics

By default, the APM integrations only export a subset of k6 metrics - the default APM metrics.

The includeDefaultMetrics option in the k6 script controls whether to export the default APM metrics or not. The default APM metrics are:

Metric NameTypeDescription
vusGaugeCurrent number of active virtual users
iterationsCounterThe aggregate number of times the VUs in the test have executed the JS script.
data_receivedCounterThe amount of received data.
data_sentCounterThe amount of data sent.
http_reqsCounterHow many HTTP requests has k6 generated, in total.
http_req_durationTrendTotal time for the request. float

If you are not familiar with the different types of k6 metrics, we recommend reading the Metrics page.

By default, the integration only send these metrics to avoid unexpected costs with your APM provider. APM providers charges based on the number of stored metrics, and a load test can generate a massive amount of metrics.

If you need to select the metrics to export, use the metrics option. In the k6 script, you can set both options - includeDefaultMetrics and metrics - as follows:

export const options = {
ext: {
loadimpact: {
apm: [
{
provider: 'your-provider',
// Whether it exports the default APM metrics. Default is true.
includeDefaultMetrics: false,
// List of built-in and custom metrics to export. Default is empty.
metrics: ['vus', 'http_req_duration', 'http_req_sending', 'my_rate', 'my_gauge'], //...
//....
},
],
},
},
};

Considerations

  • APM data export is supported for tests that are up to 1 hour long (3600 seconds plus 30 seconds of gracefulStop). Longer tests are currently not supported.
  • If the APM configuration has errors, (e.g. invalid provider, wrong credentials, etc) the configuration will be ignored, and the test will be executed without the APM functionality.
  • The data exported in near real-time may appear incorrect until the test is finished and the 2nd pass export has completed. The Prometheus Remote Write integration doesn't have a 2nd pass export.
  • You cannot export metrics to two Prometheus Remote Write servers at the same time. This also applies to the other providers.