k6 Cloud platform supports exporting metrics to APM platforms, thereby enabling users to export metrics from a running test in near real-time to their preferred APM platform(s).
Currently, the following platforms are supported:
This list will be expanded in the future. Please contact us if you would like an integration that isn't currently listed.
For maximum flexibility, the APM export functionality is configured on the test-run level. The required parameters should be specified in options.ext.loadimpact.apm (See extension options for more information). The configuration parameters are as follows:
|provider||Any APM provider name available in the supported APM provider's table.|
|api_key||The api_key provided by the APM platforms.|
|app_key||The app_key provided by the APM platforms, if applicable.|
|metrics||List of built-in and custom metrics to be exported.|
|include_default_metrics||If set, the export will include the default metrics. Default is true.|
|resample_rate||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.|
|include_test_run_id||If set, the test_run_id will be exported per each metric as an extra tag. Default is false.|
Note: This guide will walk you through creating an api_key and an app_key on Datadog. Note that the api_key and app_key for datadog won't work on datadogeu.
The metrics parameter allows you to specify built-in and custom metrics to be exported to the APM provider. By default, only the basic metrics listed below are exported. These defaults also match the official k6 dashboard for Datadog, which you can read more about on visualization of metrics in Datadog.
A typical use case is to only export custom metrics defined in the script. To do that you should specify the names of your custom metrics in the metrics parameter, and set include_default_metrics to false.
If you want to export metrics with more granularity, consider using a lower number for the resample_rate, like 1.
The apm key (inside ext.loadimpact) accepts a list of APM configurations (objects). Exporting metrics to APM platforms will be simultaneous and near real-time. Also, there is a 2nd pass (of metrics exports), at the end of each test run, that ensures data reliability and accuracy. Please note that the data exported in real-time may appear incorrect until the test is finished.
Make sure to meet the following requirements, otherwise, we can't guarantee a working metrics export:
- If you use custom metrics in your script, remember to add them to the metrics array, otherwise, those metrics won't be automatically exported.
- If you want to export built-in metrics that are not listed above, you can include them in the metrics array.
- 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.
- If you provide invalid metrics to the metrics field, the test will continue, but the metrics export(s) will not include the invalid metric.
- The metrics defined in metrics are case-sensitive.
- The official k6 dashboard on Datadog gives you the ability to filter metrics based on test_run_id, but we don't export test_run_id as an extra tag by default. If you want to export it, you should set include_test_run_id to true.
- APM data export is supported for tests that are up to 1 hour long. Longer tests are currently not supported.
- The data exported in near real-time may appear incorrect until the test is finished and the 2nd pass export has completed.
This feature is only available for certain subscriptions:
- Monthly Pro
- Annual Team/Pro