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

Render stacktraces properly #47965

Merged
merged 6 commits into from
Mar 26, 2025
Merged

Render stacktraces properly #47965

merged 6 commits into from
Mar 26, 2025

Conversation

aritra24
Copy link
Collaborator

Closes: #47921


^ 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 newsfragments.

@boring-cyborg boring-cyborg bot added the area:UI Related to UI/UX. For Frontend Developers. label Mar 19, 2025
@aritra24
Copy link
Collaborator Author

Screenshot 2025-03-19 at 10 48 55 PM First pass at fixing the stacktraces in logs, still need to make it prettier. So any recommendations are welcome...

@aritra24
Copy link
Collaborator Author

for context this is the error at hand

{
            "timestamp": "2025-03-19T15:00:52.088368Z",
            "event": "Task failed with exception",
            "level": "error",
            "logger": "task",
            "error_detail": [
                {
                    "exc_type": "ZeroDivisionError",
                    "exc_value": "division by zero",
                    "exc_notes": [],
                    "syntax_error": null,
                    "is_cause": false,
                    "frames": [
                        {
                            "filename": "/opt/airflow/task-sdk/src/airflow/sdk/execution_time/task_runner.py",
                            "lineno": 582,
                            "name": "run"
                        },
                        {
                            "filename": "/opt/airflow/task-sdk/src/airflow/sdk/execution_time/task_runner.py",
                            "lineno": 718,
                            "name": "_execute_task"
                        },
                        {
                            "filename": "/opt/airflow/task-sdk/src/airflow/sdk/definitions/baseoperator.py",
                            "lineno": 373,
                            "name": "wrapper"
                        },
                        {
                            "filename": "/opt/airflow/airflow/decorators/base.py",
                            "lineno": 252,
                            "name": "execute"
                        },
                        {
                            "filename": "/opt/airflow/task-sdk/src/airflow/sdk/definitions/baseoperator.py",
                            "lineno": 373,
                            "name": "wrapper"
                        },
                        {
                            "filename": "/opt/airflow/providers/standard/src/airflow/providers/standard/operators/python.py",
                            "lineno": 202,
                            "name": "execute"
                        },
                        {
                            "filename": "/opt/airflow/providers/standard/src/airflow/providers/standard/operators/python.py",
                            "lineno": 226,
                            "name": "execute_callable"
                        },
                        {
                            "filename": "/opt/airflow/airflow/utils/operator_helpers.py",
                            "lineno": 262,
                            "name": "run"
                        },
                        {
                            "filename": "/files/dags/sample_dag2.py",
                            "lineno": 17,
                            "name": "error"
                        }
                    ]
                }
            ]
        },

@ashb
Copy link
Member

ashb commented Mar 20, 2025

Display looks nice, but the indentation of display needs a bit of work.

Thanks for picking this up.

@bbovenzi
Copy link
Contributor

+1 on indentation.

Copy link
Contributor

@bbovenzi bbovenzi left a comment

Choose a reason for hiding this comment

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

Jens' suggestion looks like the right UX. Let's just rebase

@aritra24 aritra24 marked this pull request as ready for review March 21, 2025 16:54
@bbovenzi
Copy link
Contributor

Mind updating the Logs.test.tsx? We should probably add a new test for this stacktrace change

@aritra24
Copy link
Collaborator Author

Yup, trying to get my dev setup working again. Will get fixing once I manage to get that done 🥲

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 addition 🎉

Just a couple of nits, non blocking

Fixed the UT which was failing due to a
mistaken id, and removed the usage of the
quotes as escaped characters and usage of delete
@aritra24
Copy link
Collaborator Author

@pierrejeambrun / @bbovenzi all review comments should now be resolved. Could you take another look?

Co-authored-by: Jens Scheffler <[email protected]>
@pierrejeambrun
Copy link
Member

@aritra24 You marked #47965 (comment) as resolved but I still see the statement. Did you push your latest change ?

@aritra24
Copy link
Collaborator Author

Huh, I was sure I deleted it... 🤔 perhaps some commit of mine brought it back. Let me remove it once more...

@pierrejeambrun
Copy link
Member

pierrejeambrun commented Mar 26, 2025

It's ok I just pushed it, we can merge when CI is green, thanks

@aritra24
Copy link
Collaborator Author

Thanks!

@pierrejeambrun pierrejeambrun merged commit 60c7db4 into apache:main Mar 26, 2025
34 checks passed
@aritra24 aritra24 deleted the fix_logging branch March 26, 2025 17:00
pankajkoti pushed a commit to astronomer/airflow that referenced this pull request Mar 28, 2025
* Render stacktraces properly
Closes: apache#47921

* Update airflow/ui/src/components/RenderStructuredLog.tsx

Co-authored-by: Jens Scheffler <[email protected]>

* Fixes ut, resolves comments

Fixed the UT which was failing due to a
mistaken id, and removed the usage of the
quotes as escaped characters and usage of delete

* Remove unsed import

Co-authored-by: Jens Scheffler <[email protected]>

* Remove delete statement

---------

Co-authored-by: Jens Scheffler <[email protected]>
Co-authored-by: pierrejeambrun <[email protected]>
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

stacktrace is not formatted in the logs in UI
5 participants