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.

For a task-based overview of the API, see Guide to using the .NET agent API.

GetAgent
Get access to the Agent via the IAgent interface.
IAgent
Provides access to Agent artifacts and methods, such as the currently executing transaction.
ITransaction
Provides access to transaction-specific methods in the New Relic API.
IDistributedTracePayload
Provides access to Distributed Trace payload.
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.
SetTransactionUri
Sets the URI 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.