• /
  • Log in

.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 browser monitoring.

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

DisableBrowserMonitoring (.NET agent API)

Disable automatic injection of browser monitoring snippet on specific pages.

GetAgent

Get access to the Agent via the IAgent interface.

GetBrowserTimingHeader (.NET agent API)

Generate a browser monitoring HTML snippet to instrument end-user browsers.

GetLinkingMetadata (.NET agent API)

Returns key/value pairs which can be used to link traces or entities.

IAgent

Provides access to Agent artifacts and methods, such as the currently executing transaction.

ISpan

Provides access to span-specific methods in the New Relic API.

ITransaction

Provides access to transaction-specific methods in the New Relic API.

IgnoreApdex (.NET agent API)

Ignore the current transaction when calculating Apdex.

IgnoreTransaction (.NET agent API)

Do not instrument the current transaction.

IncrementCounter (.NET agent API)

Increment the counter for a custom metric by 1.

NoticeError (.NET agent API)

Notice an error and report to New Relic, along with optional custom attributes.

RecordCustomEvent (.NET agent API)

Records a custom event with the given name and attributes.

RecordMetric (.NET agent API)

Records a custom metric with the given name.

RecordResponseTimeMetric (.NET agent API)

Records a custom metric with the given name and response time in milliseconds.

SetApplicationName (.NET agent API)

Set the app name for data rollup.

SetTransactionName (.NET agent API)

Sets the name of the current transaction.

SetTransactionUri (.NET agent API)

Sets the URI of the current transaction.

SetUserParameters (.NET agent)

Create user-related custom attributes. AddCustomAttribute() is more flexible.

StartAgent (.NET agent API)

Start the agent if it hasn't already started. Usually unnecessary.

TraceMetadata (.NET agent API)

Returns properties in the current execution environment used to support tracing.

Create issueEdit page
Copyright © 2021 New Relic Inc.