newrelic/newrelic-python-agent

Update NewRelicContextFormatter to support including stack traces

Closed this issue · 2 comments

Feature Description

NewRelicContextFormatter is in place as an option to manually decorate logs. However, there is no support for adding stack traces to the logs. This would be convenient to have and is a blocker for us using NewRelicContextFormatter at the moment.

Proposal: See #1168 -- adding stack_trace_limit as a parameter to the NewRelicContextFormatter constructor would be a good option. If defaulted to 0, this could be an opt-in setting. If it's None or > 0, the result would be a key:value pair for the stack trace being added to the log data. If set to None, all frames would be included in the resulting log data.

Priority

Nice to Have -- there are other options to manually instrument logging with New Relic metadata, but this would be a nice option that would be supported with the core lib.

#1168 was submitted to add support for stack traces