Syntax
newrelic.agent.set_transaction_name(name, group=None, priority=None)
Sets the name of the current transaction.
Description
This call sets the name of the current transaction.
Here's an example showing one way to implement the name
and group
parameters:
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).
Parameters
Parameter | Description |
---|---|
string | Required. Desired name for the current transaction. See the description for an example of setting the name. |
string | Optional. The 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 |
int | Optional. The priority value is used to determine what name is given to a transaction. Higher numbers override lower numbers. The default value is
|
Return values
None.
Examples
Using name and group parameters
An example showing one way to implement the name
and group
parameters:
name = '%s/%s' % (controller, function) group = 'Python/WebFramework/Controller'
newrelic.agent.set_transaction_name(name, group)
Setting name using current_transaction
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)