Browse Source

Add Sentry monitoring to Rails parts

Maarten van den Berg 7 years ago
parent
commit
caf29f5c9e
4 changed files with 16 additions and 0 deletions
  1. 3 0
      .rbenv-vars-sample
  2. 3 0
      Gemfile
  3. 6 0
      Gemfile.lock
  4. 4 0
      app/helpers/authentication_helper.rb

+ 3 - 0
.rbenv-vars-sample

@@ -35,3 +35,6 @@ MAILGUN_API_KEY=
35 35
 
36 36
 # Do we bind to a socket or port?
37 37
 PUMA_BIND=
38
+
39
+# Set to enable Sentry reporting
40
+SENTRY_DSN=

+ 3 - 0
Gemfile

@@ -64,6 +64,9 @@ gem 'delayed_job'
64 64
 gem 'delayed_job_active_record'
65 65
 gem 'daemons'
66 66
 
67
+# Error reporting
68
+gem 'sentry-raven'
69
+
67 70
 group :development, :test do
68 71
   # Call 'byebug' anywhere in the code to stop execution and get a debugger console
69 72
   gem 'byebug', platform: :mri

+ 6 - 0
Gemfile.lock

@@ -75,6 +75,8 @@ GEM
75 75
     execjs (2.7.0)
76 76
     faker (1.7.3)
77 77
       i18n (~> 0.5)
78
+    faraday (0.14.0)
79
+      multipart-post (>= 1.2, < 3)
78 80
     ffi (1.9.18)
79 81
     font-awesome-sass (4.7.0)
80 82
       sass (>= 3.2)
@@ -113,6 +115,7 @@ GEM
113 115
     mini_portile2 (2.1.0)
114 116
     minitest (5.10.1)
115 117
     multi_json (1.12.1)
118
+    multipart-post (2.0.0)
116 119
     netrc (0.11.0)
117 120
     nio4r (2.0.0)
118 121
     nokogiri (1.7.1)
@@ -163,6 +166,8 @@ GEM
163 166
       sprockets (>= 2.8, < 4.0)
164 167
       sprockets-rails (>= 2.0, < 4.0)
165 168
       tilt (>= 1.1, < 3)
169
+    sentry-raven (2.7.2)
170
+      faraday (>= 0.7.6, < 1.0)
166 171
     spring (2.0.1)
167 172
       activesupport (>= 4.2)
168 173
     spring-watcher-listen (2.0.1)
@@ -231,6 +236,7 @@ DEPENDENCIES
231 236
   rabl
232 237
   rails (~> 5.0.0, >= 5.0.0.1)
233 238
   sass-rails (~> 5.0)
239
+  sentry-raven
234 240
   spring
235 241
   spring-watcher-listen (~> 2.0.0)
236 242
   sqlite3

+ 4 - 0
app/helpers/authentication_helper.rb

@@ -123,6 +123,10 @@ module AuthenticationHelper
123 123
       redirect_to controller: 'authentication', action: 'login_form'
124 124
       return false
125 125
     end
126
+
127
+    Raven.user_context(
128
+      user_firstname: current_person.first_name
129
+    )
126 130
     return true
127 131
   end
128 132