Skip to content

Conversation

@kevinhongzl
Copy link
Contributor

closes: #51351

(Sorry for accidentally messing up the commit history. I created a new PR for this issue)

Why

This PR reintroduces expose_stacktrace to control whether tracebacks are displayed in the webserver UI.

What

  • Add config api.expose_stacktrace to align with the settings in AF2.
  • Display db tracebacks when expose_stacktrace is enabled.

^ 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 or {issue_number}.significant.rst, in airflow-core/newsfragments.

@kevinhongzl kevinhongzl force-pushed the add-config-setting-to-control-exposing-stacktraces branch from 13b1889 to 1a68ec2 Compare June 9, 2025 01:01
@kevinhongzl kevinhongzl force-pushed the add-config-setting-to-control-exposing-stacktraces branch from 98d8518 to d4ad121 Compare June 9, 2025 13:57
Copy link
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

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

A very small nit - it would be nice to add a test where get_random_string is patched and the patched value is returned, rather than passing hard-coded id.

@kevinhongzl kevinhongzl force-pushed the add-config-setting-to-control-exposing-stacktraces branch from 07e90a0 to 6452ef5 Compare June 9, 2025 15:22
@kevinhongzl
Copy link
Contributor Author

I removed exc_id from the exception handler for it was introduced to pass the mocked id into the tests. Since get_random_string is now patched, the arg is no longer needed.

@kevinhongzl kevinhongzl force-pushed the add-config-setting-to-control-exposing-stacktraces branch from 6452ef5 to 4864e00 Compare June 9, 2025 17:09
@kevinhongzl kevinhongzl force-pushed the add-config-setting-to-control-exposing-stacktraces branch from 8c5bf54 to 51d59bb Compare June 10, 2025 13:36
@potiuk potiuk merged commit c4cd58c into apache:main Jun 10, 2025
96 checks passed
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.

Nice, thanks

@pierrejeambrun pierrejeambrun added this to the Airflow 3.0.3 milestone Jun 10, 2025
pierrejeambrun pushed a commit to astronomer/airflow that referenced this pull request Jun 11, 2025
* feat: add a config setting to expose stacktraces

* fix: remove the starting newline to simplify the traceback info

* test: update tests to align with the config change

* feat: add exception id for better correlation between ui messages and log entries

* test: update tests

* fix: use random string as exception id instead of python object id

* fix: update tests with patched random strings

* test: use patch fixtures in tests to prevent side effects

(cherry picked from commit c4cd58c)
@pierrejeambrun
Copy link
Member

Manual backport #51617

pierrejeambrun added a commit that referenced this pull request Jun 11, 2025
* feat: add a config setting to expose stacktraces

* fix: remove the starting newline to simplify the traceback info

* test: update tests to align with the config change

* feat: add exception id for better correlation between ui messages and log entries

* test: update tests

* fix: use random string as exception id instead of python object id

* fix: update tests with patched random strings

* test: use patch fixtures in tests to prevent side effects

(cherry picked from commit c4cd58c)

Co-authored-by: Zhen-Lun (Kevin) Hong <zhenlun.hong01@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API area:ConfigTemplates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API - Config setting to control exposing stacktraces

4 participants