NET Agent API

The .NET agent API allows you to extend the functionality of the .NET agent. To use the library, add a reference to NewRelic.Api.Agent.dll to your project. You can also view the package in the NuGet Gallery. If you've disabled or uninstalled the agent, invoking these API calls has no effect.

Among other things, you can use the API to customize your app name; collect errors; record custom attributes, custom events, and custom metrics; and enable or disable New Relic Browser.

AddCustomParameter
Attaches a custom attribute (a key/value pair) to the current transaction.
DisableBrowserMonitoring
Disable automatic injection of New Relic Browser snippet on specific pages.
GetBrowserTimingHeader
Generate a New Relic Browser HTML snippet to instrument end-user browsers.
IgnoreApdex
Ignore the current transaction when calculating Apdex.
IgnoreTransaction
Do not instrument the current transaction.
IncrementCounter
Increment the counter for a custom metric by 1.
NoticeError
Notice an error and report to New Relic, along with optional custom attributes.
RecordCustomEvent
Records a custom event with the given name and attributes.
RecordMetric
Records a custom metric with the given name.
RecordResponseTimeMetric
Records a custom metric with the given name and response time in milliseconds.
SetApplicationName
Set the app name for data rollup.
SetTransactionName
Sets the name of the current transaction.
SetUserParameters
Create user-related custom attributes. AddCustomParameter() is more flexible.
StartAgent
Start the agent if it hasn't already started. Usually unnecessary.