Set Up Profiling
Ruby Profiling is currently in beta. Beta features are still in progress and may have bugs. We recognize the irony.
With profiling, Sentry tracks your software's performance by sampling your program's call stack in a variety of environments. This feature collects function-level information about your code and enables you to fine-tune your program's performance. Sentry's profiler captures function calls and their exact locations, aggregates them, and shows you the most common code paths of your program. This highlights areas you could optimize to help increase both the performance of your code and increase user satisfaction, as well as drive down costs.
Ruby profiling beta is available starting in SDK version 5.9.0
.
We use the stackprof
gem to collect profiles for Ruby.
First add stackprof
to your Gemfile
and make sure it is loaded before sentry-ruby
.
# Gemfile
gem 'stackprof'
gem 'sentry-ruby'
Then, make sure both traces_sample_rate
and profiles_sample_rate
are set and non-zero in your Sentry initializer.
# config/initializers/sentry.rb
Sentry.init do |config|
config.dsn = "https://examplePublicKey@o0.ingest.sentry.io/0"
config.traces_sample_rate = 1.0
config.profiles_sample_rate = 1.0
end
The profiles_sample_rate
setting is relative to the traces_sample_rate
setting.
For Profiling to work, you have to first enable Sentry’s performance monitoring via traces_sample_rate
(like in the example above). Read our performance setup documentation to learn how to configure sampling. If you set your sample rate to 1.0, all transactions will be captured.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").
- Package:
- gem:sentry-ruby
- Version:
- 5.17.3
- Repository:
- https://github.com/getsentry/sentry-ruby