Enabling the Ruby Profiler
이 페이지는 아직 한국어로 제공되지 않으며 번역 작업 중입니다. 번역에 관한 질문이나 의견이 있으시면 언제든지 저희에게 연락해 주십시오.
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.
Requirements
The Datadog Profiler requires Ruby 2.3+ (JRuby and TruffleRuby are not supported).
The following operating systems and architectures are supported:
- Linux (GNU libc) x86-64, aarch64
- Alpine Linux (musl libc) x86-64, aarch64
You also need either the pkg-config
or the pkgconf
Linux system utility installed.
This utility is available on the software repositories of most Linux distributions. For example:
- The
pkg-config
package is available for Homebrew, and Debian- and Ubuntu-based Linux - The
pkgconf
package is available for Arch- and Alpine-based Linux - The
pkgconf-pkg-config
package is available for Fedora- and Red-Hat-based Linux
Continuous Profiler is not supported on serverless platforms, such as AWS Lambda.
Installation
To begin profiling applications:
If you are already using Datadog, upgrade your agent to version 7.20.2+ or 6.20.2+.
Add the ddtrace
gem to your Gemfile
or gems.rb
file:
If you’re running a version of ddtrace
older than 1.15.0, add the google-protobuf
gem (version ~> 3.0) as a dependency.
Install the gems with bundle install
.
Enable the profiler:
export DD_PROFILING_ENABLED=true
export DD_ENV=prod
export DD_SERVICE=my-web-app
export DD_VERSION=1.0.3
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, create a config/initializers/datadog.rb
file with the code configuration above.
Add the ddtracerb exec
command to your Ruby application start command:
bundle exec ddtracerb exec ruby myapp.rb
Rails example:
bundle exec ddtracerb exec bin/rails s
Note
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:
require 'datadog/profiling/preload'
A minute or two after starting your Ruby application, your profiles will show up on the Datadog APM > Profiler page.
Not sure what to do next?
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.
Further Reading
Additional helpful documentation, links, and articles: