Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add %z for %(asctime)s to fix timezone for logs on UI #24811

Merged
merged 1 commit into from Jul 13, 2022

Conversation

rino0601
Copy link
Contributor

@rino0601 rino0601 commented Jul 3, 2022

follow up of #24373

related:
original issue #23796
previous pr #24373
revert previous pr #24810
reference #21942

dag_id_seoul_run_id_scheduled__2022-07-03T06_00_00_00_00_task_id_old_tpl_attempt_1__1__log_및_seoul_-Airflow_및_seoul-Grid-_Airflow

As already addressed in #24810, #24373 has git conflict problem. This PR solves that problem and makes it able to release as a bugfix.
Also, thanks to @millin 's comment, by applying ISO 8601 format, it can drop complicated and duplicated custom parse code on UI.

This pr must be merged after #24810


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst, in newsfragments.

@boring-cyborg boring-cyborg bot added area:logging area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues labels Jul 3, 2022
@@ -635,7 +635,7 @@
default: "%%(asctime)s %%(levelname)s - %%(message)s"
- name: log_formatter_class
description: ~
version_added: 2.3.3
version_added: 2.3.4
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rino0601 rino0601 marked this pull request as ready for review July 3, 2022 07:34
// above regex is a kind of duplication of 'dateRegex'
// in airflow/www/static/js/grid/details/content/taskinstance/Logs/utils.js
const dateRegex = /\d{4}[./-]\d{2}[./-]\d{2} \d{2}:\d{2}:\d{2},\d{3}/g;
const iso8601Regex = /\d{4}[./-]\d{2}[./-]\d{2}T\d{2}:\d{2}:\d{2}.\d{3}[+-]\d{4}/g;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we not do both of these checks in utils.ts too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The regular expression on the utils.ts side is const regExp = /\[(.*?)\] \{(.*?)\}/;, which finds the string between square brackets instead of finding the time string.
moments.js understands the ISO 8601 format, so we don't have to worry about this.

@bbovenzi
Copy link
Contributor

bbovenzi commented Jul 8, 2022

@rino0601 getting some conflicts now after #24810

@rino0601
Copy link
Contributor Author

rino0601 commented Jul 9, 2022

By git rebase apache/main && git push --force-with-lease solved conflicts.
also, git cherry-pick ${THIS_PR_HASH} onto v2-3-test branch doesn't make any conflicts as intended.

@rino0601
Copy link
Contributor Author

Could you please give this PR a type:bug-fix label and an Airflow 2.3.4 milestone? thank you

@potiuk potiuk added this to the Airflow 2.3.4 milestone Jul 12, 2022
@potiuk potiuk added the type:bug-fix Changelog: Bug Fixes label Jul 12, 2022
@potiuk
Copy link
Member

potiuk commented Jul 12, 2022

Should we possibly add a warning if someone does not use TimezoneAware formatter? I think it is no harm to add it (with clear instruction on what to do). I think writing it in the logs of tasks, would make it much more discoverable - you could simply print a warning "Beware, this log might contain wrong timezone and you should use this and that to fix it".

There are two kinds of users - those who read the "migration guides and changelog" and those who don't and the latter kind of user will generally open an issue if they see logs with wrong timestamp. Producing a warning in the very logs that the user might complain about is as good as we can do to make the user self-serviced, especially if we are very explicit that "timestamps here might have wrong timezone" and add "this is how you fix it".

@rino0601
Copy link
Contributor Author

airslab_serving_knr_d2_nrms_m1_svc_v1_10min_-_Airflow

airflow_–_taskinstance_py

I've tried to add a warnings but it didn't work at the first try.
I'm still digging how to it work. any advice will helpful.

@uranusjr uranusjr merged commit 851e5ca into apache:main Jul 13, 2022
ephraimbuddy pushed a commit that referenced this pull request Aug 15, 2022
dgabidullin added a commit to hhru/airflow that referenced this pull request Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:logging area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants