Repository navigation
[v3-4-test] Go SDK: stop log attributes from displacing standard log fields (#73820) - #75564
Merged
Merged
Conversation
…fields (#73820) * Go SDK: stop log attributes from displacing standard log fields A user attribute whose key collides with a standard field replaced that field instead of losing to it. "event" is the one that hurts: the supervisor takes a task's log line out of that key, so a Dag logging an attribute called "event" lost its message entirely, with nothing left in the line to show the message had ever existed. "timestamp" was displaced the same way, leaving the supervisor a value it cannot decode as a datetime. "level" and "logger" were already immune, for no reason other than being written after the attributes rather than before them. * Move a clashing log attribute aside instead of overwriting it Letting the standard field win the slot still discarded a value the caller asked to log. Reserving the slot and re-keying the attribute to "fields.<key>" keeps both: the supervisor finds the message in "event" and a parsable "timestamp", and the attribute survives under a name that collides with nothing. logrus resolves the same clash the same way. Rejecting the attribute outright, as structlog's TypeError does, is not available here. slog discards a handler's error, so returning one would drop the whole line, and a panic would surface in production rather than fail fast at the call site. (cherry picked from commit 9761167) Co-authored-by: Henry Chen <[email protected]>
1 task done
henry3260
marked this pull request as ready for review
October 24, 2026 16:07
henry3260
requested review from
amoghrajesh,
ashb and
jason810496
as code owners
October 24, 2026 16:07
henry3260
approved these changes
Oct 24, 2026
Contributor
Author
|
Hi maintainer, this PR was merged without a milestone set.
|
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.
A user attribute whose key collides with a standard field replaced that
field instead of losing to it. "event" is the one that hurts: the
supervisor takes a task's log line out of that key, so a Dag logging an
attribute called "event" lost its message entirely, with nothing left in
the line to show the message had ever existed. "timestamp" was displaced
the same way, leaving the supervisor a value it cannot decode as a
datetime.
"level" and "logger" were already immune, for no reason other than being
written after the attributes rather than before them.
Letting the standard field win the slot still discarded a value the caller
asked to log. Reserving the slot and re-keying the attribute to
"fields." keeps both: the supervisor finds the message in "event" and
a parsable "timestamp", and the attribute survives under a name that
collides with nothing. logrus resolves the same clash the same way.
Rejecting the attribute outright, as structlog's TypeError does, is not
available here. slog discards a handler's error, so returning one would
drop the whole line, and a panic would surface in production rather than
fail fast at the call site.
(cherry picked from commit 9761167)
Co-authored-by: Henry Chen [email protected]