Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Report Rails app performance metrics (response time, error rate, throughput, etc) via the DogStatsD client

License

Notifications You must be signed in to change notification settings

scoutapp/scout_dogstatsd_ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ScoutDogstatsd

Build Status

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:

screen

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.

Metrics

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

Tags

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.

Monitoring Platforms that Support the DogStatsD Protocol

Installation

Add this line to your application's Gemfile:

gem 'scout_dogstatsd'

And then execute:

$ bundle

Or install it yourself as:

$ gem install scout_dogstatsd

Configuration

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.

How it works

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!

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/scoutapp/scout_dogstatsd_ruby.

License

The gem is available as open source under the terms of the MIT License.

About

Report Rails app performance metrics (response time, error rate, throughput, etc) via the DogStatsD client

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published