newrelic-python-agent icon indicating copy to clipboard operation
newrelic-python-agent copied to clipboard

Update NewRelicContextFormatter to support including stack traces

Open fritzdj opened this issue 1 year ago • 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 https://github.com/newrelic/newrelic-python-agent/pull/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.

fritzdj avatar Jun 25 '24 13:06 fritzdj

https://new-relic.atlassian.net/browse/NR-284472

https://github.com/newrelic/newrelic-python-agent/pull/1168 was submitted to add support for stack traces

fritzdj avatar Jun 25 '24 13:06 fritzdj