File tree 1 file changed +6
-5
lines changed
sentry-ruby/lib/sentry/rack
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)
63
63
end
64
64
65
65
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
+
66
72
options = {
67
73
name : scope . transaction_name ,
68
74
source : scope . transaction_source ,
69
75
op : transaction_op
70
76
}
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
76
77
77
78
transaction = Sentry . continue_trace ( env , **options )
78
79
Sentry . start_transaction ( transaction : transaction , custom_sampling_context : { env : env } , **options )
You can’t perform that action at this time.
0 commit comments