Setup Sentry for error logging (#57)

This commit is contained in:
Max Wofford 2025-03-17 10:04:15 -04:00 committed by GitHub
parent 63d14b9469
commit b9e790c2d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 27 additions and 3 deletions

View file

@ -34,4 +34,7 @@ SMTP_ADDRESS=replace_with_your_smtp_address
SMTP_PORT=replace_with_your_smtp_port
# some emails are sent via loops.so again, not needed for local development
LOOPS_API_KEY=your_loops_api_key_here
LOOPS_API_KEY=your_loops_api_key_here
# Sentry DSN for error tracking
SENTRY_DSN=your_sentry_dsn_here

View file

@ -33,6 +33,11 @@ gem "tzinfo-data", platforms: %i[ windows jruby ]
gem "solid_cache"
gem "solid_cable"
# Profiling & error tracking
gem "stackprof"
gem "sentry-ruby"
gem "sentry-rails"
gem "good_job"
# Slack client
@ -85,8 +90,6 @@ group :development do
gem "rack-mini-profiler"
# For memory profiling via RMP
gem "memory_profiler"
# For call-stack profiling flamegraphs via RMP
gem "stackprof"
end
group :test do

View file

@ -391,6 +391,12 @@ GEM
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
sentry-rails (5.23.0)
railties (>= 5.0)
sentry-ruby (~> 5.23.0)
sentry-ruby (5.23.0)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
slack-ruby-client (2.5.2)
faraday (>= 2.0)
faraday-mashify
@ -497,6 +503,8 @@ DEPENDENCIES
rails (~> 8.0.2)
rubocop-rails-omakase
selenium-webdriver
sentry-rails
sentry-ruby
slack-ruby-client
solid_cable
solid_cache

View file

@ -18,6 +18,7 @@
<%# Includes all stylesheet files in app/assets/stylesheets %>
<%= stylesheet_link_tag :app %>
<%= javascript_importmap_tags %>
<%= Sentry.get_trace_propagation_meta.html_safe %>
</head>
<body>

View file

@ -0,0 +1,9 @@
# frozen_string_literal: true
Sentry.init do |config|
config.dsn = ENV["SENTRY_DSN"]
config.breadcrumbs_logger = [ :active_support_logger, :http_logger ]
config.send_default_pii = true
config.traces_sample_rate = 1.0
config.profiles_sample_rate = 1.0
end