Repository navigation
Show source code lines in task log tracebacks - #75100
Merged
Merged
Conversation
souradeep07
requested review from
amoghrajesh,
ashb,
bbovenzi,
choo121600,
guan404ming,
pierrejeambrun,
potiuk,
ryanahamilton,
shubhamraj-git and
vatsrahul1001
as code owners
October 19, 2026 14:09
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
1 of 2 tasks
structlog's ExceptionDictTransformer only records each frame's filename, line number and function name, so tracebacks in task logs (which are always written as JSON) no longer showed the line of code that was running. Add it via linecache, as the stdlib traceback module does, and show it under each frame in the UI log view. closes: apache#55910
souradeep07
force-pushed
the
fix-exception-source-lines
branch
from
October 19, 2026 14:21
9abff04 to
ef7556c
Compare
bbovenzi
approved these changes
Oct 21, 2026
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
Contributor
Backport successfully created: v3-4-testNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
|
bbovenzi
pushed a commit
that referenced
this pull request
Oct 22, 2026
…75355) structlog's ExceptionDictTransformer only records each frame's filename, line number and function name, so tracebacks in task logs (which are always written as JSON) no longer showed the line of code that was running. Add it via linecache, as the stdlib traceback module does, and show it under each frame in the UI log view. (cherry picked from commit 79d3afc) closes: #55910 Co-authored-by: Souradeep Biswas <30365437+souradeep07@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tracebacks in task logs show each frame's file, line number and function, but not the line of code that was running, unlike Airflow 2 or a plain Python traceback.
Task logs are always written as JSON, and structlog's
ExceptionDictTransformerdoesn't record source code for frames. This adds each frame's source line (vialinecache, as the stdlibtracebackmodule does) and shows it under the frame in the UI log view and in downloaded/copied logs.closes: #55910
Before
After
Performance
JSON logging, median of 7 runs:
The extra cost is only paid when an exception is logged.