Skip to content

Conversation

@tirkarthi
Copy link
Contributor

Update API to return color_log_error_keywords and color_log_warning_keywords from airflow.cfg through config API. Then in frontend parse the log message to add color attribute to span tag based on the keyword.

Notes to self and review :

  1. The semantic tokens in light theme appear to be hard to read. I guess it could be due to the Code block adding some more background color.
  2. For task log preview I have disabled highlighting since it didn't make sense and it was already filtered by error/critical level.

airflow.cfg values to test as per the screenshot

color_log_error_keywords = error,exception,group
color_log_warning_keywords = utils

image

image

@boring-cyborg boring-cyborg bot added area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers. labels Mar 7, 2025
@tirkarthi tirkarthi added the AIP-38 Modern Web Application label Mar 7, 2025
@bbovenzi
Copy link
Contributor

bbovenzi commented Mar 7, 2025

Yeah, we shoudl adjust those light mode colors. First, want to try a light Code background before playign with the text color?

We should also make sure this plays well with #47469. Maybe log source shouldn't be by color then?

Copy link
Member

@ashb ashb left a comment

Choose a reason for hiding this comment

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

Sorry, this is -1 for me right now for the reasons below.

"audit_view_included_events": conf.get("webserver", "audit_view_included_events", fallback=""),
"audit_view_excluded_events": conf.get("webserver", "audit_view_excluded_events", fallback=""),
"test_connection": conf.get("core", "test_connection", fallback="Disabled"),
"color_log_error_keywords": conf.get("logging", "color_log_error_keywords", fallback="").split(","),
Copy link
Member

Choose a reason for hiding this comment

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

  1. there's a conf.getlist function
  2. This is a UI setting, not a logging setting
  3. Now we have structured logging (where the log level comes form the "source" directly without needing to pase , I don't think we should be looking for keywords.
  4. I really really really REALLY don't want us to add more config options!

Also "Task succeded without error" would get highlighted as an error. Very prone to false positives.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not a new configuration. This was already present in Airflow 2.10. This is a port of the implementation from the old UI to the new UI. We have use cases where we show logs from external systems like Spark, HDFS etc that are not structured from the triggerer as a log group like "::group::stdout". The keywords help in highlighting the relevant line and improves debugging.

Also "Task succeded without error" would get highlighted as an error. Very prone to false positives.

Agreed, this is like a simple ctrl+f in the browser and has been more useful than a hindrance,

Config docs : https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#color-log-error-keywords
Airflow 2.10 implementation : #37443

Copy link
Contributor

Choose a reason for hiding this comment

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

3.0 is the opportunity to decide which config to remove too.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am mostly with Ash. I had mostly false-positives with the highlighting so far which ended-up that we disabled all keywords from default as users called because being confused.

For Error/Warning I think the highlighting should be really oriented from the log sub system and log level as we have structured data.

I'd be OK to have the highlighting with keyword, if not "Exception", "Error" and "Warning" are used per default in config (as this would be over-lapping with the log level). It might be use-ful for cases where custom words (other than error...) are to be highlighted.

@tirkarthi
Copy link
Contributor Author

Thanks everyone for the comments. I am closing the PR. This can be revisited if there are requests from users in Airflow 3.x .

@tirkarthi tirkarthi closed this Mar 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AIP-38 Modern Web Application area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants