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

Support for Chained Exception Tracebacks #496

Open
fliu98 opened this issue Mar 7, 2022 · 2 comments
Open

Support for Chained Exception Tracebacks #496

fliu98 opened this issue Mar 7, 2022 · 2 comments

Comments

@fliu98
Copy link

fliu98 commented Mar 7, 2022

Is your feature request related to a problem? Please describe.

Being able to see the tracebacks for chained exceptions as a part of the stack trace in the NewRelic Errors UI is helpful for debugging issues in our code.

Currently, only the traceback for the most recent exception is considered when building error nodes. The traceback is extracted from sys.exc_info() in _observe_exception(...), then formatted by this call to exception_stack(...).

Feature Description

Ideally, exception_stack(...) should take in the value of the exception, then read and format the traceback from its __traceback__ attribute, concatenating it to the end of the formatted current stack. Additionally, it should follow the exception chain using the __context__ or __cause__ attribute on the exception while concatenating the formatted traceback of each exception along the way.

Describe Alternatives

Looking for suggestions.

Additional context

Here's a short example:

# foo.py

import newrelic.agent

def c():
    raise Exception("c")


def d():
    try:
        c()
    except Exception as e:
        raise Exception("d") from e


try:
    d()
except:
    newrelic.agent.notice_error()

Should report something like:

Traceback (most recent call last):
File "foo.py", line 17, in <module>
File "foo.py", line 13, in d
caused by: Exception('c')
Traceback (most recent call last):
File "foo.py", line 11, in d
File "foo.py", line 6, in c

Priority

Really Want

@stale
Copy link

stale bot commented Jun 13, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 13, 2022
@stale stale bot removed the stale label Dec 19, 2022
@stale
Copy link

stale bot commented Mar 18, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants