Network Performance Monitoring is now generally available! Network Monitoring is now available!


Library Library


The Ruby integration allows you to monitor custom metrics by adding a few lines of code to your Ruby application. For example, a metric that returns the number of page views or the time of any function call.


Datadog offers two libraries to assist you with the implementation of Ruby application metrics:

dogstatsd-rubyA client for DogStatsD, an extension of the StatsD metric server for Datadog.
dogapi-rbThe Ruby client is a library suitable for inclusion in existing Ruby projects or for development of standalone scripts. It provides an abstraction on top of Datadog’s raw HTTP interface for reporting events and metrics.


To install the Ruby client for the Datadog API:

gem install dogapi

To install the dogstatsd-ruby client for DogStatsD:

gem install dogstatsd-ruby

Metric collection

For the Ruby integration, all metrics are custom metrics. For information on collecting custom metrics see the:

Below is an example of instrumenting your code using the Datadog API:

require 'rubygems'
require 'dogapi'

api_key = "<YOUR_DD_API_KEY>"
application_key = "<YOUR_DD_APP_KEY>"

# Submitting events does not require the application key.
dog =

# Send a new event.
dog.emit_event('msg_text', :msg_title => 'Title'))

Below is an example of instrumenting your code using the DogStatsD client:

# Load the dogstats module.
require 'datadog/statsd'

# Create a stats instance.
statsd ='localhost', 8125)

# Increment a counter.

# Record a gauge 50% of the time.
statsd.gauge('', 123, :sample_rate=>0.5)

Trace collection

See Datadog’s dedicated documentation for Tracing Ruby Applications.

Log collection

Available for Agent v6.0+

See Datadog’s dedicated documentation for Ruby on Rails log collection.


Need help? Contact Datadog support.

Further Reading

Additional helpful documentation, links, and articles: