newrelic.agent.set_transaction_name(name, group=None, priority=None)
Sets the name of the current transaction.
This call sets the name of the current transaction.
Here's an example showing one way to implement the
name = '%s/%s' % (controller, function) group = 'Python/WebFramework/Controller'newrelic.agent.set_transaction_name(name, group)
The priority parameter can generally be ignored unless you are implementing custom instrumentation for a web framework where there may be multiple points where you want to set the name (such as middleware, view handlers, or error handlers).
Required. Desired name for the current transaction. See the description for an example of setting the name.
If not supplied, the group will default to the
The naming structure used for naming the transaction. As this value is rendered as part of a URL, non-ASCII encoding should be avoided. Defaults to
Optional. The priority value is used to determine what name is given to a transaction. Higher numbers override lower numbers. The default value is
An example showing one way to implement the
name = '%s/%s' % (controller, function)group = 'Python/WebFramework/Controller'newrelic.agent.set_transaction_name(name, group)
An example of using
current_transaction to set the current transaction name:
transaction = newrelic.agent.current_transaction()new_transaction_name = transaction.namenewrelic.agent.set_transaction_name(new_transaction_name)
If you need more help, check out these support and learning resources:
- Browse the Explorers Hub to get help from the community and join in discussions.
- Find answers on our sites and learn how to use our support portal.
- Run New Relic Diagnostics, our troubleshooting tool for Linux, Windows, and macOS.
- Review New Relic's data security and licenses documentation.