---
title: Ruby attribute examples
source: https://docs.newrelic.com/docs/apm/agents/ruby-agent/attributes/ruby-attribute-examples
---

This document shows examples of how to configure attribute collection with the New Relic Ruby agent. For a list of all Ruby agent config settings for attributes, see [Ruby agent configuration: Attributes](https://docs.newrelic.com/docs/apm/agents/ruby-agent/configuration/ruby-agent-configuration/#attributes).

## Capture request parameters [#ex_req_params]

Capturing request parameters is not enabled by default. The following configuration will turn on parameter capture for the default destinations: `transaction_tracer`, `transaction_events`, and `error_collector`. To limit the destinations see the [Selecting specific destinations example](#ex_select_dest).

**Configuration:**

```yml
attributes.include: request.parameters.*
```

Request parameters are prefixed with the string `request.parameters`, and nested parameters have keys to reflect that nesting. For example, a user with a location attribute nested below a profile would have a key of`request.parameters.user.profile.location`.

Similarly, attributes that are members of collections will have keys with indices that reflect the membership. If a user had multiple phone numbers, keys would appear as follows: `request.parameters.phone_numbers.0`, `request.parameters.phone_numbers.1`, etc.

## Exclude sensitive data while capturing request parameters [#ex_req_params_exclude]

There may be situations where you would like to omit sensitive information from request parameters, such as passwords or credit card numbers. The following configuration will accomplish that:

**Configuration**:

```yml
attributes.include: request.parameters.*
attributes.exclude: [request.parameters.password, request.parameters.credit_card_no]
```

## Capture only specific request parameters [#ex_req_params_capture_specific]

To capture only specific request parameters, you can simply pass a list to `attributes.include`:

**Configuration**:

```yml
attributes.include: [request.parameters.user_id, request.parameters.shard_id]
```

## Capture Resque job arguments [#ex_resque_args]

By default Resque job arguments are not captured. To enable this functionality use the configuration below.

```yml
attributes.include: job.resque.args.*
```

**Note:**

Arguments to Resque jobs are positional and the keys generated reflect this. For example a job that takes two arguments will have keys `job.resque.args.0` and `job.resque.args.1`

## Capture Sidekiq job arguments [#ex_sidekiq_args]

By default Sidekiq job arguments are not captured. To enable this functionality use the configuration below.

```yml
attributes.include: job.sidekiq.args.*
```

**Note:**

Arguments to Sidekiq jobs are positional and the keys generated reflect this. For example a job that takes two arguments will have keys `job.sidekiq.args.0` and `job.sidekiq.args.1`

## Disabling all attributes [#ex_disable_all]

In this example, attributes are disabled, so the include and exclude lists will be ignored and all attributes will be filtered out.

**Configuration:**

```yml
attributes.enabled: false
attributes.include: request.parameters.*
```

**Input keys:**

```
foo, bar, request.parameters.foo, request.parameters.bar
```

**Output for destinations:**

-   transaction_tracer: none
-   error_collector: none
-   transaction_events: none
-   browser_monitoring: none

## Selecting specific destinations [#ex_select_dest]

In this example:

-   Attributes are disabled for transaction traces. The include and exclude lists will be ignored, and all attributes will be filtered out for this destination.
-   Attributes are also disabled for browser monitoring by default.
-   Request parameters (prefixed with `request.parameters.`) are off by default for all destinations.

As a result, only `bar` is sent in traced errors and transaction events.

**Configuration:**

```yml
attributes.enabled: true
transaction_tracer.attributes.enabled: false
attributes.exclude: foo
```

**Input keys:**

```
foo, bar, request.parameters.foo, request.parameters.bar
```

**Output for destinations:**

-   transaction_tracer: none
-   error_collector: bar
-   transaction_events: bar
-   browser_monitoring: none

## Selecting values and destinations [#example3]

In this example, specific input keys are selected for certain output destinations and excluded from others.

-   The `food.fruit.banana` key will be excluded only from transaction traces.
-   The `food` and `food.vegetable` keys will be excluded from all destinations.

**Configuration:**

```yml
browser_monitoring.attributes.enabled: true
attributes.exclude: food*
attributes.include: food.fruit.*
transaction_tracer.attributes.exclude: food.fruit.banana
```

**Input keys:**

```
food, food.vegetable, food.fruit.apple, food.fruit.banana
```

**Output for destinations:**

-   transaction_tracer: food.fruit.apple
-   error_collector: food.fruit.apple, food.fruit.banana
-   transaction_events: food.fruit.apple, food.fruit.banana
-   browser_monitoring: food.fruit.apple, food.fruit.banana
