Skip to content

Java SDK: Send log timestamps in UTC - #74783

Merged
jason810496 merged 2 commits into
apache:mainfrom
FrankYang0529:fix-java-sdk-log-timestamp-utc
Oct 20, 2026
Merged

jason810496 merged 2 commits into
apache:mainfrom
FrankYang0529:fix-java-sdk-log-timestamp-utc

Conversation

@FrankYang0529

@FrankYang0529 FrankYang0529 commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Why

  • The Java SDK sends the timestamp of each log record as the JVM's local time without a UTC offset. Airflow reads a timestamp without an offset as a time in [core] default_timezone, which is UTC by default. A user not in default timezone will get unexpected log time.
  • LocalDateTime.toString() leaves out the seconds on a whole minute, for example 2026-10-13T17:41. The supervisor cannot parse that string, so it stops before it reports the task's final state.

How

  • LogMessage.timestamp is a java.time.Instant, and LogSender sends the result of Instant.toString(). That string is in UTC, ends with Z, and always includes the seconds.
  • The supervisor catches DecodeError when it cannot parse a timestamp. It moves the value to invalid_timestamp and stamps the line with its arrival time.

Was generative AI tooling used to co-author this PR?
  • Yes - Claude Code

@jason810496 jason810496 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for the fix, LGTM overall.
It would be nice to cover the supervisor timestamp decoding part in this PR as well.

Here're some findings by agent review that make sense to me.

Comment thread contributing-docs/30_new_language_sdk.rst Outdated
Comment thread java-sdk/sdk/src/test/kotlin/org/apache/airflow/sdk/execution/LogTest.kt Outdated
Comment thread java-sdk/sdk/src/main/kotlin/org/apache/airflow/sdk/execution/Logger.kt Outdated
@FrankYang0529
FrankYang0529 force-pushed the fix-java-sdk-log-timestamp-utc branch from 524a8aa to ee37cfa Compare October 19, 2026 15:10
@FrankYang0529
FrankYang0529 force-pushed the fix-java-sdk-log-timestamp-utc branch from ee37cfa to d73ccb5 Compare October 20, 2026 02:15
Signed-off-by: PoAn Yang <payang@apache.org>
Signed-off-by: PoAn Yang <payang@apache.org>

@jason810496 jason810496 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once we address the final comment, thanks.

Comment thread task-sdk/src/airflow/sdk/execution_time/supervisor.py
@jason810496 jason810496 added the backport-to-v3-4-test Backport to v3-4-test label Oct 20, 2026
@jason810496 jason810496 added this to the Airflow 3.4.0 milestone Oct 20, 2026
@FrankYang0529
FrankYang0529 force-pushed the fix-java-sdk-log-timestamp-utc branch from d73ccb5 to 8c0e67c Compare October 20, 2026 03:33
@jason810496
jason810496 merged commit 9091cd0 into apache:main Oct 20, 2026
93 of 97 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Backport successfully created: v3-4-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
✅ v3-4-test PR Link

@FrankYang0529
FrankYang0529 deleted the fix-java-sdk-log-timestamp-utc branch October 20, 2026 06:05
vatsrahul1001 pushed a commit that referenced this pull request Oct 20, 2026
* Java SDK: Send log timestamps in UTC



* Fix Java SDK log time zone and a supervisor crash on bad timestamps



---------
(cherry picked from commit 9091cd0)

Signed-off-by: PoAn Yang <payang@apache.org>
Co-authored-by: PoAn Yang <payang@apache.org>
vatsrahul1001 pushed a commit that referenced this pull request Oct 20, 2026
* Java SDK: Send log timestamps in UTC



* Fix Java SDK log time zone and a supervisor crash on bad timestamps



---------
(cherry picked from commit 9091cd0)

Signed-off-by: PoAn Yang <payang@apache.org>
Co-authored-by: PoAn Yang <payang@apache.org>
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