For a detailed explanation and reference of all metrics, refer to the Metrics docs.
List metrics
Returns all metrics within a specified test run. You can get test-run ids from the test_run_ids field in responses from the Read Test endpoint, or from the id field in the response from the Start Test Run endpoint.
Note that k6 Cloud might store multiple (sub)metrics for each metric generated in the k6 script. For example, when sending an HTTP request within the script, k6 cloud stores http_req_duration, http_req_blocked, http_req_connecting and other metrics for that particular endpoint. Differing HTTP methods and statuses are all grouped as separate metrics. (The same URL produces multiple metrics if k6 detects statuses such as 200, 400 etc).
Some of the fields contained in the response are:
- check_id - ID of the check defined in k6 script. Checks have their underlying metrics stored in k6 cloud.
- group_id - ID of the group this metric belongs to.
- contains - "Unit" for the metrics. Some examples are: time, percent, bytes et.
GET https://api.k6.io/loadtests/v2/metrics?test_run_id={test_run_id}
Query Parameter | Type | Description |
---|---|---|
test_run_id | integer | Returns metrics associated with a given test_run_id. |
Read metric
Returns details of a metric with the specified ID.
GET https://api.k6.io/loadtests/v2/metrics/{id}
Path Parameter | Type | Description |
---|---|---|
id | string | Return metric given the id. |
Query Parameters | Type | Description | Example |
---|---|---|---|
test_run_id | integer | Returns metric associated with a given test_run_id. | /loadtests/v2/metrics/{metric_id}?test_run_id={test_run_id} |
include[] | string | Specifies additional information to include in the response. Allowed options: url, group, check. | /loadtests/v2/metrics/{metric_id}?test_run_id={test_run_id}&include[]=check&include[]=group |
Read series data
Returns time-series data points for specified metrics ids within a specified test run id. Test run ids are available in the test_run_ids field of a response from Read Test or in the id field of a response from Start Test Run endpoint.
Metric ids are available in the id field of the response from the List metrics endpoint.
GET https://api.k6.io/loadtests/v2/series?test_run_id={test_run_id}&ids[]={metric_id_1}
Query Parameters | Type | Description | Example |
---|---|---|---|
test_run_id | integer | Specify test run id. | |
ids[] | string | Specify metric id(s). | /loadtests/v2/series?test_run_id={test_run_id}&ids[]={metric_id_1}&ids[]={metric_id_2} |
List thresholds
Returns all thresholds (and related metrics) for a test run.
GET https://api.k6.io/loadtests/v2/thresholds?test_run_id={test_run_id}&ids[]={threshold_id_1}
Query Parameter | Type | Description | Example |
---|---|---|---|
test_run_id | integer | Returns thresholds associated with a given test_run_id. | |
ids[] | integer | Specify threshold id(s). | /loadtests/v2/thresholds?test_run_id={test_run_id}&ids[]={threshold_id_1}&ids[]={threshold_id_2} |
Read threshold
Returns details of a threshold with the specified ID.
GET https://api.k6.io/loadtests/v2/thresholds/{id}?test_run_id={test_run_id}
Query Parameter | Type | Description |
---|---|---|
test_run_id | integer | ID of the test run. |
id | integer | ID of the threshold. |
Read test run overview
Returns an overview of the test run which includes numbers of URLs, thresholds, checks, etc.
GET https://api.k6.io/loadtests/v2/run-overviews?test_run_id={test_run_id}
Query Parameter | Type | Description |
---|---|---|
test_run_id | integer | A unique integer value identifying this test run. |
Export test run metrics
Exports metric data for test run in CSV format. The file URL is in the export.export_file field of List test runs response.
POST https://api.k6.io/loadtests/v2/runs/{test_run_id}/export
Path Parameter | Type | Description |
---|---|---|
test_run_id | integer | A unique integer value identifying this test run. |