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

Log messages for uncaught errors do not have source (or any other identifiable attribute) #3842

Open
roobre opened this issue Jul 12, 2024 · 0 comments · May be fixed by #3874
Open

Log messages for uncaught errors do not have source (or any other identifiable attribute) #3842

roobre opened this issue Jul 12, 2024 · 0 comments · May be fixed by #3874
Assignees

Comments

@roobre
Copy link
Contributor

roobre commented Jul 12, 2024

Brief summary

Log lines generated by uncaught errors, such as throw new Error("foobar");, do not have any identifiable attribute that allows to programatically check if the log line comes from an uncaught throwable.

Simples reproduction would be something like:

roobre@Archiroo 󱃾 curry-admin@Curry
16:56:29 /tmp/roobre $> cat throw.js

export default async function () {
  throw new Error("foobar");
}

roobre@Archiroo 󱃾 curry-admin@Curry
16:56:41 /tmp/roobre $> k6 run throw.js --log-format logfmt --log-output=file=throw.log

          /\      |‾‾| /‾‾/   /‾‾/
     /\  /  \     |  |/  /   /  /
    /  \/    \    |     (   /   ‾‾\
   /          \   |  |\  \ |  (‾)  |
  / __________ \  |__| \__\ \_____/ .io

     execution: local
        script: throw.js
        output: -

     scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
              * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)


     data_received........: 0 B 0 B/s
     data_sent............: 0 B 0 B/s
     iteration_duration...: avg=30.22µs min=30.22µs med=30.22µs max=30.22µs p(90)=30.22µs p(95)=30.22µs
     iterations...........: 1   6937.458809/s


running (00m00.0s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs  00m00.0s/10m0s  1/1 iters, 1 per VU

roobre@Archiroo 󱃾 curry-admin@Curry
16:56:42 /tmp/roobre $> cat throw.log
time="2024-07-12T16:56:42+02:00" level=error msg="Uncaught (in promise) Error: foobar\n\tat file:///tmp/roobre/throw.js:3:8(3)\n" executor=per-vu-iterations scenario=default

Other cases include the "browser not found in registry" error:

time="2024-07-12T16:47:49+02:00" level=error msg="Uncaught (in promise) GoError: browser not found in registry. make sure to set browser type option in scenario definition in order to use the browser module\n\tat github.com/grafana/xk6-browser/browser.syncMapBrowser.func7 (native)\n\tat file:///tmp/roobre/browser.js:20:15(4)\n" executor=shared-iterations scenario=default

k6 version

k6 v0.52.0 (commit/20f8febb5b, go1.22.4, linux/amd64)

OS

Arch linux

Docker version and image (if applicable)

No response

Steps to reproduce the problem

k6 run --log-format logfmt --log-output=file=throw.log

export default async function () {
  throw new Error("foobar");
}

Observe the matching log line does not have any attribute.

Expected behaviour

A log attribute would be nice to identify this logs programmatically and react to them. Something like source=throwable or something along those lines.

Actual behaviour

As described above.

@roobre roobre added the bug label Jul 12, 2024
@roobre roobre changed the title Log messages for uncaught exceptions do not have source (or any other identifiable attribute) Log messages for uncaught errors do not have source (or any other identifiable attribute) Jul 12, 2024
@athishaves athishaves linked a pull request Jul 28, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants