File tree Expand file tree Collapse file tree 3 files changed +52
-1
lines changed
Expand file tree Collapse file tree 3 files changed +52
-1
lines changed Original file line number Diff line number Diff line change 11class ApplicationController < ActionController ::Base
22 before_action :set_locale
3+ before_action :populate_sentry_scope
34
45 private
56
@@ -59,4 +60,46 @@ def require_sponsorship_session
5960 redirect_to new_user_session_path ( back_to : url_for ( params . to_unsafe_h . merge ( only_path : true ) ) )
6061 end
6162 end
63+
64+ def populate_sentry_scope
65+ Sentry . configure_scope do |scope |
66+ if current_staff
67+ scope . set_context (
68+ 'sponsor-app.staff' ,
69+ {
70+ id : current_staff . id ,
71+ login : current_staff . login ,
72+ }
73+ )
74+ end
75+
76+ if current_sponsorship
77+ scope . set_context (
78+ 'sponsor-app.sponsor' ,
79+ {
80+ id : current_sponsorship . id ,
81+ name : current_sponsorship . name ,
82+ }
83+ )
84+ end
85+
86+ if current_conference
87+ scope . set_context (
88+ 'sponsor-app.conference' ,
89+ {
90+ id : current_conference . id ,
91+ slug : current_conference . slug ,
92+ }
93+ )
94+ end
95+
96+ case
97+ when current_staff
98+ Sentry . set_user ( id : "staff_#{ current_staff . id } " , username : current_staff . login )
99+ when current_sponsorship
100+ email = session [ :email ] ||= current_sponsorship . contact &.email
101+ Sentry . set_user ( id : "#{ current_sponsorship . id } " , email : )
102+ end
103+ end
104+ end
62105end
Original file line number Diff line number Diff line change 11import * as Sentry from "@sentry/browser" ;
22
33if ( window . SENTRY_DSN ) {
4- Sentry . init ( { dsn : window . SENTRY_DSN } ) ;
4+ Sentry . init ( {
5+ dsn : window . SENTRY_DSN ,
6+ release : window . APP_VERSION ,
7+ tracesSampleRate : 0.2 ,
8+ } ) ;
59}
Original file line number Diff line number Diff line change 11Sentry . init do |config |
22 config . dsn = ENV [ 'SENTRY_DSN' ]
33 config . background_worker_threads = 0 if ENV [ 'AWS_LAMBDA_FUNCTION_NAME' ]
4+
5+ config . traces_sample_rate = 0.25
6+ config . enable_logs = true
7+ config . breadcrumbs_logger = [ :active_support_logger , :http_logger ]
48end
You can’t perform that action at this time.
0 commit comments