Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,6 @@ gem 'pdf-reader'
gem 'oauth2'

gem "sys-filesystem"

gem "sentry-rails"
gem "sentry-ruby"
9 changes: 9 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,13 @@ GEM
ruby2_keywords (0.0.5)
rubyzip (2.4.1)
securerandom (0.4.1)
sentry-rails (6.5.0)
railties (>= 5.2.0)
sentry-ruby (~> 6.5.0)
sentry-ruby (6.5.0)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
logger
set (1.1.1)
sexp_processor (4.17.3)
shellwords (0.2.2)
Expand Down Expand Up @@ -613,6 +620,8 @@ DEPENDENCIES
ruby-lsp
ruby-saml
rubyzip
sentry-rails
sentry-ruby
shellwords
sidekiq
sidekiq-cron
Expand Down
1 change: 1 addition & 0 deletions app/api/api_root.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class ApiRoot < Grape::API
message = "Sorry... something went wrong with your request."
status = 500
end
Sentry.capture_exception(e)
Rack::Response.new({ error: message }.to_json, status, { 'Content-type' => 'text/error' })
end

Expand Down
12 changes: 12 additions & 0 deletions config/initializers/sentry.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
if ENV["SENTRY_DSN"].present?
Sentry.init do |config|
config.dsn = ENV.fetch("SENTRY_DSN", nil)
# get breadcrumbs from logs
config.breadcrumbs_logger = [:active_support_logger, :http_logger]
config.environment = ENV.fetch("SENTRY_ENVIRONMENT", Rails.env)
config.release = ENV["SENTRY_RELEASE"] if ENV["SENTRY_RELEASE"].present?
# Add data like request headers and IP for users, if applicable;
# see https://docs.sentry.io/platforms/ruby/data-management/data-collected/ for more info
config.send_default_pii = false
end
end
Loading