The profiler is shipped within Datadog tracing libraries. If you are already using APM to collect traces for your application, you can skip installing the library and go directly to enabling the profiler.
The Datadog Profiler requires MRI Ruby 2.1+. Wall time profiling is available for users on every platform (including macOS and Windows), but CPU time profiles are currently only available on Linux platforms.
To begin profiling applications:
google-protobuf gems to your
gem 'ddtrace', '>= 0.49.0' gem 'google-protobuf', '~> 3.0'
Install the gems with
You can auto-enable the profiler with environment variables:
export DD_PROFILING_ENABLED=true export DD_ENV=prod export DD_SERVICE=my-web-app export DD_VERSION=1.0.3
or in code:
Datadog.configure do |c| c.profiling.enabled = true c.env = 'prod' c.service = 'my-web-app' c.version = '1.0.3' end
Note: For Rails applications you can create a
config/initializers/datadog.rb file with the code configuration above.
ddtracerb exec command to your Ruby application start command:
bundle exec ddtracerb exec ruby myapp.rb
bundle exec ddtracerb exec bin/rails s
If starting the application via
ddtracerb exec is not an option (eg. when using the Phusion Passenger web server), you can alternatively start the profiler by adding the following to your application entry point such as
config.ru for a web application:
A minute or two after starting your Ruby application, your profiles will show up on the Datadog APM > Profiler page.
The Getting Started with Profiler guide takes a sample service with a performance problem and shows you how to use Continuous Profiler to understand and fix the problem.
Additional helpful documentation, links, and articles: