diff --git a/Gemfile b/Gemfile index f6eb708..3a4142c 100644 --- a/Gemfile +++ b/Gemfile @@ -22,6 +22,10 @@ gem 'jbuilder', '~> 2.7' # Use Active Model has_secure_password # gem 'bcrypt', '~> 3.1.7' + +gem "sentry-ruby" +gem "sentry-rails" + # Use Active Storage variant # gem 'image_processing', '~> 1.2' diff --git a/Gemfile.lock b/Gemfile.lock index b4bb82e..0e7efd4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -79,6 +79,9 @@ GEM concurrent-ruby (1.1.7) crass (1.0.6) erubi (1.10.0) + faraday (1.1.0) + multipart-post (>= 1.2, < 3) + ruby2_keywords ffi (1.13.1) globalid (0.4.2) activesupport (>= 4.2.0) @@ -102,6 +105,7 @@ GEM mini_portile2 (2.4.0) minitest (5.14.2) msgpack (1.3.3) + multipart-post (2.1.1) nio4r (2.5.4) nokogiri (1.10.10) mini_portile2 (~> 2.4.0) @@ -146,6 +150,7 @@ GEM rb-inotify (0.10.1) ffi (~> 1.0) regexp_parser (1.8.2) + ruby2_keywords (0.0.2) rubyzip (2.3.0) sass-rails (6.0.0) sassc-rails (~> 2.1, >= 2.1.1) @@ -161,6 +166,12 @@ GEM childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) semantic_range (2.3.1) + sentry-rails (4.1.0) + rails (>= 5.0) + sentry-ruby (>= 4.1.0) + sentry-ruby (4.1.0) + concurrent-ruby + faraday (>= 1.0) spring (2.1.1) sprockets (4.0.2) concurrent-ruby (~> 1.0) @@ -212,6 +223,8 @@ DEPENDENCIES rails (~> 6.1.0) sass-rails (>= 6) selenium-webdriver + sentry-rails + sentry-ruby spring sqlite3 (~> 1.4) turbolinks (~> 5) diff --git a/app/assets/stylesheets/catch_all.scss b/app/assets/stylesheets/catch_all.scss new file mode 100644 index 0000000..475855a --- /dev/null +++ b/app/assets/stylesheets/catch_all.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the catch_all controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: https://sass-lang.com/ diff --git a/app/controllers/catch_all_controller.rb b/app/controllers/catch_all_controller.rb new file mode 100644 index 0000000..617f6f7 --- /dev/null +++ b/app/controllers/catch_all_controller.rb @@ -0,0 +1,5 @@ +class CatchAllController < ApplicationController + def log_request + raise "random url called" + end +end diff --git a/app/helpers/catch_all_helper.rb b/app/helpers/catch_all_helper.rb new file mode 100644 index 0000000..62c69b5 --- /dev/null +++ b/app/helpers/catch_all_helper.rb @@ -0,0 +1,2 @@ +module CatchAllHelper +end diff --git a/app/views/catch_all/log_request.html.erb b/app/views/catch_all/log_request.html.erb new file mode 100644 index 0000000..8f74c64 --- /dev/null +++ b/app/views/catch_all/log_request.html.erb @@ -0,0 +1,2 @@ +
Find me in app/views/catch_all/log_request.html.erb
diff --git a/config/initializers/sentry-init.rb b/config/initializers/sentry-init.rb new file mode 100644 index 0000000..2b0e684 --- /dev/null +++ b/config/initializers/sentry-init.rb @@ -0,0 +1,13 @@ +Sentry.init do |config| + config.dsn = 'https://21e1d6525c40490e99d912ddea3969a1@o213594.ingest.sentry.io/5562963' + config.breadcrumbs_logger = [:active_support_logger] + + # To activate performance monitoring, set one of these options. + # We recommend adjusting the value in production: + config.traces_sample_rate = 0.5 + # or + config.traces_sampler = lambda do |context| + true + end +end + diff --git a/config/routes.rb b/config/routes.rb index c06383a..62e33b0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,5 @@ +# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html Rails.application.routes.draw do - # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html + get 'catch_all/log_request' + get '*magic_request_path', to: 'catch_all#log_request' end diff --git a/db/schema.rb b/db/schema.rb new file mode 100644 index 0000000..77bcf0f --- /dev/null +++ b/db/schema.rb @@ -0,0 +1,15 @@ +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# This file is the source Rails uses to define your schema when running `bin/rails +# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to +# be faster and is potentially less error prone than running all of your +# migrations from scratch. Old migrations may fail to apply correctly if those +# migrations use external dependencies or application code. +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 0) do + +end diff --git a/test/controllers/catch_all_controller_test.rb b/test/controllers/catch_all_controller_test.rb new file mode 100644 index 0000000..5f9fc4f --- /dev/null +++ b/test/controllers/catch_all_controller_test.rb @@ -0,0 +1,13 @@ +require "test_helper" + +class CatchAllControllerTest < ActionDispatch::IntegrationTest + test "should get log_request" do + get catch_all_log_request_url + assert_response :success + end + + test "hitting any paths should get log_request" do + get "/foo/bar" + assert_response :success + end +end