mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 03:57:52 +00:00
chore: Load only required APMs (#6497)
- Disable requiring the gems for all the APMs - Switch to selectively requiring them.
This commit is contained in:
16
Gemfile
16
Gemfile
@@ -96,13 +96,15 @@ gem 'slack-ruby-client'
|
|||||||
gem 'google-cloud-dialogflow'
|
gem 'google-cloud-dialogflow'
|
||||||
|
|
||||||
##-- apm and error monitoring ---#
|
##-- apm and error monitoring ---#
|
||||||
gem 'ddtrace'
|
# loaded only when environment variables are set.
|
||||||
gem 'elastic-apm'
|
# ref application.rb
|
||||||
gem 'newrelic_rpm'
|
gem 'ddtrace', require: false
|
||||||
gem 'scout_apm'
|
gem 'elastic-apm', require: false
|
||||||
gem 'sentry-rails', '~> 5.3', '>= 5.3.1'
|
gem 'newrelic_rpm', require: false
|
||||||
gem 'sentry-ruby', '~> 5.3'
|
gem 'scout_apm', require: false
|
||||||
gem 'sentry-sidekiq', '~> 5.3', '>= 5.3.1'
|
gem 'sentry-rails', require: false
|
||||||
|
gem 'sentry-ruby', require: false
|
||||||
|
gem 'sentry-sidekiq', require: false
|
||||||
|
|
||||||
##-- background job processing --##
|
##-- background job processing --##
|
||||||
gem 'sidekiq', '~> 6.4.2'
|
gem 'sidekiq', '~> 6.4.2'
|
||||||
|
@@ -844,9 +844,9 @@ DEPENDENCIES
|
|||||||
rubocop-rspec
|
rubocop-rspec
|
||||||
scout_apm
|
scout_apm
|
||||||
seed_dump
|
seed_dump
|
||||||
sentry-rails (~> 5.3, >= 5.3.1)
|
sentry-rails
|
||||||
sentry-ruby (~> 5.3)
|
sentry-ruby
|
||||||
sentry-sidekiq (~> 5.3, >= 5.3.1)
|
sentry-sidekiq
|
||||||
shoulda-matchers
|
shoulda-matchers
|
||||||
sidekiq (~> 6.4.2)
|
sidekiq (~> 6.4.2)
|
||||||
sidekiq-cron (~> 1.6, >= 1.6.0)
|
sidekiq-cron (~> 1.6, >= 1.6.0)
|
||||||
|
@@ -8,6 +8,20 @@ require 'rails/all'
|
|||||||
# you've limited to :test, :development, or :production.
|
# you've limited to :test, :development, or :production.
|
||||||
Bundler.require(*Rails.groups)
|
Bundler.require(*Rails.groups)
|
||||||
|
|
||||||
|
## Load the specific APM agent
|
||||||
|
# We rely on DOTENV to load the environment variables
|
||||||
|
# We need these environment variables to load the specific APM agent
|
||||||
|
Dotenv::Railtie.load
|
||||||
|
require 'ddtrace' if ENV.fetch('DD_TRACE_AGENT_URL', false).present?
|
||||||
|
require 'elastic-apm' if ENV.fetch('ELASTIC_APM_SECRET_TOKEN', false).present?
|
||||||
|
require 'newrelic_rpm' if ENV.fetch('NEW_RELIC_LICENSE_KEY', false).present?
|
||||||
|
require 'scout_apm' if ENV.fetch('SCOUT_KEY', false).present?
|
||||||
|
if ENV.fetch('SENTRY_DSN', false).present?
|
||||||
|
require 'sentry-ruby'
|
||||||
|
require 'sentry-rails'
|
||||||
|
require 'sentry-sidekiq'
|
||||||
|
end
|
||||||
|
|
||||||
module Chatwoot
|
module Chatwoot
|
||||||
class Application < Rails::Application
|
class Application < Rails::Application
|
||||||
# Initialize configuration defaults for originally generated Rails version.
|
# Initialize configuration defaults for originally generated Rails version.
|
||||||
|
10
config/scout_apm.yml
Normal file
10
config/scout_apm.yml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
common: &defaults
|
||||||
|
name: <%= ENV.fetch('SCOUT_NAME', '') %>
|
||||||
|
key: <%= ENV.fetch('SCOUT_KEY', '') %>
|
||||||
|
monitor: <%= ENV['SCOUT_KEY'].present? && ENV.fetch('SCOUT_MONITOR', true) %>
|
||||||
|
|
||||||
|
test:
|
||||||
|
monitor: <%= ENV['SCOUT_KEY'].present? && ENV.fetch('SCOUT_MONITOR', true) %>
|
||||||
|
|
||||||
|
production:
|
||||||
|
<<: *defaults
|
@@ -1,4 +1,6 @@
|
|||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
# explicitly requiring since we are loading apms conditionally in application.rb
|
||||||
|
require 'sentry-ruby'
|
||||||
|
|
||||||
describe ChatwootExceptionTracker do
|
describe ChatwootExceptionTracker do
|
||||||
it 'use rails logger if no tracker is configured' do
|
it 'use rails logger if no tracker is configured' do
|
||||||
|
Reference in New Issue
Block a user