Skip to content

[v3-4-test] Go SDK: stop log attributes from displacing standard log fields (#73820) - #75564

Merged
henry3260 merged 1 commit into
v3-4-testfrom
backport-9761167-v3-4-test
Oct 24, 2026
Merged

henry3260 merged 1 commit into
v3-4-testfrom
backport-9761167-v3-4-test

Conversation

@github-actions

Copy link
Copy Markdown
Contributor
  • 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." 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]

…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]>
@henry3260
henry3260 enabled auto-merge (squash) October 24, 2026 16:08
@henry3260
henry3260 merged commit 2104e11 into v3-4-test Oct 24, 2026
147 of 172 checks passed
@henry3260
henry3260 deleted the backport-9761167-v3-4-test branch October 24, 2026 16:49
@github-actions github-actions Bot added this to the Airflow 3.4.1 milestone Oct 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor Author

Hi maintainer, this PR was merged without a milestone set.
We've automatically set the milestone to Airflow 3.4.1 based on: merged to version branch
If this milestone is not correct, please update it to the appropriate milestone.

This comment was generated by Milestone Tag Assistant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants