RemoteFilePersister is an implementation of the browser.filePersister interface. The RemoteFilePersister.Persist method takes a path and an io.Reader with the data that needs to be persisted.
It issues a GET request built from information passed thru the K6_BROWSER_SCREENSHOTS_OUTPUT environment variable:
{
"service": "aws_s3",
"operation": "upload_post",
"files": [ { "name": "..." } ]
}
The response has the following shape:
{
"service": "aws_s3",
"urls": [
{
"name": "...",
"pre_signed_url": "https://...",
"method": "PUT",
"form_fields": { ... }
}
]
}
This response tells the code to build a PUT request against the pre-signed URL, with a form-encoded body with the data.
The existing implementation decodes the first response and discards the second one (it's usually empty).
In order to keep track of the uploaded screenshots and be able to request them at a later point in time, it would be convenient for k6 to log an optional uuid field in the first request's response. In other words, the response might look like this:
{
"service": "aws_s3",
"uuid": "...",
"urls": [
{
"name": "...",
"pre_signed_url": "https://...",
"method": "PUT",
"form_fields": { ... }
}
]
}
the new optional uuid field in the response would be logged by k6 if present. Assuming these logs are preserved after the k6 run is done, it would be possible to extract the UUID from the logs and pass it to a Grafana datasource in order to retrieve the data. This is similar to how traces are handled, where a well-known field in the log entries for a service is extracted and passed to a Tempo datasource.
RemoteFilePersisteris an implementation of thebrowser.filePersisterinterface. TheRemoteFilePersister.Persistmethod takes a path and anio.Readerwith the data that needs to be persisted.It issues a GET request built from information passed thru the
K6_BROWSER_SCREENSHOTS_OUTPUTenvironment variable:{ "service": "aws_s3", "operation": "upload_post", "files": [ { "name": "..." } ] }The response has the following shape:
{ "service": "aws_s3", "urls": [ { "name": "...", "pre_signed_url": "https://...", "method": "PUT", "form_fields": { ... } } ] }This response tells the code to build a PUT request against the pre-signed URL, with a form-encoded body with the data.
The existing implementation decodes the first response and discards the second one (it's usually empty).
In order to keep track of the uploaded screenshots and be able to request them at a later point in time, it would be convenient for k6 to log an optional
uuidfield in the first request's response. In other words, the response might look like this:{ "service": "aws_s3", "uuid": "...", "urls": [ { "name": "...", "pre_signed_url": "https://...", "method": "PUT", "form_fields": { ... } } ] }the new optional
uuidfield in the response would be logged by k6 if present. Assuming these logs are preserved after the k6 run is done, it would be possible to extract the UUID from the logs and pass it to a Grafana datasource in order to retrieve the data. This is similar to how traces are handled, where a well-known field in the log entries for a service is extracted and passed to a Tempo datasource.