From fcd8d1f625e9fa619c41136d7fd7605ec091cea4 Mon Sep 17 00:00:00 2001 From: Michael Harrison Date: Thu, 25 Jan 2024 11:58:19 -0600 Subject: [PATCH] Remove ScoutAPM, no longer used --- Gemfile | 2 -- Gemfile.lock | 3 -- app/controllers/api/v1/users_controller.rb | 2 -- config/delayed_job_worker_pool.rb | 8 ----- config/environment.rb | 1 - config/initializers/doorkeeper_models.rb | 1 - config/scout_apm.yml | 37 ---------------------- lib/scout_helper.rb | 7 ---- 8 files changed, 61 deletions(-) delete mode 100644 config/scout_apm.yml delete mode 100644 lib/scout_helper.rb diff --git a/Gemfile b/Gemfile index 6785cc2a8e..ee3830933e 100644 --- a/Gemfile +++ b/Gemfile @@ -156,8 +156,6 @@ gem 'rails-settings-ui' gem 'rails-settings-cached', '0.7.2' gem 'dry-validation', '0.12.3' -gem 'scout_apm' - # Respond to ELB healthchecks in /ping and /ping/ gem 'openstax_healthcheck' diff --git a/Gemfile.lock b/Gemfile.lock index 76fe41bc61..8014cd0bd5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -653,8 +653,6 @@ GEM sassc (2.0.1) ffi (~> 1.9) rake - scout_apm (5.1.0) - parser sd_notify (0.1.1) selenium-webdriver (4.9.0) rexml (~> 3.2, >= 3.2.5) @@ -836,7 +834,6 @@ DEPENDENCIES rubocop-rspec ruby-debug-ide sass-rails (~> 5.0) - scout_apm sd_notify selenium-webdriver sentry-rails diff --git a/app/controllers/api/v1/users_controller.rb b/app/controllers/api/v1/users_controller.rb index 12a2a248f5..527da3c15c 100644 --- a/app/controllers/api/v1/users_controller.rb +++ b/app/controllers/api/v1/users_controller.rb @@ -112,8 +112,6 @@ def index #{json_schema(Api::V1::UserRepresenter, include: :readable)} EOS def show - ScoutHelper.ignore!(0.999) - OSU::AccessPolicy.require_action_allowed!(:read, current_api_user, current_human_user) SetGdprData.call(user: current_human_user, diff --git a/config/delayed_job_worker_pool.rb b/config/delayed_job_worker_pool.rb index 2037ba92b8..8da1a25511 100644 --- a/config/delayed_job_worker_pool.rb +++ b/config/delayed_job_worker_pool.rb @@ -1,6 +1,5 @@ require 'etc' require 'sd_notify' -require 'scout_apm' # Notify systemd that we are the main process SdNotify.mainpid Process.pid @@ -84,10 +83,3 @@ def shutdown(signal) end end end - -# Make sure scout_apm doesn't start until we fork -::ScoutApm::BackgroundJobIntegrations::DelayedJob.class_exec do - def forking? - true - end -end diff --git a/config/environment.rb b/config/environment.rb index 73c3d6038c..d1b115e8b8 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,7 +1,6 @@ # Load the Rails application require_relative 'application' -require 'scout_helper' require 'env_utilities' require 'token_maker' require 'markdown_wrapper' diff --git a/config/initializers/doorkeeper_models.rb b/config/initializers/doorkeeper_models.rb index 8e665308bf..00480db964 100644 --- a/config/initializers/doorkeeper_models.rb +++ b/config/initializers/doorkeeper_models.rb @@ -38,7 +38,6 @@ def create_application_user Doorkeeper::TokensController.class_exec do alias_method :original_create, :create # before_action not available def create - ScoutHelper.ignore!(0.99) original_create end end diff --git a/config/scout_apm.yml b/config/scout_apm.yml deleted file mode 100644 index a21f456260..0000000000 --- a/config/scout_apm.yml +++ /dev/null @@ -1,37 +0,0 @@ ---- -# This configuration file is used for Scout APM. -# Environment variables can also be used to configure Scout. See our help docs at http://help.apm.scoutapp.com#environment-variables for more information. -development: - monitor: false - -test: - monitor: false - -production: - # name: application name in APM Web UI - # - Default: the application names comes from the Rails or Sinatra class name - name: Accounts (<%= ENV['ENV_NAME'] %>) - - # key: Your Organization key for Scout APM. Found on the settings screen. - # - Default: none - key: <%= ENV['SCOUT_LICENSE_KEY'] %> - - # monitor: Enable Scout APM or not - # - Default: false - # - Valid Options: true, false - monitor: <%= ENV.fetch('SCOUT_MONITOR', true) %> - - # log_level: Verboseness of logs. - # - Default: 'info' - # - Valid Options: debug, info, warn, error - # log_level: debug - - # log_file_path: The path to the scout_apm.log log file directory. Use stdout to log to STDOUT. - # - Default: 'Environment#root+log/' or 'STDOUT' if running on Heroku. - log_file_path: <%= ENV['SCOUT_LOG_FILE_PATH'] %> - - # ignore: An Array of web endpoints that Scout should not instrument. - # Routes that match the prefixed path (ex: ['/health', '/status']) will be ignored by the agent. - # - Default: [] - ignore: - - /ping diff --git a/lib/scout_helper.rb b/lib/scout_helper.rb deleted file mode 100644 index 2c37f82b03..0000000000 --- a/lib/scout_helper.rb +++ /dev/null @@ -1,7 +0,0 @@ -module ScoutHelper - - def self.ignore!(fraction=1.0) - ScoutApm::RequestManager.lookup.ignore_request! if (rand <= fraction) - end - -end