Conversation
Adds sentry-ruby and sentry-rails gems with an initializer that reads SENTRY_DSN and SENTRY_ENVIRONMENT from env vars. The ECS task definition has been updated to supply these (analytics-dashboard:93). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
WalkthroughThe pull request adds Sentry error tracking to the application by introducing the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
Gemfile (1)
43-44: Sort gems alphabetically per RuboCop convention.Static analysis indicates
sentry-railsshould appear beforesentry-ruby.♻️ Proposed fix
-gem 'sentry-ruby', '~> 5.22' -gem 'sentry-rails', '~> 5.22' +gem 'sentry-rails', '~> 5.22' +gem 'sentry-ruby', '~> 5.22'🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Gemfile` around lines 43 - 44, Reorder the two Sentry gem entries in the Gemfile so they are alphabetized per RuboCop convention: move the declaration for gem 'sentry-rails', '~> 5.22' to appear before gem 'sentry-ruby', '~> 5.22'. Ensure no other formatting changes are made and run RuboCop to confirm the ordering violation is resolved.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@config/initializers/sentry.rb`:
- Around line 1-6: The rescue_from handler in ApplicationController is
swallowing service-related exceptions before Sentry can see them; update the
handler method (e.g., handle_service_error in
app/controllers/application_controller.rb) to explicitly call
Sentry.capture_exception(exception) before logging and rendering the error page
so the exceptions are reported to Sentry, then continue to
Rails.logger.error(exception.full_message) and render
"errors/service_unavailable" with status :service_unavailable and layout
"application".
---
Nitpick comments:
In `@Gemfile`:
- Around line 43-44: Reorder the two Sentry gem entries in the Gemfile so they
are alphabetized per RuboCop convention: move the declaration for gem
'sentry-rails', '~> 5.22' to appear before gem 'sentry-ruby', '~> 5.22'. Ensure
no other formatting changes are made and run RuboCop to confirm the ordering
violation is resolved.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4b0250f5-06bf-4d46-8516-49609659d574
⛔ Files ignored due to path filters (1)
Gemfile.lockis excluded by!**/*.lock
📒 Files selected for processing (2)
Gemfileconfig/initializers/sentry.rb
| Sentry.init do |config| | ||
| config.dsn = ENV["SENTRY_DSN"] | ||
| config.breadcrumbs_logger = [:active_support_logger, :http_logger] | ||
| config.traces_sample_rate = 0.1 | ||
| config.environment = ENV.fetch("SENTRY_ENVIRONMENT", Rails.env) | ||
| end |
There was a problem hiding this comment.
Rescued exceptions in ApplicationController won't be reported to Sentry.
The rescue_from handler in app/controllers/application_controller.rb (lines 6-7, 18-21) catches Google::Apis::Error, Signet::AuthorizationError, Faraday::Error, and Timeout::Error, then renders an error page without re-raising. These exceptions are swallowed before the sentry-rails middleware can intercept them.
To capture these errors, explicitly report them in the handler:
🔧 Proposed fix in app/controllers/application_controller.rb
def handle_service_error(exception)
Sentry.capture_exception(exception)
Rails.logger.error(exception.full_message)
render "errors/service_unavailable", status: :service_unavailable, layout: "application"
end🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@config/initializers/sentry.rb` around lines 1 - 6, The rescue_from handler in
ApplicationController is swallowing service-related exceptions before Sentry can
see them; update the handler method (e.g., handle_service_error in
app/controllers/application_controller.rb) to explicitly call
Sentry.capture_exception(exception) before logging and rendering the error page
so the exceptions are reported to Sentry, then continue to
Rails.logger.error(exception.full_message) and render
"errors/service_unavailable" with status :service_unavailable and layout
"application".
Summary
sentry-rubyandsentry-railsgemsSENTRY_DSNandSENTRY_ENVIRONMENTfrom env vars (no-op when unset)analytics-dashboard:93has been updated withSENTRY_DSNpointing to thedpla-frontendSentry project andSENTRY_ENVIRONMENT=analytics-dashboardanalytics-dashboard, distinct from the frontend sitesTest plan
analytics-dashboard🤖 Generated with Claude Code
Summary by CodeRabbit