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
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 toexception_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:
Should report something like:
Priority
Really Want