The Ruby continuous profiling is currently made across 3 dimensions:
Add the datadog
gem to your Gemfile
or gems.rb
file:
1
gem 'datadog', '~> 2.0'
Blackfire utilizes the open source Datadog profiler to collect continuous profiling traces and, via its agent, sends it directly to Blackfire's ingesters where we process and analyze the data for your observability needs.
bundle install
command.Enable the Ruby Continuous Profiler by defining these environment variables:
DD_PROFILING_ENABLED=true
: controls the activation of the continuous
profiler.DD_SERVICE=my-ruby-app
: sets the application name.DD_PROFILING_ALLOCATION_ENABLED=1
: enables allocation profilingDD_TRACE_AGENT_URL=unix:///var/run/blackfire/agent.sock
: has Blackfire
Add the ddprofrb exec
command to your Ruby application start command:
1 2 3 4
bundle exec ddprofrb exec ruby myrubyapp.rb
# Rails example
bundle exec ddprofrb exec bin/rails s
Alternatively, start the profiler by adding the following code in your
application's entry point if you can't start it using ddprofrb exec
:
1
require 'datadog/profiling/preload'
There is also some additional configuration that can be done using environment variables:
BLACKFIRE_LOG_FILE
: Sets the log file. The default is logging to stderr
.BLACKFIRE_LOG_LEVEL
: Sets the log level. The default is logging only errors.