Preserve module source on API errors - #5971
Merged
Merged
Conversation
inancgumus
temporarily deployed
to
azure-trusted-signing
May 12, 2026 18:32 — with
GitHub Actions
Inactive
inancgumus
temporarily deployed
to
azure-trusted-signing
May 12, 2026 18:35 — with
GitHub Actions
Inactive
inancgumus
force-pushed
the
browser-loki-source-prototype
branch
from
May 12, 2026 18:38
6f3c7e6 to
f776b45
Compare
inancgumus
temporarily deployed
to
azure-trusted-signing
May 12, 2026 18:44 — with
GitHub Actions
Inactive
inancgumus
temporarily deployed
to
azure-trusted-signing
May 12, 2026 18:46 — with
GitHub Actions
Inactive
inancgumus
force-pushed
the
browser-loki-source-prototype
branch
from
May 12, 2026 18:51
f776b45 to
3a49f1d
Compare
inancgumus
temporarily deployed
to
azure-trusted-signing
May 12, 2026 18:57 — with
GitHub Actions
Inactive
inancgumus
temporarily deployed
to
azure-trusted-signing
May 12, 2026 18:59 — with
GitHub Actions
Inactive
inancgumus
force-pushed
the
browser-loki-source-prototype
branch
from
May 12, 2026 19:23
3a49f1d to
2add0fb
Compare
inancgumus
temporarily deployed
to
azure-trusted-signing
May 12, 2026 19:29 — with
GitHub Actions
Inactive
inancgumus
temporarily deployed
to
azure-trusted-signing
May 12, 2026 19:36 — with
GitHub Actions
Inactive
inancgumus
force-pushed
the
browser-loki-source-prototype
branch
from
May 12, 2026 20:18
2add0fb to
c803029
Compare
inancgumus
temporarily deployed
to
azure-trusted-signing
May 12, 2026 20:24 — with
GitHub Actions
Inactive
inancgumus
temporarily deployed
to
azure-trusted-signing
May 12, 2026 20:26 — with
GitHub Actions
Inactive
inancgumus
force-pushed
the
browser-loki-source-prototype
branch
from
May 12, 2026 20:26
c803029 to
c527534
Compare
inancgumus
temporarily deployed
to
azure-trusted-signing
May 12, 2026 20:32 — with
GitHub Actions
Inactive
inancgumus
temporarily deployed
to
azure-trusted-signing
May 12, 2026 20:34 — with
GitHub Actions
Inactive
inancgumus
force-pushed
the
browser-loki-source-prototype
branch
from
May 12, 2026 21:10
c527534 to
f7fbade
Compare
inancgumus
temporarily deployed
to
azure-trusted-signing
May 12, 2026 21:16 — with
GitHub Actions
Inactive
inancgumus
temporarily deployed
to
azure-trusted-signing
May 12, 2026 21:18 — with
GitHub Actions
Inactive
inancgumus
temporarily deployed
to
azure-trusted-signing
May 12, 2026 22:01 — with
GitHub Actions
Inactive
inancgumus
temporarily deployed
to
azure-trusted-signing
May 12, 2026 22:03 — with
GitHub Actions
Inactive
inancgumus
marked this pull request as ready for review
May 13, 2026 13:18
inancgumus
requested review from
mstoykov and
szkiba
and removed request for
a team
May 13, 2026 13:18
szkiba
previously approved these changes
May 13, 2026
mstoykov
previously requested changes
May 15, 2026
mstoykov
left a comment
Contributor
There was a problem hiding this comment.
I am not happy wiht making eventloop and errext depend on internal/log and given the naming errWithFieldsError likely should just be under errext but it might also be better to be moved somewhere else.
inancgumus
force-pushed
the
browser-loki-source-prototype
branch
2 times, most recently
from
May 18, 2026 20:16
598be1a to
9657bd7
Compare
Contributor
Author
|
@mstoykov Please take another look. I've simplified the code. |
inancgumus
temporarily deployed
to
azure-trusted-signing
May 18, 2026 20:22 — with
GitHub Actions
Inactive
inancgumus
temporarily deployed
to
azure-trusted-signing
May 18, 2026 20:25 — with
GitHub Actions
Inactive
inancgumus
force-pushed
the
browser-loki-source-prototype
branch
from
May 18, 2026 21:08
9657bd7 to
0c054cd
Compare
inancgumus
temporarily deployed
to
azure-trusted-signing
May 18, 2026 21:14 — with
GitHub Actions
Inactive
inancgumus
temporarily deployed
to
azure-trusted-signing
May 18, 2026 21:16 — with
GitHub Actions
Inactive
inancgumus
force-pushed
the
browser-loki-source-prototype
branch
from
May 18, 2026 21:22
0c054cd to
a327e4f
Compare
Some errors need to carry extra log fields (like module origin) through the error chain. WithFields/FieldsFromErr attaches a map[string]any to any error. Format() merges these fields alongside hint into the returned fields map.
Unhandled promise rejections were formatted with fmt.Errorf, which stringified the rejection value and destroyed the original Go error chain. rejectionError keeps the cause accessible via Unwrap so errors.As can traverse the chain.
Iteration errors now carry their attached fields to the logger. Format() extracts any fields from the error chain, exceptions still get source=stacktrace. This removes the need for per-field checks in the executor.
Async rejects (promise helper) and sync throws (Panicf) now attach module=browser via WithFields. This lets Cloud Logs filter browser-originated errors without overriding the existing source field used by other systems.
inancgumus
force-pushed
the
browser-loki-source-prototype
branch
from
May 18, 2026 21:24
a327e4f to
6319394
Compare
inancgumus
temporarily deployed
to
azure-trusted-signing
May 18, 2026 21:30 — with
GitHub Actions
Inactive
inancgumus
temporarily deployed
to
azure-trusted-signing
May 18, 2026 21:32 — with
GitHub Actions
Inactive
szkiba
self-requested a review
May 19, 2026 07:04
andrewslotin
approved these changes
Jun 3, 2026
szkiba
approved these changes
Jun 3, 2026
inancgumus
dismissed
mstoykov’s stale review
June 3, 2026 18:08
The code has been updated per the feedback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Browser API failures now log the browser module as
module=browser.slogfor logging.sourceas it's being used by other things, likestacktrace,console,http-debug,grafana-k6-cloud, etc. Some systems are parsing those, and we should not change them like so. So, we usemodule.Why?
Users should be able to filter Cloud Logs for failures separately. A browser operation that failed during a test has already reached Cloud Logs, but it arrived without a label, so the source could not classify it as a browser op.
Note
Failing CI runs are not related to this PR.
Related PR(s)/Issue(s)