From 30d6bcf525cd43d09dde56b96ae6d4414b75439c Mon Sep 17 00:00:00 2001 From: Jeremy Prevost Date: Tue, 17 Sep 2024 08:34:59 -0400 Subject: [PATCH] ScoutAPM https://mitlibraries.atlassian.net/browse/TCO-87 --- Gemfile | 6 ++++++ Gemfile.lock | 4 ++++ README.md | 6 ++++++ config/scout_apm.yml | 49 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 config/scout_apm.yml diff --git a/Gemfile b/Gemfile index abc2c57..dfccc70 100644 --- a/Gemfile +++ b/Gemfile @@ -34,9 +34,15 @@ gem 'omniauth' gem 'omniauth_openid_connect' gem 'omniauth-rails_csrf_protection' +# Parser added explicitly to allow for the namespace to be available for scout +gem 'parser' + # Use the Puma web server [https://github.com/puma/puma] gem 'puma', '>= 5.0' +# Performance Monitoring +gem 'scout_apm' + # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" gem 'rails', '~> 7.1.2' diff --git a/Gemfile.lock b/Gemfile.lock index cf474e6..7b15579 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -383,6 +383,8 @@ GEM sprockets (> 3.0) sprockets-rails tilt + scout_apm (5.4.0) + parser selectize-rails (0.12.6) selenium-webdriver (4.23.0) base64 (~> 0.2) @@ -481,6 +483,7 @@ DEPENDENCIES omniauth omniauth-rails_csrf_protection omniauth_openid_connect + parser pg puma (>= 5.0) rack-cors @@ -491,6 +494,7 @@ DEPENDENCIES rubocop-minitest rubocop-performance rubocop-rails + scout_apm selenium-webdriver simplecov simplecov-lcov diff --git a/README.md b/README.md index 3bb7a76..d312f73 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,12 @@ If you need to regenerate these cassettes, the following procedure should be suf `PLATFORM_NAME`: The value set is added to the header after the MIT Libraries logo. The logic and CSS for this comes from our theme gem. +Scout settings can be controlled via `config/scout_apm.yml` or ENV. ENV overrides config. +Lots more [Scout settings](https://scoutapm.com/docs/ruby/configuration#environment-variables) available. +`SCOUT_KEY`: ScoutAPM key. Do not set in dev or test. +`SCOUT_LOG_LEVEL`: defaults to INFO which is probably fine. Controls verboseness of Scout logs +`SCOUT_NAME`: set a unique name per deployed tier to avoid confusion. + ### Authentication #### Required in all environments diff --git a/config/scout_apm.yml b/config/scout_apm.yml new file mode 100644 index 0000000..9bf7299 --- /dev/null +++ b/config/scout_apm.yml @@ -0,0 +1,49 @@ +# This configuration file is used for Scout APM. +# Environment variables can also be used to configure Scout. See our help docs at https://scoutapm.com/docs/ruby/configuration#environment-variables for more information. +common: &defaults + + # key: Your Organization key for Scout APM. Found on the settings screen. + # - Default: none + # key: We set this ENV `SCOUT_KEY` + + # log_level: Verboseness of logs. + # - Default: 'info' + # - Valid Options: debug, info, warn, error + # log_level: debug + # TIP: this can be set via ENV `SCOUT_LOG_LEVEL` to change without redeploy + + # use_prepend: Use the newer `prepend` instrumentation method. In some cases, gems + # that use `alias_method` can conflict with gems that use `prepend`. + # To avoid the conflict, change this setting to match the method + # that the other gems use. + # If you have another APM gem installed, such as DataDog or NewRelic, + # you will likely want to set `use_prepend` to true. + # + # See https://scoutapm.com/docs/ruby/configuration#library-instrumentation-method + # for more information. + # - Default: false + # - Valid Options: true, false + # use_prepend: true + + # name: Application name in APM Web UI + # - Default: the application names comes from the Rails or Sinatra class name + # name: + + # monitor: Enable Scout APM or not + # - Default: none + # - Valid Options: true, false + monitor: true + +production: + <<: *defaults + +development: + <<: *defaults + monitor: false + +test: + <<: *defaults + monitor: false + +staging: + <<: *defaults