Ruby Rails
Installation
-
Add the below gem to your Gemfile:
gem 'datadog', require: 'datadog/auto_instrument' -
Create a file
config/initializers/datadog.rbin your project directory, with the following content:config/initializers/datadog.rbDatadog.configure do |c|
# Add additional configuration here.
# Activate integrations, change tracer settings, etc...
# https://docs.datadoghq.com/tracing/trace_collection/automatic_instrumentation/dd_libraries/ruby/#rails
end -
Configure the tracer.
- Environment Variables
DD_SERVICE=<app_name>
# send traces to CubeAPM
DD_TRACE_AGENT_URL=http://<ip_address_of_cubeapm_server>:3130
# optional settings
DD_ENV=myenv
DD_VERSION=1.2.3
DD_TAGS=mykey1:myvalue1,mykey2:myvalue2
Sample App
A working example is available at https://github.com/cubeapm/sample_app_ruby_rails/tree/datadog
Troubleshooting
The following can be used for troubleshooting:
# Print Datadog tracer startup logs on screen
DD_TRACE_STARTUP_LOGS=true
# Enable Datadog tracer debug logging if needed to see detailed logs
DD_TRACE_DEBUG=true