Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Bump sentry and remove doubled exceptions capture

Oliver Günther3bb52f6f7f3c
diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb
index a394e08db8b..3d8209e1d5f 100644
--- a/app/controllers/errors_controller.rb
+++ b/app/controllers/errors_controller.rb
@@ -14,11 +14,17 @@ class ErrorsController < ::ActionController::Base
end
def internal_error
- render_500
+ render_500 error_options
end
private
+ def error_options
+ {
+ exception: request.env["action_dispatch.exception"] || request.env["sentry.rescued_exception"]
+ }.compact
+ end
+
def use_layout
'only_logo'
end
diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb
index 373193cc954..3c088301a06 100644
--- a/config/initializers/sentry.rb
+++ b/config/initializers/sentry.rb
@@ -10,8 +10,6 @@ if OpenProject::Logging::SentryLogger.enabled?
# as we're dynamically loading it
# https://github.com/getsentry/sentry-ruby/blob/master/sentry-rails/lib/sentry/rails/railtie.rb#L8-L13
OpenProject::Application.configure do |app|
- # need to be placed at first to capture as many errors as possible
- app.config.middleware.insert 0, Sentry::Rails::CaptureExceptions
# need to be placed at last to smuggle app exceptions via env
app.config.middleware.use(Sentry::Rails::RescuedExceptionInterceptor)
end
@@ -33,6 +31,16 @@ if OpenProject::Logging::SentryLogger.enabled?
end
end
+ # Output debug info for sentry
+ config.before_send = lambda do |event, hint|
+ Rails.logger.debug do
+ payload_sizes = event.to_json_compatible.transform_values { |v| JSON.generate(v).bytesize }.inspect
+ "[Sentry] will send event #{hint}. Payload sizes are #{payload_sizes.inspect}"
+ end
+
+ event
+ end
+
# Don't send loaded modules
config.send_modules = false