diff --git a/Gemfile b/Gemfile index 582fc47827c7..bc673e74dcf9 100644 --- a/Gemfile +++ b/Gemfile @@ -218,7 +218,7 @@ gem "dry-validation" gem "store_attribute", "~> 1.0" # Appsignal integration -gem "appsignal", "~> 3.10.0", require: false +gem "appsignal", "~> 4.2", require: false gem "view_component" # Lookbook diff --git a/Gemfile.lock b/Gemfile.lock index 47d3cd0cc254..45bcbbd02770 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -335,7 +335,8 @@ GEM airbrake-ruby (6.2.2) rbtree3 (~> 0.6) android_key_attestation (0.3.0) - appsignal (3.10.0) + appsignal (4.2.0) + logger rack ast (2.4.2) attr_required (1.0.2) @@ -1208,7 +1209,7 @@ DEPENDENCIES acts_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.7.0) aws-sdk-core (~> 3.107) diff --git a/config/initializers/appsignal.rb b/config/initializers/appsignal.rb index 7a7c9fee84ee..4159de1e877f 100644 --- a/config/initializers/appsignal.rb +++ b/config/initializers/appsignal.rb @@ -3,56 +3,53 @@ 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: [ - "OkComputer::OkComputerController#show", - "OkComputer::OkComputerController#index", - "GET::API::V3::Notifications::NotificationsAPI", - "GET::API::V3::Notifications::NotificationsAPI#/notifications/" - ], - ignore_errors: [ - "Grape::Exceptions::MethodNotAllowed", - "ActionController::UnknownFormat", - "ActiveJob::DeserializationError", - "Net::SMTPServerBusy" - ], - ignore_logs: [ - "GET /health_check" - ] - } - - 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" + ] 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.start end