Skip to content

Refactor Elasticsearch log formatter to use timezone.from_timestamp#67245

Open
23tae wants to merge 3 commits into
apache:mainfrom
23tae:refactor-elasticsearch-log-formatter
Open

Refactor Elasticsearch log formatter to use timezone.from_timestamp#67245
23tae wants to merge 3 commits into
apache:mainfrom
23tae:refactor-elasticsearch-log-formatter

Conversation

@23tae
Copy link
Copy Markdown

@23tae 23tae commented May 20, 2026

Description

This PR refactors the ElasticsearchJSONFormatter to use the standard Airflow timezone.from_timestamp utility, addressing a TODO in the codebase.
This is a companion PR to #66856, which applies the same refactoring pattern to the Elasticsearch provider.

Key changes

  • Task SDK timezone export: Exported from_timestamp in airflow.sdk.timezone to make it part of the public Task SDK API (shared changes with Refactor Opensearch log formatter to use timezone.from_timestamp and export it in Task SDK #66856).
  • Compatibility logic: Implemented version-based compatibility logic in the Elasticsearch provider. The formatter now uses the new timezone.from_timestamp on Airflow 3.3.0+ and maintains backward compatibility by falling back to the original pendulum/datetime logic on older Airflow 3.x releases.

Verification Results

I have verified the changes using both prek (ruff) and breeze (standardized Docker environment).

  • Unit Tests (Breeze): Passed
  • Static Checks (Prek): Passed
image
Was generative AI tooling used to co-author this PR?
  • Yes

Generated-by: Antigravity following the guidelines


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@23tae 23tae force-pushed the refactor-elasticsearch-log-formatter branch from a236358 to 21350e1 Compare May 21, 2026 05:19
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.

1 participant