Metrics REST API
Use these endpoints to access metrics metadata from test runs.
List metrics
GET /test_runs/:testRunId/metrics
Example request:
GET https://api.k6.io/cloud/v5/test_runs/152779/metrics
Accept: application/json
Authorization: Token 56c166885f9a7fc1e588a1b3cb66f6dd
Example response
HTTP/1.1 200
Content-Type: application/json
{
"value": [
{
"id": "1af77c11-5b93-58ba-b7a2-c839b0402cf7",
"name": "load_generator_file_handles",
"origin": "builtin",
"test_run_id": 152779,
"type": "gauge"
},
{
"id": "38ae6276-4630-5ad6-a3bb-d11f678d96dd",
"name": "iteration_duration",
"origin": "builtin",
"test_run_id": 152779,
"type": "trend"
},
{
"id": "4643ca9f-9539-5e86-9937-2ae956f9dcc4",
"name": "data_sent",
"origin": "builtin",
"test_run_id": 152779,
"type": "counter"
},
{
"id": "5d0b30bf-321c-5c2d-a318-ebfb7d79c915",
"name": "vus",
"origin": "builtin",
"test_run_id": 152779,
"type": "gauge"
}
]
}
List time series
Note
This API output is similar to Prometheus series API
GET /test_runs/:testRunId/series
Parameter | Description |
---|---|
match[] | Repeated series selector argument that selects the series to return. At least one match[] argument must be provided. |
Example request:
GET https://api.k6.io/cloud/v5/test_runs/152777/series?match[]=http_req_duration{expected_response="true"}
Accept: application/json
Authorization: Token 56c166885f9a7fc1e588a1b3cb66f6dd
Example response
HTTP/1.1 200
Content-Type: application/json
{
"status": "success",
"data": [
{
"__name__": "http_req_duration",
"expected_response": "true",
"group": "::g2",
"load_zone": "amazon:us:columbus",
"method": "GET",
"name": "http://test.k6.io/",
"proto": "HTTP/1.1",
"scenario": "http_with_groups",
"status": "200",
"test_run_id": "152777",
"url": "http://test.k6.io/"
},
{
"__name__": "http_req_duration",
"expected_response": "true",
"group": "",
"load_zone": "amazon:us:columbus",
"method": "GET",
"name": "http://test.k6.io/?q=3",
"proto": "HTTP/1.1",
"scenario": "http_simple",
"status": "200",
"test_run_id": "152777",
"url": "http://test.k6.io/?q=3"
}
]
}
Query label names
Note
This API output is similar to Prometheus labels API
GET /test_runs/:testRunId/labels
Parameter | Description |
---|---|
match[] | Optional: repeated series selector argument that selects the series from which to read the label names. |
Example request:
GET https://api.k6.io/cloud/v5/test_runs/152777/labels?match[]=http_req_duration
Accept: application/json
Authorization: Token 56c166885f9a7fc1e588a1b3cb66f6dd
Example response
HTTP/1.1 200
Content-Type: application/json
{
"status": "success"
"data": [
"__name__",
"expected_response",
"group",
"load_zone",
"method",
"name",
"proto",
"scenario",
"status",
"test_run_id",
"url"
],
}
Query label values
Note
This API output is similar to Prometheus label values API
GET /test_runs/:testRunId/label/:labelName/values
Parameter | Description |
---|---|
match[] | Optional: repeated series selector argument that selects the series from which to read the label values. |
Example request:
GET https://api.k6.io/cloud/v5/test_runs/152777/label/load_zone/values?match[]=http_req_duration
Accept: application/json
Authorization: Token 56c166885f9a7fc1e588a1b3cb66f6dd
Example response
HTTP/1.1 200
Content-Type: application/json
{
"status": "success"
"data": [
"amazon:us:columbus",
"amazon:eu:dublin",
],
}