Ruby Configuration

Ruby Configuration

How do I configure Scout APM for Ruby?

Scout can be configured via: - A config/scout_apm.yml YAML file - Environment variables (which override yaml settings)

For Heroku, use environment variables. For other deployments, either approach works.

What are the required configuration settings?

Setting Description
name Your application name (e.g., “Photos App”)
key Your organization API key from the Scout UI
monitor Set to true to enable monitoring

How do I configure Scout using environment variables?

Uppercase the config key and prefix with SCOUT_. For example:

exportSCOUT_KEY=your_key_hereexportSCOUT_NAME="My Application"exportSCOUT_MONITOR=true

Can I use ERB in the config file?

Yes. ERB is evaluated when loading the config file. For example:

common:&defaults  name: <%= "ProjectPlanner.io (#{Rails.env})" %>

How do I configure different environments separately?

Set unique app names per environment to keep data separate:

common:&defaults  name: <%= "YOUR_APP_NAME (#{Rails.env})" %>key: YOUR_KEYmonitor:trueproduction:<<:*defaultsdevelopment:<<:*defaultsmonitor:falsestaging:<<:*defaults

Or use environment variables: SCOUT_NAME="My App (Staging)"

How do I ignore certain endpoints?

Use the ignore configuration option to exclude endpoints by path prefix:

ignore:['/health','/status']

How do I disable Scout on a specific server?

Set monitor: false in the configuration for that server. You can also use ERB to programmatically enable/disable based on hostname:

monitor: <%= Socket.gethostname.match(/web[1..5]/) %>

What are the logging options?

What is the detailed_middleware option?

By default, Scout aggregates all middleware timings into a single “Middleware” category. Setting detailed_middleware: true shows time spent in each individual middleware. This adds overhead and is disabled by default since middleware is rarely a bottleneck.