This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
The following commit(s) were added to refs/heads/master by this push:
new 8ba744613 New Relic: keep original transaction name if 500 error page
is used
8ba744613 is described below
commit 8ba74461312bed4411965ac3a498492580945c37
Author: Dave Brondsema <[email protected]>
AuthorDate: Wed Apr 6 12:02:15 2022 -0400
New Relic: keep original transaction name if 500 error page is used
---
Allura/allura/lib/patches.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/Allura/allura/lib/patches.py b/Allura/allura/lib/patches.py
index 876a3c065..7c6e416eb 100644
--- a/Allura/allura/lib/patches.py
+++ b/Allura/allura/lib/patches.py
@@ -115,8 +115,11 @@ def newrelic():
'''Set NewRelic transaction name to actual controller name'''
__traceback_hide__ = 'before_and_this' # for paste/werkzeug shorter
traces
import newrelic.agent
- newrelic.agent.set_transaction_name(
- newrelic.agent.callable_name(controller))
+ controller_name = newrelic.agent.callable_name(controller)
+ #
https://docs.newrelic.com/docs/apm/agents/python-agent/python-agent-api/settransactionname-python-agent-api/
+ # if a second internal request for /error/document happens, use a
lower (1) priority so original name stays
+ name_priority = 1 if 'ErrorController' in controller_name else 2
+ newrelic.agent.set_transaction_name(controller_name,
priority=name_priority)
return old_controller_call(self, controller, *args, **kwargs)
import newrelic.api.error_trace