Ruby agent attributes

Attributes are key-value pairs containing information that determines the properties of an event or transaction. These key-value pairs can be viewed within transaction traces in New Relic APM, traced errors in New Relic APM, transaction events in Insights, and page views in Insights. You can customize exactly which attributes will be sent to each of these destinations.

These attribute settings apply to version 3.12.0 or higher of the Ruby agent.

Ruby agent attributes

The following table lists the attributes that can be automatically captured by the Ruby agent:

httpResponseCode

The response status code for a web request. Defaults:

  • Transaction traces: Enabled
  • Error collector (traced errors): Enabled
  • Transaction events: Enabled
  • Page views (browser monitoring): Unavailable
request.headers.referer

The HTTP referrer header if present (minus the query string). Defaults:

  • Transaction traces: Disabled
  • Error collector (traced errors): Enabled
  • Transaction events: Disabled
  • Page views (browser monitoring): Unavailable
request.parameters.*

The HTTP request parameters, associated with the transaction. Available for Rails, Sinatra, and Grape applications only. Defaults:

  • Transaction traces: Disabled
  • Error collector (traced errors): Disabled
  • Transaction events: Disabled
  • Page views (browser monitoring): Disabled

Note: The capture_params property is deprecated. However, if set to true, it will enable request parameters for transaction traces and traced errors.

job.resque.args.*

Job arguments passed to the Resque worker. Arguments passed to Resque workers are positional. These arguments are stored as keys of the form job.resque.args.<position> where position is the index of the argument to the perform method. For example, a Resque job that takes two arguments will have keys job.resque.args.0 and job.resque.args.1. Defaults:

  • Transaction traces: Disabled
  • Error collector (traced errors): Disabled
  • Transaction events: Disabled
  • Page views (browser monitoring): Unavailable

Note: The resque.capture_params property is deprecated. However, if set to true, it will enable capture of Resque arguments for transaction traces, traced errors.

job.sidekiq.args.*

Job arguments passed to the Sidekiq worker. Arguments passed to Sidekiq workers are positional. These arguments are stored as keys of the form job.sidekiq.args.<position> where position is the index of the argument to the perform method. For example, a Sidekiq job that takes two arguments will have keys job.sidekiq.args.0 and job.sidekiq.args.1. Defaults:

  • Transaction traces: Disabled
  • Error collector (traced errors): Disabled
  • Transaction events: Disabled
  • Page views (browser monitoring): Unavailable

Note: The sidekiq.capture_params property is deprecated. However, if set to true, it will enable capture of Sidekiq arguments for transaction traces and traced errors.

Adding custom attributes

To capture additional custom attributes from your application, use NewRelic::Agent.add_custom_attributes. For full reference see Collecting custom attributes. Defaults:

  • Transaction traces: Enabled
  • Error collector (traced errors): Enabled
  • Transaction events: Enabled
  • Page views (browser monitoring): Disabled

If you want to use your custom parameters or attributes in Insights, avoid using any of the reserved terms used by NRQL and Insights for naming them.

Upgrading the Ruby agent

When upgrading to Ruby agent 3.12.0 or higher, upgrade your newrelic.yml configuration.

For more help

Additional documentation resources include:

Join the discussion about Ruby 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.