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

Fix wrong display of multiline messages in the log after filtering #44457

Conversation

jason810496
Copy link
Contributor

closes: #41265

Issue Context

After research, the issue is caused by airflow/www/static/js/dag/details/taskInstance/Logs/utils.ts, the API just return the full raw logs.
Additionally, incorrect display behavior also occurs when filtering by file source.

Main Fix Idea

The currentLogLevel and currentFileSource should remain same until a new logLevel or fileSource is encountered.

Screenshot After Fix

Without any filters
Without any filters
Filter with level
Filter with level
Filter with file source
Filter with file source
Filter with level and file source
Filter with level and file source

@boring-cyborg boring-cyborg bot added area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues labels Nov 28, 2024
@jason810496
Copy link
Contributor Author

Hi @Lee-W, I think this issue should be back ported to 2.9.x, 2.8.x, and 2.7.x and also fixed on the latest main branch once it is merged. Does that sound correct?

@pierrejeambrun pierrejeambrun added the backport-to-v2-10-test Mark PR with this label to backport to v2-10-test branch label Nov 28, 2024
@pierrejeambrun
Copy link
Member

Hi @Lee-W, I think this issue should be back ported to 2.9.x, 2.8.x, and 2.7.x

We do not backport to released versions. (unless critical security fixes but I haven't seen that happen before).

This will most likely be in the next patch release of 2.10.x, people will have to upgrade to get it.

@potiuk potiuk added this to the Airflow 2.10.4 milestone Nov 28, 2024
@Lee-W Lee-W self-requested a review November 29, 2024 01:27
@Lee-W
Copy link
Member

Lee-W commented Nov 29, 2024

Thanks @pierrejeambrun !

@jason810496 To create a "backport" PR to 2.10.x, you'll need to branch out from v2-10-test. In case you've not yet tried it 🙂

@potiuk
Copy link
Member

potiuk commented Nov 29, 2024

@jason810496 To create a "backport" PR to 2.10.x, you'll need to branch out from v2-10-test. In case you've not yet tried it 🙂

Actually we now have cherry-picker - and we marked it with "backport" label, so the backport PR should be created automatically and if it is not possible, instructions what to do will be posted automatically here as comment :D

@pierrejeambrun
Copy link
Member

Main is too different now and do not have this issue because of structured logs. (json)

I noticed that the PR directly targets v2-10-test. I think it's fine in this case.

@potiuk @Lee-W are we fine with that ?

Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

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

Tested, working as expected.

Just a few questions.

I think we should also consider applying the colors to those lines. (only certain lines appear red.)

@potiuk
Copy link
Member

potiuk commented Nov 29, 2024

I noticed that the PR directly targets v2-10-test. I think it's fine in this case.

I think yes, but - we need to make sure this one will be forward-ported (for lack of a better word) or determined not to be needed in main :D

@jason810496
Copy link
Contributor Author

Refactored the test cases to include error cases with traceback.

I think we should also consider applying the colors to those lines. (only certain lines appear red.)

This has been addressed. Screenshot:
截圖 2024-11-30 下午1 30 11

@jason810496 jason810496 force-pushed the fix/wrong-display-of-multiline-messages-in-the-log-after-filtering branch from bdb3141 to ad17f6d Compare November 30, 2024 05:34
- Added red color styling to lines based on the `currentLevel`
- Added comments for new regExp
@jason810496 jason810496 force-pushed the fix/wrong-display-of-multiline-messages-in-the-log-after-filtering branch from ad17f6d to b22961a Compare December 2, 2024 15:36
@jason810496
Copy link
Contributor Author

jason810496 commented Dec 2, 2024

Rebased to the latest v2-10-test. Looking forward to any advice or feedback before merging.
cc @Lee-W , @pierrejeambrun

@pierrejeambrun
Copy link
Member

pierrejeambrun commented Dec 2, 2024

Thanks for the update @jason810496 I was really busy today, I'll do a review tomorrow. (but last time I checked it was looking nice :))

pierrejeambrun
pierrejeambrun previously approved these changes Dec 3, 2024
Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

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

Looks good thanks.

Some of the questions of the previous review are left un answered. Just for my comprehension, if do you mind giving me a few hints.

@pierrejeambrun pierrejeambrun removed the backport-to-v2-10-test Mark PR with this label to backport to v2-10-test branch label Dec 3, 2024
@jason810496
Copy link
Contributor Author

Looks good thanks.

Some of the questions of the previous review are left un answered. Just for my comprehension, if do you mind giving me a few hints.

Sure!

  1. The mockExtraLog in the previous version was just a variable to reuse in the regex instead of directly adding ----... to the regex. In the refactored version, I removed the regex and matched the expected result with .toContain, which is more readable than handling multiple different matches in a single regex.

  2. There was an empty newline in the previous version of the test cases, causing an empty line in parsedLogs. This issue is resolved in the current version:

    // Previous version with an empty line:
    const mockLog = `line 1
    line2
    `;
    
    // Current version without an empty line:
    const mockLog = `line 1
    line 2`;
  3. Updated the comments for the new regex in the current version.

@pierrejeambrun
Copy link
Member

Great thanks @jason810496 for the details.

@pierrejeambrun pierrejeambrun merged commit 294683a into apache:v2-10-test Dec 3, 2024
47 checks passed
@utkarsharma2 utkarsharma2 added the type:bug-fix Changelog: Bug Fixes label Dec 4, 2024
utkarsharma2 pushed a commit that referenced this pull request Dec 4, 2024
…44457)

* Fix Logs/utils

* Fix test for Logs/utils

* Fix by Review Comment

- Added red color styling to lines based on the `currentLevel`
- Added comments for new regExp

* Refactor Logs/utils test cases
utkarsharma2 pushed a commit that referenced this pull request Dec 9, 2024
…44457)

* Fix Logs/utils

* Fix test for Logs/utils

* Fix by Review Comment

- Added red color styling to lines based on the `currentLevel`
- Added comments for new regExp

* Refactor Logs/utils test cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

5 participants