Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surface k6 log output when k6 exits with an error #1058

Open
nadiamoe opened this issue Nov 21, 2024 · 1 comment
Open

Surface k6 log output when k6 exits with an error #1058

nadiamoe opened this issue Nov 21, 2024 · 1 comment

Comments

@nadiamoe
Copy link
Member

nadiamoe commented Nov 21, 2024

Currently, the local k6 runner will return an error if the k6 binary exits with an error:

return nil, fmt.Errorf("cannot execute k6 script: %w", err)

Unfortunately, it does so before collecting logs a few lines later:

result.Logs, err = afs.ReadFile(logsFn)

Furthermore, the k6 processor will ignore any reported logs if k6runner.Run returns an error, as it is currently doing:

result, err := k6runner.Run(ctx, r.script)

This makes k6 log output invisible when there is an error running k6, which results in hard to debug scenarios. We should change this:

The cloud runner does this by heuristically checking if an error is an user-error, and reading the log output if it is:
https://github.com/grafana/sm-k6-runner/blob/f0057a93a7237b827aca0d1dc470cd45df0f79f3/internal/runner/runner.go#L213

@peterschretlen
Copy link
Contributor

Related to #1059 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants