Enabling and disabling attributes (.NET)

This document describes the rules New Relic uses to determine which attributes to include or exclude for a destination. This also includes a summary of the .NET agent properties that were deprecated with the release of New Relic agent attributes in versions 3.6.177.0 or higher.

Attribute rules

New Relic follows these rules to determine which attributes to include or exclude:

Root level takes precedence for enabled.

The attributes.enabled field overrides all other settings. When false, no attributes will be reported to New Relic.

Example configuration:

<attributes enabled="false">
  <include>foo</include>
  <include>bar</include>
</attributes>
<transactionTracer enabled="true">
  <attributes enabled="true"/>
</transactionTracer>

Example output:

Keys passed in: foo, bar, bat
Keys included for all destinations:
Keys excluded for all destinations: foo, bar, bat
Destination enabled takes precedence over include and exclude.

The {destination}.attributes.enabled flags take precedence over include and exclude keys.

Example configuration:

<attributes enabled="true">
  <include>one</include>
  <include>two</include>
</attributes>
<transactionTracer enabled="true">
  <attributes enabled="false">
    <include>three</include>
    <include>four</include>
  </attributes>
</transactionTracer>

Example output:

Keys passed in: one, two, three, four
Keys included for transaction traces:
Keys excluded for transaction traces: one, two, three, four
Attribute is included if the destination is enabled.

If a destination is enabled, all user attributes are sent to that destination by default.

All user attributes default to true. However, by default, request attributes and message parameters are disabled for all destinations.

Example configuration:

<attributes enabled="true">
  <exclude>myAttKey</exclude>
</attributes>

Example output:

Keys passed in: foo, bar, myAttKey
Keys included: foo, bar
Keys excluded: myAttKey
Exclude always supersedes include.

If the same key is listed in the include and exclude lists, then attributes with the specified key will be excluded.

Example configuration:

<attributes enabled="true">
  <include>foo</include>
  <include>myCustomAtt</include>
  <exclude>password</exclude>
  <exclude>myCustomAtt</exclude>
</attributes>

Example output:

Keys passed in: foo, myCustomAtt, password
Keys included: foo
Keys excluded: password, myCustomAtt
Keys are case sensitive.

Keys are case sensitive.

Example configuration:

<attributes enabled="true">
  <exclude>password</exclude>
  <exclude>PaSsWoRd</exclude>
</attributes>

Example output:

Keys passed in: password, Password, PASSWORD, PaSsWoRd, PassWORD
Keys included: Password, PASSWORD, PassWORD
Keys excluded: password, PaSsWoRd
Use an asterisk * for wildcards.

You can use an asterisk * at the end of a key as a wildcard. This will match all attributes with the same prefix.

Example configuration:

<attributes enabled="true">
  <include>custom*</include>
  <exclude>request.parameters.*</exclude>
</attributes>

Example output:

Keys passed in: custom, custom.key1, custom.key2, request.parameters., request.parameters.foo, request.parameters.bar
Keys included: custom, custom.key1, custom.key2
Keys excluded: request.parameters., request.parameters.foo, request.parameters.bar
Most specific setting for a key takes priority.

If multiple include or exclude attributes affect the same key, the most specific setting will have priority.

Example configuration:

<attributes enabled="true">
  <include>request.parameters.foo</include>
  <exclude>request.parameters.*</exclude>
</attributes>

Example output:

Keys passed in: request.parameters., request.parameters.foo, request.parameters.bar
Keys included: request.parameters.foo
Keys excluded: request.parameters., request.parameters.bar
Include or exclude affects the specific destination.

If the attribute include or exclude is specified on a destination, then it only impacts that destination.

Example configuration:

<attributes enabled="true">
  <include>foo</include>
</attributes>
<transactionEvents enabled="true">
  <attributes enabled=”true”>
    <exclude>foo</exclude>
</transactionEvents>

Example output:

Keys passed in: foo
Keys included for transaction events: 
Keys included for other destinations: foo
Keys excluded for transaction events: foo

Deprecated properties

The following properties have been deprecated. While attributes using these properties will continue to be collected accurately, New Relic recommends switching to the new attributes configuration for these properties when upgrading your .NET agent.

analyticsEvents replaced by transactionEvents

The analyticsEvents element in newrelic.config has been deprecated. Enable the transactionEvents element in newrelic.config:

<transactionEvents enabled="true"/>
requestParameters replaced by request.parameters.*

By default, request parameters are not sent to New Relic. Add request.parameters.* to the attributes.include list to enable request parameter collection.

<attributes>
  <include>request.parameters.*</include>
</attributes>
parameterGroups: enable and ignore replaced by attributes true, include and exclude

The parameterGroups value and its enabled and ignore settings are deprecated. By default, customParameters and responseHeaderParameters are instrumented, while serviceRequestParameters are not instrumented. To customize these settings:

  • Use the enabled flag to enable instrumentation.
  • Use include and exclude to toggle instrumentation for specific attributes.

For example:

<attributes enabled="true">
  <include>service.request.*</include>
  <exclude>response.headers.*</exclude>
  <exclude>myCustomApiKey.*</exclude>
</attributes>

For more information on configuring attributes, see the attributes examples.

captureAttributes flag replaced by attributes sub-elements

The capture attributes flag on browserMonitoring, transactionTracer, transactionEvents, and errorCollector has been deprecated. Instead, use the attributes sub-element to configure attribute settings for each of these destinations.

New property Example
browserMonitoring
<browserMonitoring enabled="true">
  <attributes enabled="false">
    <include>myKey.*</include>
    <exclude>myKey.foo</exclude>
  </attributes>
</browserMonitoring>
transactionTracer
<transactionTracer enabled="true">
  <attributes enabled="false">
    <include>myKey.*</include>
    <exclude>myKey.foo</exclude>
  </attributes>
</transactionTracer>
transactionEvents
<transactionEvents enabled="true">
  <attributes enabled="false">
    <include>myKey.*</include>
    <exclude>myKey.foo</exclude>
  </attributes>
</transactionEvents>
errorCollector
<errorCollector enabled="true">
  <attributes enabled="false">
    <include>myKey.*</include>
    <exclude>myKey.foo</exclude>
  </attributes>
</errorCollector>>

For more help

Additional documentation resources include:

Join the discussion about .NET monitoring in the New Relic Online Technical Community! The Technical Community is a public platform to discuss and troubleshoot your New Relic toolset.

If you need additional help, get support at support.newrelic.com.