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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Add Appsignal configuration
Oliver Günther78cc8b30d40a
diff --git a/Gemfile b/Gemfileindex 2bf9d937766..60a86bac843 100644--- a/Gemfile+++ b/Gemfile@@ -202,6 +202,9 @@ gem "sentry-delayed_job", '~> 5.3.0'gem "sentry-rails", '~> 5.3.0'gem "sentry-ruby", '~> 5.3.0'+# Appsignal integration+gem "appsignal", "~> 3.0", require: false+group :test dogem 'launchy', '~> 2.5.0'gem 'rack-test', '~> 1.1.0'diff --git a/Gemfile.lock b/Gemfile.lockindex d27c2f9db0d..bc2258c0e65 100644--- a/Gemfile.lock+++ b/Gemfile.lock@@ -282,6 +282,8 @@ GEMairbrake-ruby (~> 6.0)airbrake-ruby (6.1.0)rbtree3 (~> 0.5)+ appsignal (3.0.27)+ rackast (2.4.2)attr_required (1.0.1)auto_strip_attributes (2.6.0)@@ -1015,6 +1017,7 @@ DEPENDENCIESacts_as_tree (~> 2.9.0)addressable (~> 2.8.0)airbrake (~> 13.0.0)+ appsignal (~> 3.0)auto_strip_attributes (~> 2.5)awesome_nested_set (~> 3.5.0)aws-sdk-core (~> 3.107)diff --git a/config/initializers/appsignal.rb b/config/initializers/appsignal.rbnew file mode 100644index 00000000000..cc86c93fdc1--- /dev/null+++ b/config/initializers/appsignal.rb@@ -0,0 +1,33 @@+require 'open_project/version'++if ENV['APPSIGNAL_ENABLED'] == 'true'+ require 'appsignal'+ OpenProject::Application.configure do |app|+ config = {+ active: true,+ name: ENV.fetch('APPSIGNAL_NAME'),+ push_api_key: ENV.fetch('APPSIGNAL_KEY'),+ revision: OpenProject::VERSION.to_s,+ ignore_actions: %w[OkComputerController#index OkComputerController#show]+ }++ if Rails.env.development?+ config[:log] = 'stdout'+ config[:debug] = true+ config[:log_level] = 'debug'+ end++ Appsignal.config = Appsignal::Config.new(+ Rails.root,+ Rails.env,+ config+ )++ app.middleware.insert_after(+ ActionDispatch::DebugExceptions,+ Appsignal::Rack::RailsInstrumentation+ )++ Appsignal.start+ end+enddiff --git a/config/puma.rb b/config/puma.rbindex 54fd04f2e6a..d375917d8fc 100644--- a/config/puma.rb+++ b/config/puma.rb@@ -33,6 +33,8 @@ preload_app! if ENV["RAILS_ENV"] == 'production'# Allow puma to be restarted by `rails restart` command.plugin :tmp_restart unless ENV["RAILS_ENV"] == 'production'+plugin :appsignal if ENV['APPSIGNAL_ENABLED'] == 'true'+# activate statsd plugin only if a host is configured explicitlyif OpenProject::Configuration.statsd_host.present?module ConfigurationViaOpenProjectdiff --git a/lib/api/appsignal_api.rb b/lib/api/appsignal_api.rbnew file mode 100644index 00000000000..898b0704a62--- /dev/null+++ b/lib/api/appsignal_api.rb@@ -0,0 +1,41 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2022 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 COPYRIGHT and LICENSE files for more details.+#+++require "appsignal"+require "appsignal/integrations/grape"++module API+ module AppsignalAPI+ def self.included(base)+ base.class_eval do+ if Appsignal.active?+ insert_before Grape::Middleware::Error, Appsignal::Grape::Middleware+ end+ end+ end+ end+enddiff --git a/lib/api/open_project_api.rb b/lib/api/open_project_api.rbindex dab7c66315b..53ea3b5114f 100644--- a/lib/api/open_project_api.rb+++ b/lib/api/open_project_api.rb@@ -28,6 +28,8 @@module APIclass OpenProjectAPI < ::Grape::API+ include ::API::AppsignalAPI+class << selfdef inherited(api, *)superdiff --git a/lib/api/root.rb b/lib/api/root.rbindex f0bbc5129dd..9d843b36a8e 100644--- a/lib/api/root.rb+++ b/lib/api/root.rb@@ -25,9 +25,9 @@## See COPYRIGHT and LICENSE files for more details.#++-module APIclass Root < ::API::RootAPI+ include ::API::AppsignalAPIcontent_type 'hal+json', 'application/hal+json; charset=utf-8'format 'hal+json'formatter 'hal+json', API::Formatter.newdiff --git a/lib/api/root_api.rb b/lib/api/root_api.rbindex 44f93af2f91..f6b8eb72b55 100644--- a/lib/api/root_api.rb+++ b/lib/api/root_api.rb@@ -35,6 +35,7 @@ require 'open_project/authentication'module APIclass RootAPI < Grape::APIinclude OpenProject::Authentication::Scope+ include ::API::AppsignalAPIextend API::Utilities::GrapeHelperinsert_before Grape::Middleware::Error,