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

Explicitly require and use Sentry::SendEventJob

Oliver Günther5744dcd4221a
diff --git a/app/workers/sentry_job.rb b/app/workers/sentry_job.rb
deleted file mode 100644
index 01ac8b0fb49..00000000000
--- a/app/workers/sentry_job.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2021 the OpenProject GmbH
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version 3.
-#
-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-# Copyright (C) 2006-2013 Jean-Philippe Lang
-# Copyright (C) 2010-2013 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# See docs/COPYRIGHT.rdoc for more details.
-#++
-
-require 'active_job'
-
-class SentryJob < ::ActiveJob::Base
- queue_with_priority :low
-
- self.log_arguments = false
-
- def perform(event, hint = {})
- ::Sentry.send_event(event, hint)
- end
-end
diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb
index 4b46d8ceb74..0ac3b637803 100644
--- a/config/initializers/sentry.rb
+++ b/config/initializers/sentry.rb
@@ -3,6 +3,9 @@ if OpenProject::Logging::SentryLogger.enabled?
require "sentry-rails"
require "sentry-delayed_job"
+ # Explicitly require the send event job
+ require File.join(Sentry::Engine.root, 'app/jobs/sentry/send_event_job')
+
# We need to manually load the sentry initializer
# as we're dynamically loading it
# https://github.com/getsentry/sentry-ruby/blob/master/sentry-rails/lib/sentry/rails/railtie.rb#L8-L13
@@ -13,6 +16,12 @@ if OpenProject::Logging::SentryLogger.enabled?
app.config.middleware.use(Sentry::Rails::RescuedExceptionInterceptor)
end
+ ##
+ # Define the SentryJob here, as sentry gets dynamically loaded
+ class SentryJob < Sentry::SendEventJob
+ queue_with_priority :low
+ end
+
Sentry.init do |config|
config.dsn = OpenProject::Logging::SentryLogger.sentry_dsn
config.breadcrumbs_logger = [:active_support_logger]