K6 REST API retrieve options

Hello k6 peeps. I wanted to ask if it were possible to fetch contents of the options object, if utilized, by a given script. for instance…

commons.js

login.js

k6 run login.js
curl -X GET
http://localhost:6565/v1/status
-H ‘Content-Type: application/json’

{
    "data": {
        "type": "status",
        "id": "default",
        "attributes": {
            "status": 7,
            "paused": false,
            "vus": 23,
            "vus-max": 30,
            "stopped": false,
            "running": true,
            "tainted": false
        }
    }
}

is there a way to enhance the output of the k6 status call to include other characteristics of the options object? like other key values like thresholds or tags or exec key values. much like vus and vus-max which is returned from the status uri.

what I’m after is a poor man’s lint/assertion to check to see if scripts contain the best practices I’m trying to passively enforce. meaning when I run a given script I should be able to check " /v1/status" whether thresholds and or tags have been set and utilized. if not I can “do something”. like set the job to an non-zero exist code or fail a build etc etc…

thanks in advance,

PlayStay

Hi @PlayStay

I’m afraid it is not possible to retrieve these configuration elements from the REST API at the moment.

It does sound like a reasonable enough need, though, and if you have the capacity, I suggest you open a feature request issue. on the k6 repository :bowing_man:

2 Likes