Skip to content

Commit d8891f3

Browse files
committed
Added rails and actioncable exceptions, and moved changelog
1 parent 7afd73d commit d8891f3

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737

3838
- Pick up config.cron.default_timezone from Rails config ([#2213](https://github.com/getsentry/sentry-ruby/pull/2213))
3939

40+
### Bug Fixes
41+
42+
- Sentry will not record traces of HTTP OPTIONS and HEAD requests in Rack and Rails apps [#2181](https://github.com/getsentry/sentry-ruby/pull/2181)
43+
4044
## 5.15.2
4145

4246
### Bug Fixes
@@ -65,7 +69,6 @@
6569
### Bug Fixes
6670

6771
- Network errors raised in `Sentry::HTTPTransport` will no longer be reported to Sentry [#2178](https://github.com/getsentry/sentry-ruby/pull/2178)
68-
- Sentry will not record traces of HTTP OPTIONS and HEAD requests in Rack and Rails apps [#2181](https://github.com/getsentry/sentry-ruby/pull/2181)
6972

7073
## 5.14.0
7174

sentry-rails/lib/sentry/rails/action_cable.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module Rails
33
module ActionCableExtensions
44
class ErrorHandler
55
OP_NAME = "websocket.server".freeze
6+
IGNORED_HTTP_METHODS = ["HEAD", "OPTIONS"].freeze
67

78
class << self
89
def capture(connection, transaction_name:, extra_context: nil, &block)
@@ -33,6 +34,8 @@ def capture(connection, transaction_name:, extra_context: nil, &block)
3334
end
3435

3536
def start_transaction(env, scope)
37+
return nil if IGNORED_HTTP_METHODS.include?(env["REQUEST_METHOD"])
38+
3639
options = { name: scope.transaction_name, source: scope.transaction_source, op: OP_NAME }
3740
transaction = Sentry.continue_trace(env, **options)
3841
Sentry.start_transaction(transaction: transaction, **options)

sentry-rails/lib/sentry/rails/capture_exceptions.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ module Sentry
22
module Rails
33
class CaptureExceptions < Sentry::Rack::CaptureExceptions
44
RAILS_7_1 = Gem::Version.new(::Rails.version) >= Gem::Version.new("7.1.0.alpha")
5+
IGNORED_HTTP_METHODS = ["HEAD", "OPTIONS"].freeze
56

67
def initialize(_)
78
super
@@ -32,6 +33,8 @@ def capture_exception(exception, env)
3233
end
3334

3435
def start_transaction(env, scope)
36+
return nil if IGNORED_HTTP_METHODS.include?(env["REQUEST_METHOD"])
37+
3538
options = { name: scope.transaction_name, source: scope.transaction_source, op: transaction_op }
3639

3740
if @assets_regexp && scope.transaction_name.match?(@assets_regexp)

0 commit comments

Comments
 (0)