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
Merge pull request #17280 from opf/maintenance/update-appsignal
Markus Kahl44b2676b3623
diff --git a/Gemfile b/Gemfileindex 988790effc5..05b9a35a04f 100644--- a/Gemfile+++ b/Gemfile@@ -221,7 +221,7 @@ gem "dry-validation"gem "store_attribute", "~> 2.0"# Appsignal integration-gem "appsignal", "~> 3.10.0", require: false+gem "appsignal", "~> 4.2", require: false# Yabeda integrationgem "yabeda-activerecord"diff --git a/Gemfile.lock b/Gemfile.lockindex ca3c6dfdaac..db4b50dc253 100644--- a/Gemfile.lock+++ b/Gemfile.lock@@ -335,7 +335,8 @@ GEMandroid_key_attestation (0.3.0)anyway_config (2.7.2)ruby-next-core (~> 1.0)- appsignal (3.10.0)+ appsignal (4.2.0)+ loggerrackast (2.4.3)attr_required (1.0.2)@@ -1344,7 +1345,7 @@ DEPENDENCIESacts_as_tree (~> 2.9.0)addressable (~> 2.8.0)airbrake (~> 13.0.0)- appsignal (~> 3.10.0)+ appsignal (~> 4.2)auto_strip_attributes (~> 2.5)awesome_nested_set (~> 3.8.0)aws-sdk-core (~> 3.107)@@ -1577,7 +1578,7 @@ CHECKSUMSairbrake-ruby (6.2.2) sha256=293e34fb36e763e1b6d67ab584cce7c5b6fe9eea1a70c26d8c13c0f5d7de2fbcandroid_key_attestation (0.3.0) sha256=467eb01a99d2bb48ef9cf24cc13712669d7056cba5a52d009554ff037560570banyway_config (2.7.2) sha256=30f6b087c0b41afdd43fe46c81d65a16f052a8489dab453abaeb4ea67aa74bad- appsignal (3.10.0) sha256=2a18f3253afdf2fc2d7f9e43d5118976c05a614934abcbb29bb84000d047b61b+ appsignal (4.2.0) sha256=52c8b13cabe8991066b466e10b223a53168d837e7516775bbba18b4fbc758bc3ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383attr_required (1.0.2) sha256=f0ebfc56b35e874f4d0ae799066dbc1f81efefe2364ca3803dc9ea6a4de6cb99auto_strip_attributes (2.6.0) sha256=a7e2e0cf744de2bcd947fd68014220702bcc88c81274c1cd9ce6f7316aae39b0diff --git a/config/environments/test.rb b/config/environments/test.rbindex 10fe0e723d2..699db93ff67 100644--- a/config/environments/test.rb+++ b/config/environments/test.rb@@ -27,6 +27,7 @@#++require "active_support/core_ext/integer/time"+require "appsignal" # we will need it to test it in `spec/lib/open_project/appsignal_spec.rb`# The test environment is used exclusively to run your application's# test suite. You never need to work with it otherwise. Remember thatdiff --git a/config/initializers/appsignal.rb b/config/initializers/appsignal.rbindex 558113cff23..de88139815a 100644--- a/config/initializers/appsignal.rb+++ b/config/initializers/appsignal.rb@@ -1,63 +1,91 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 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 "open_project/version"require_relative "../../lib_static/open_project/appsignal"if OpenProject::Appsignal.enabled?require "appsignal"- Rails.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[- OkComputer::OkComputerController#show- OkComputer::OkComputerController#index- GET::API::V3::Notifications::NotificationsAPI- GET::API::V3::Notifications::NotificationsAPI#/notifications/- ],- ignore_errors: %w[- Grape::Exceptions::MethodNotAllowed- ActionController::UnknownFormat- ActiveJob::DeserializationError- Net::SMTPServerBusy- ],- ignore_logs: [- "GET /health_check"- ],- filter_session_data: %w[- _csrf_token- omniauth.oidc_access_token- omniauth.oidc_sid- ]- }-- if ENV["APPSIGNAL_DEBUG"] == "true"- config[:log] = "stdout"- config[:debug] = true- config[:log_level] = "debug"- end-- Appsignal.config = Appsignal::Config.new(- Rails.root,- Rails.env,- config- )+ Rails.application.configure do |app|app.middleware.insert_after(ActionDispatch::DebugExceptions,Appsignal::Rack::RailsInstrumentation)+ end- # Extend the core log delegator- handler = OpenProject::Appsignal.method(:exception_handler)- OpenProject::Logging::LogDelegator.register(:appsignal, handler)+ Appsignal.configure do |config|+ config.active = true+ config.name = ENV.fetch("APPSIGNAL_NAME")+ config.push_api_key = ENV.fetch("APPSIGNAL_KEY")+ config.revision = OpenProject::VERSION.to_s- # Send our logs to appsignal- if OpenProject::Appsignal.logging_enabled?- appsignal_logger = Appsignal::Logger.new("rails")- Rails.logger.broadcast_to(appsignal_logger)+ if ENV["APPSIGNAL_DEBUG"] == "true"+ config.log = "stdout"+ config.log_level = "debug"end- Appsignal.start+ config.ignore_actions = [+ "OkComputer::OkComputerController#show",+ "OkComputer::OkComputerController#index",+ "GET::API::V3::Notifications::NotificationsAPI",+ "GET::API::V3::Notifications::NotificationsAPI#/notifications/"+ ]++ config.ignore_errors = [+ "Grape::Exceptions::MethodNotAllowed",+ "ActionController::UnknownFormat",+ "ActiveJob::DeserializationError",+ "Net::SMTPServerBusy"+ ]++ config.ignore_logs = [+ "GET /health_check"+ ]++ config.filter_session_data = %w[+ _csrf_token+ omniauth.oidc_access_token+ omniauth.oidc_sid+ ]end++ # Extend the core log delegator+ handler = OpenProject::Appsignal.method(:exception_handler)+ OpenProject::Logging::LogDelegator.register(:appsignal, handler)++ # Send our logs to appsignal+ if OpenProject::Appsignal.logging_enabled?+ appsignal_logger = Appsignal::Logger.new("rails")+ Rails.logger.broadcast_to(appsignal_logger)+ end++ Appsignal.startenddiff --git a/spec/lib/open_project/appsignal_spec.rb b/spec/lib/open_project/appsignal_spec.rbindex ccdfe5afd72..ade899fb3b7 100644--- a/spec/lib/open_project/appsignal_spec.rb+++ b/spec/lib/open_project/appsignal_spec.rb@@ -46,11 +46,7 @@ RSpec.describe OpenProject::Appsignal doendit "stores the exception in current appsignal transaction if one is available" do- transaction = Appsignal::Transaction.create(- SecureRandom.uuid,- Appsignal::Transaction::BACKGROUND_JOB,- Appsignal::Transaction::GenericRequest.new({})- )+ transaction = Appsignal::Transaction.create SecureRandom.uuidallow(transaction).to receive(:set_error)described_class.exception_handler("message", exception:)