Open andrewslotin opened 2 weeks ago
Side-note; I'm not sure if now there's "a reliable way to retrieve this value from within the" (paraphrasing the sentence above) Go code (e.g. an extension or output), but I'd really love if we make that possible as well as part of this task, as that will unlock/make possible other ideas we have on the backlog.
In essence, being able to now the Test Run Id from Go code, either a normal "JavaScript" extension or from an "output" extension.
cc/ @Blinkuu this might be of your relevance, as this would be a blocker/requirement for the "Insights output" idea we discussed, as you need the Test Run ID to fetch the insights from the API.
cc/ @oleiade I see you assigned here, so ping me if you need further context.
@joanlopez the original proposal is about putting it in options.cloud
and practically every part of k6 has access to the options. Which is why I proposed it like that internally, instead of coming up with another specific API.
Whenever a k6 test is executed in Grafana Cloud using
k6 cloud run
or if Grafana Cloud is set as an output withk6 cloud run --local-execution
, a test run ID is generated for that execution. This identifier is helpful for distinguishing between local runs, such as debugging a load test script, and cloud executions. It also aids in correlating requests made during the test run.Currently, there is no reliable way to retrieve this value from within the test script code. To address this, I propose modifying the
options.cloud
object returned byk6/execution
, adding a field that will be populated with the test run ID for the current execution.