Want your Rails performance KPIs in your DogStatsD-compatible metric system with almost zero effort? Of course you do! Meet scout_dogstatsd
! This gem is an extension of the Scout Ruby monitoring agent (scout_apm
), and makes it easy to create an app performance dashboard:
A Scout account isn't required, but it certainly makes getting to the source of app performance easier 😉.
Using plain-vanilla StatsD? Checkout scout_statsd_ruby.
The following metrics are reported w/o any custom instrumentation steps:
Metric Name | Type | Description |
---|---|---|
web.duration_ms | histogram | The total duration of web requests in milliseconds |
job.duration_ms | histogram | The total duration of background jobs (Sidekiq, DelayedJob, etc.) in milliseconds |
web.error_count | counter | A count of web requests that throw an exception |
job.error_count | counter | A count of background jobs that throw an exception |
web.queue_time_ms | gauge | The time spent in request queuing in milliseconds |
job.queue_time_ms | gauge | The time between when a job is inserted into a background job queue and when execution begins in milliseconds |
These metrics are tagged too! Slice and dice! The following tags are added to each metric:
Tag Name | Description |
---|---|
app | The name of the app. See the name Scout config option. |
hostname | The hostname of the app. See the hostname Scout config option. |
Now, you can correlate app performance metrics with all of your other system metrics.
- DataDog
- SignalFx via the collectd dogstatsd plugin
- Prometheus via the statsd exporter
Add this line to your application's Gemfile:
gem 'scout_dogstatsd'
And then execute:
$ bundle
Or install it yourself as:
$ gem install scout_dogstatsd
1. Add a config/initializers/scout_dogstatsd.rb
file to your Rails app:
require 'datadog/statsd'
statsd = Datadog::Statsd.new('localhost', 8125)
ScoutDogstatsd.configure(statsd)
2. Add a config/scout_apm.yml
file to your Rails app:
This step isn't required if you are already using Scout.
common: &defaults
monitor: true
development:
<<: *defaults
monitor: false # set to true to test in your development environment
production:
<<: *defaults
Metrics are only sent if monitor: true
for the associated Rails environment.
See the Scout docs for advanced configuration instructions.
After each transaction (a web request or background job), the metrics specific to that transaction are transmitted via the DogStatsD protocol via the client passed through to ScoutDogstatsd#configure
. No code changes are required: the scout_apm
gem automatically instruments Rails controller-actions and background jobs. Easy peasy!
Bug reports and pull requests are welcome on GitHub at https://github.com/scoutapp/scout_dogstatsd_ruby.
The gem is available as open source under the terms of the MIT License.