Skip to content

Commit

Permalink
Merge pull request opf#17267 from opf/bump/appsignal
Browse files Browse the repository at this point in the history
Bump appsignal to 4.2
  • Loading branch information
machisuji authored Nov 25, 2024
2 parents c32474b + 8baabfa commit 7485b21
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 45 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
81 changes: 39 additions & 42 deletions config/initializers/appsignal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7485b21

Please sign in to comment.