SetTransactionName

NewRelic.Api.Agent.NewRelic.SetTransactionName(string $category, string $name)
Sets the name of the current transaction.

Requirements

Compatible with all agent versions.

Must be called inside a transaction.

Description

Sets the name of the current transaction. Before you use this call, ensure you understand the implications of metric grouping issues.

If you use this call multiple times within the same transaction, each call overwrites the previous call and the last call sets the name.

Do not use brackets [suffix] at the end of your transaction name. New Relic automatically strips brackets from the name. Instead, use parentheses (suffix) or other symbols if needed.

Unique values like URLs, page titles, hex values, session IDs, and uniquely identifiable values should not be used in naming your transactions. Instead, add that data to the transaction as a custom parameter with the AddCustomParameter() call.

Do not create more than 1000 unique transaction names (for example, avoid naming by URL if possible). This will make your charts less useful, and you may run into limits New Relic sets on the number of unique transaction names per account. It also can slow down the performance of your application.

Parameters

Parameter Description

$category

string

Required. The category of this transaction, which you can use to distinguish different types of transactions. Defaults to Custom. Only the first 255 characters are retained.

$name

string

Required. The name of the transaction. Only the first 255 characters are retained.

Example(s)

NewRelic.Api.Agent.NewRelic.SetTransactionName("Other", "MyTransaction");

For more help

Recommendations for learning more: