---
title: Enable and disable attributes (Ruby)
source: https://docs.newrelic.com/docs/apm/agents/ruby-agent/attributes/enable-disable-attributes-ruby
---

This describes the properties to enable or disable [attributes](https://docs.newrelic.com/docs/apm/agents/ruby-agent/attributes/ruby-agent-attributes), and the rules that New Relic uses when determining which attributes to include or exclude for a [destination](https://docs.newrelic.com/docs/agents/manage-apm-agents/agent-data/agent-attributes#destinations). This also includes a summary of the Ruby agent properties that have been deprecated or removed with the release of New Relic agent attributes.

## Properties

Use the following properties to enable or disable attributes:

**attributes.enabled**

| Type             | Boolean                        |
| ---------------- | ------------------------------ |
| Default          | `true`                         |
| Environ variable | `NEW_RELIC_ATTRIBUTES_ENABLED` |

If `true`, enables capture of attributes for all destinations.

**transaction_tracer.attributes.enabled**

| Type             | Boolean                                           |
| ---------------- | ------------------------------------------------- |
| Default          | (Dynamic)                                         |
| Environ variable | `NEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_ENABLED` |

If `true`, the agent captures attributes from transaction traces.

**transaction_events.attributes.enabled**

| Type             | Boolean                                           |
| ---------------- | ------------------------------------------------- |
| Default          | (Dynamic)                                         |
| Environ variable | `NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_ENABLED` |

If `true`, the agent captures attributes from transaction events.

**error_collector.attributes.enabled**

| Type             | Boolean                                        |
| ---------------- | ---------------------------------------------- |
| Default          | (Dynamic)                                      |
| Environ variable | `NEW_RELIC_ERROR_COLLECTOR_ATTRIBUTES_ENABLED` |

If `true`, the agent captures attributes from error collection.

**browser_monitoring.attributes.enabled**

| Type             | Boolean                                           |
| ---------------- | ------------------------------------------------- |
| Default          | (Dynamic)                                         |
| Environ variable | `NEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_ENABLED` |

If `true`, the agent captures attributes from browser monitoring.

**span_events.attributes.enabled**

| Type             | Boolean                                    |
| ---------------- | ------------------------------------------ |
| Default          | (Dynamic)                                  |
| Environ variable | `NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_ENABLED` |

If `true`, the agent captures attributes on span events.

**transaction_segments.attributes.enabled**

| Type             | Boolean                                             |
| ---------------- | --------------------------------------------------- |
| Default          | (Dynamic)                                           |
| Environ variable | `NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_ENABLED` |

If `true`, the agent captures attributes on transaction segments.

**attributes.exclude**

| Type             | Array                          |
| ---------------- | ------------------------------ |
| Default          | `[]`                           |
| Environ variable | `NEW_RELIC_ATTRIBUTES_EXCLUDE` |

Prefix of attributes to exclude from all destinations. Allows `*` as wildcard at end.

**transaction_tracer.attributes.exclude**

| Type             | Array                                             |
| ---------------- | ------------------------------------------------- |
| Default          | `[]`                                              |
| Environ variable | `NEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_EXCLUDE` |

Prefix of attributes to exclude from transaction traces. Allows `*` as wildcard at end.

**transaction_events.attributes.exclude**

| Type             | Array                                             |
| ---------------- | ------------------------------------------------- |
| Default          | `[]`                                              |
| Environ variable | `NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_EXCLUDE` |

Prefix of attributes to exclude from transaction events. Allows `*` as wildcard at end.

**error_collector.attributes.exclude**

| Type             | Array                                          |
| ---------------- | ---------------------------------------------- |
| Default          | `[]`                                           |
| Environ variable | `NEW_RELIC_ERROR_COLLECTOR_ATTRIBUTES_EXCLUDE` |

Prefix of attributes to exclude from error collection. Allows `*` as wildcard at end.

To prevent [error.message](/attribute-dictionary?attribute_name=error.message) collection, instead use the [strip_exception_messages](https://docs.newrelic.com/docs/agents/ruby-agent/configuration/ruby-agent-configuration#strip_exception_messages-enabled) configuration.

**browser_monitoring.attributes.exclude**

| Type             | Array                                             |
| ---------------- | ------------------------------------------------- |
| Default          | `[]`                                              |
| Environ variable | `NEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_EXCLUDE` |

Prefix of attributes to exclude from browser monitoring. Allows `*` as wildcard at end.

**span_events.attributes.exclude**

| Type             | Array                                      |
| ---------------- | ------------------------------------------ |
| Default          | `[]`                                       |
| Environ variable | `NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_EXCLUDE` |

Prefix of attributes to exclude from span events. Allows `*` as wildcard at end.

**transaction_segments.attributes.exclude**

| Type             | Array                                               |
| ---------------- | --------------------------------------------------- |
| Default          | `[]`                                                |
| Environ variable | `NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_EXCLUDE` |

Prefix of attributes to exclude from transaction segments. Allows `*` as wildcard at end.

**attributes.include**

| Type             | Array                          |
| ---------------- | ------------------------------ |
| Default          | `[]`                           |
| Environ variable | `NEW_RELIC_ATTRIBUTES_INCLUDE` |

Prefix of attributes to include in all destinations. Allows `*` as wildcard at end.

**transaction_tracer.attributes.include**

| Type             | Array                                             |
| ---------------- | ------------------------------------------------- |
| Default          | `[]`                                              |
| Environ variable | `NEW_RELIC_TRANSACTION_TRACER_ATTRIBUTES_INCLUDE` |

Prefix of attributes to include in transaction traces. Allows `*` as wildcard at end.

**transaction_events.attributes.include**

| Type             | Array                                             |
| ---------------- | ------------------------------------------------- |
| Default          | `[]`                                              |
| Environ variable | `NEW_RELIC_TRANSACTION_EVENTS_ATTRIBUTES_INCLUDE` |

Prefix of attributes to include in transaction events. Allows `*` as wildcard at end.

**error_collector.attributes.include**

| Type             | Array                                          |
| ---------------- | ---------------------------------------------- |
| Default          | `[]`                                           |
| Environ variable | `NEW_RELIC_ERROR_COLLECTOR_ATTRIBUTES_INCLUDE` |

Prefix of attributes to include in error collection. Allows `*` as wildcard at end.

**browser_monitoring.attributes.include**

| Type             | Array                                             |
| ---------------- | ------------------------------------------------- |
| Default          | `[]`                                              |
| Environ variable | `NEW_RELIC_BROWSER_MONITORING_ATTRIBUTES_INCLUDE` |

Prefix of attributes to include in browser monitoring. Allows `*` as wildcard at end.

**span_events.attributes.include**

| Type             | Array                                      |
| ---------------- | ------------------------------------------ |
| Default          | `[]`                                       |
| Environ variable | `NEW_RELIC_SPAN_EVENTS_ATTRIBUTES_INCLUDE` |

Prefix of attributes to include in span events. Allows `*` as wildcard at end.

**transaction_segments.attributes.include**

| Type             | Array                                               |
| ---------------- | --------------------------------------------------- |
| Default          | `[]`                                                |
| Environ variable | `NEW_RELIC_TRANSACTION_SEGMENTS_ATTRIBUTES_INCLUDE` |

Prefix of attributes to include in transaction segments. Allows `*` as wildcard at end.

## Attribute rules [#attruls]

New Relic follows these rules when determining which attributes to include or exclude for a destination.

**Root level takes precedence for enabled.**

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

Example configuration:

````yml
attributes.enabled: false
    attributes.include: foo, bar
    transaction_tracer.attributes.enabled: true
```

Example output:

```
Keys passed in: foo, bar, baz
    Keys included for all destinations:
    Keys excluded for all destinations: foo, bar, baz
```

````

**Destination enabled takes precedence over include and exclude.**

The `YOUR_DESTINATION.attributes.enabled` flags take precedence over include and exclude keys.

Example configuration:

````yml
transaction_tracer.attributes.enabled: false
    attributes.include: one, two
    transaction_tracer.attributes.include: three, four
```

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.

**Note:** All user attributes default to `true`. However, by default, request parameters are disabled for all destinations.

Example configuration:

````yml
attributes.enabled: true
    attributes.exclude: baz
```

Example output:

```
Keys passed in: foo, bar, baz
    Keys included: foo, bar
    Keys excluded: baz
```

````

**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:

````yml
attributes.enabled: true
    attributes.include: foo, bar
    attributes.exclude: nerd, bar
```

Example output:

```
Keys passed in: foo, bar, nerd
    Keys included: foo
    Keys excluded: nerd, bar
```

````

**Keys are case sensitive.**

Keys are case-sensitive.

Example configuration:

````yml
attributes.enabled: true
    attributes.exclude: username, UsErNaMe
```

Example output:

```
Keys passed in: username, Username, USERNAME, UsErNaMe, userNAME
    Keys included: Username, USERNAME, userNAME
    Keys excluded: username, UsErNaMe
```

````

**Use `*` for wildcards.**

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

Example configuration:

````yml
attributes.enabled: true
    attributes.include: custom*
    attributes.exclude: request.parameters.*
```

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:

````yml
attributes.enabled: true
    attributes.include: request.parameters.foo
    attributes.exclude: request.parameters.*
```

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:

````yml
attributes.include: foo
    transaction_events.attributes.exclude: foo
```

Example output:

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

````

## URI-related properties [#uri]

By default, the Ruby agent reports Uniform Resource Identifiers (URIs) to New Relic in several different places, including the following destinations:

-   The `request.uri` attribute of [error events](https://docs.newrelic.com/docs/apm/applications-menu/error-analytics/error-analytics-manage-error-traces)
-   The `http.url` attribute of [span events](https://docs.newrelic.com/docs/apm/distributed-tracing/getting-started/introduction-distributed-tracing)
-   The `url` attribute of [slow SQL traces](https://docs.newrelic.com/docs/apm/applications-menu/monitoring/view-slow-query-details)
-   The `uri` attribute of [external request segments](https://docs.newrelic.com/docs/agents/ruby-agent/features/http-client-tracing-ruby)

New Relic recommends having these URIs reported, as they can contain useful debugging information. If your URIs contain sensitive data you don't want to report, such as email addresses or account IDs, you can disable URI reporting. To disable URI reporting, add any of the above attribute names to the `attributes.exclude` list.

For example, adding the following key to your configuration file will stop the agent from reporting any of the URI-related properties:

```yml
attributes.exclude: uri
```

## Deprecated and removed properties [#deprecated]

The following properties have been deprecated or removed. Switch to the new attributes configuration for these properties when upgrading your Ruby agent.

| **Deprecated property**                 | **New property**                           | **Removed Version** |
| --------------------------------------- | ------------------------------------------ | ------------------- |
| `capture_params`                        | `attributes.include: request.parameters.*` | N/A                 |
| `resque.capture_params`                 | `attributes.include: job.resque.args.*`    | 9.0.0               |
| `sidekiq.capture_params`                | `attributes.include: job.sidekiq.args.*`   | 9.0.0               |
| `transaction_tracer.capture_attributes` | `transaction_tracer.attributes.enabled`    | 9.0.0               |
| `error_collector.capture_attributes`    | `error_collector.attributes.enabled`       | 9.0.0               |
| `browser_monitoring.capture_attributes` | `browser_monitoring.attributes.enabled`    | 9.0.0               |
| `analytics_events.capture_attributes`   | `transaction_events.attributes.enabled`    | 9.0.0               |
