File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
sentry-ruby/lib/sentry/rack Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -63,16 +63,17 @@ def capture_exception(exception, env)
6363 end
6464
6565 def start_transaction ( env , scope )
66+ # Tell Sentry to not sample this transaction if this is an HTTP OPTIONS or HEAD request.
67+ # Return early to avoid extra work that's not useful anyway, because this
68+ # transaction won't be sampled.
69+ # If we return nil here, it'll be passed to `finish_transaction` later, which is safe.
70+ return nil if IGNORED_HTTP_METHODS . include? ( env [ "REQUEST_METHOD" ] )
71+
6672 options = {
6773 name : scope . transaction_name ,
6874 source : scope . transaction_source ,
6975 op : transaction_op
7076 }
71-
72- # Tell Sentry to not sample this transaction if this is an HTTP OPTIONS or HEAD request.
73- if IGNORED_HTTP_METHODS . include? ( env [ "REQUEST_METHOD" ] )
74- options . merge! ( sampled : false )
75- end
7677
7778 transaction = Sentry . continue_trace ( env , **options )
7879 Sentry . start_transaction ( transaction : transaction , custom_sampling_context : { env : env } , **options )
You can’t perform that action at this time.
0 commit comments