Skip to content

Commit

Permalink
Add Sentry Rails monitoring in production environments
Browse files Browse the repository at this point in the history
  • Loading branch information
goulvench committed Feb 20, 2025
1 parent 9f73b7f commit fb4d09d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ gem "bootsnap", require: false
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2"

# Monitor errors and performance
gem "sentry-ruby"
gem "sentry-rails"

# Add optimized Active Record association methods
gem "activerecord-has_some_of_many"

Expand Down
8 changes: 8 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,12 @@ GEM
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
sentry-rails (5.22.4)
railties (>= 5.0)
sentry-ruby (~> 5.22.4)
sentry-ruby (5.22.4)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
shellany (0.0.1)
shoulda-matchers (6.4.0)
activesupport (>= 5.2.0)
Expand Down Expand Up @@ -603,6 +609,8 @@ DEPENDENCIES
rubocop-rspec
rubocop-rspec_rails
selenium-webdriver (~> 4.27)
sentry-rails
sentry-ruby
shoulda-matchers
solid_cable
solid_cache
Expand Down
13 changes: 13 additions & 0 deletions config/initializers/sentry.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Sentry.init do |config|
return unless Rails.env.production?

config.dsn = "https://[email protected]/218"
config.breadcrumbs_logger = [:active_support_logger, :http_logger]

# Set tracesSampleRate to 1.0 to capture 100%
# of transactions for performance monitoring.
# We recommend adjusting this value in production
config.traces_sample_rate = 0.005

config.release = ENV["CONTAINER_VERSION"] if ENV["CONTAINER_VERSION"].present?
end

0 comments on commit fb4d09d

Please sign in to comment.