From 14e429759b93e8178e480952807bc604bd2f0915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Meny?= Date: Wed, 9 Feb 2022 17:02:30 +0000 Subject: [PATCH] Add sentry configuration (#289) --- .github/workflows/pipeline.yml | 4 ++++ Gemfile | 3 +++ Gemfile.lock | 10 ++++++++++ config/initializers/sentry.rb | 5 +++++ 4 files changed, 22 insertions(+) create mode 100644 config/initializers/sentry.rb diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 9177f349e..7cb4a2eba 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -123,6 +123,8 @@ jobs: APP_HOST: ${{ secrets.APP_HOST }} RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} IMPORT_PAAS_INSTANCE: ${{ secrets.IMPORT_PAAS_INSTANCE }} + EXPORT_PAAS_INSTANCE: ${{ secrets.EXPORT_PAAS_INSTANCE }} + SENTRY_DSN: ${{ secrets.SENTRY_DSN }} run: | cf7 api $CF_API_ENDPOINT cf7 auth @@ -133,4 +135,6 @@ jobs: cf7 set-env $APP_NAME APP_HOST $APP_HOST cf7 set-env $APP_NAME RAILS_MASTER_KEY $RAILS_MASTER_KEY cf7 set-env $APP_NAME IMPORT_PAAS_INSTANCE $IMPORT_PAAS_INSTANCE + cf7 set-env $APP_NAME EXPORT_PAAS_INSTANCE $EXPORT_PAAS_INSTANCE + cf7 set-env $APP_NAME SENTRY_DSN $SENTRY_DSN cf7 push $APP_NAME --strategy rolling diff --git a/Gemfile b/Gemfile index 7133ead8b..80ae0f4f6 100644 --- a/Gemfile +++ b/Gemfile @@ -49,6 +49,9 @@ gem "aws-sdk-s3" gem "paper_trail" # Store active record objects in version whodunnits gem "paper_trail-globalid" +# Receive exceptions and configure alerts +gem "sentry-rails" +gem "sentry-ruby" group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console diff --git a/Gemfile.lock b/Gemfile.lock index 0cc3aab45..860616d0f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -402,6 +402,14 @@ GEM rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2) semantic_range (3.0.0) + sentry-rails (5.0.2) + railties (>= 5.0) + sentry-ruby-core (~> 5.0.2) + sentry-ruby (5.0.2) + concurrent-ruby (~> 1.0, >= 1.0.2) + sentry-ruby-core (= 5.0.2) + sentry-ruby-core (5.0.2) + concurrent-ruby simplecov (0.21.2) docile (~> 1.1) simplecov-html (~> 0.11) @@ -487,6 +495,8 @@ DEPENDENCIES rubocop-rails scss_lint-govuk selenium-webdriver + sentry-rails + sentry-ruby simplecov timecop (~> 0.9.4) two_factor_authentication! diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb new file mode 100644 index 000000000..6b21533c7 --- /dev/null +++ b/config/initializers/sentry.rb @@ -0,0 +1,5 @@ +Sentry.init do |config| + config.breadcrumbs_logger = %i[active_support_logger http_logger] + config.enabled_environments = %w[production staging] + config.traces_sample_rate = 0.5 +end