sentry-rails 5.5.0 → 5.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sentry/rails/action_cable.rb +3 -1
- data/lib/sentry/rails/active_job.rb +3 -1
- data/lib/sentry/rails/background_worker.rb +5 -2
- data/lib/sentry/rails/capture_exceptions.rb +5 -5
- data/lib/sentry/rails/configuration.rb +18 -0
- data/lib/sentry/rails/controller_transaction.rb +3 -1
- data/lib/sentry/rails/tracing/action_controller_subscriber.rb +2 -1
- data/lib/sentry/rails/tracing/active_storage_subscriber.rb +1 -1
- data/lib/sentry/rails/tracing.rb +1 -1
- data/lib/sentry/rails/version.rb +1 -1
- data/sentry-rails.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bf51e07c223ef36d3cbe5ad72f7dad533159d05c1665b896a068394770327e4
|
4
|
+
data.tar.gz: 95c2fefcecd78940fc3e847cff711f855dda399d35adf6a6a343507304cd2e2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc9954d8ba18402bc7f20e3393d505b4cac9d422e3378261f793a7b19d2e478ca5585a5dd3ef5aa3a44424b84df102262ad63742e30ec31c39efd9b93dcffc66
|
7
|
+
data.tar.gz: ea7cb4dbf2f445a69802f8e6d171edebf21617b2fccddfa34152a3d1a90f813dbdd86ad227da328fa1509b8d72e7171375f6f885cc673c53d3afa6bb2864bf0b
|
@@ -2,6 +2,8 @@ module Sentry
|
|
2
2
|
module Rails
|
3
3
|
module ActionCableExtensions
|
4
4
|
class ErrorHandler
|
5
|
+
OP_NAME = "websocket.server".freeze
|
6
|
+
|
5
7
|
class << self
|
6
8
|
def capture(connection, transaction_name:, extra_context: nil, &block)
|
7
9
|
return block.call unless Sentry.initialized?
|
@@ -33,7 +35,7 @@ module Sentry
|
|
33
35
|
sentry_trace = env["HTTP_SENTRY_TRACE"]
|
34
36
|
baggage = env["HTTP_BAGGAGE"]
|
35
37
|
|
36
|
-
options = { name: scope.transaction_name, source: scope.transaction_source, op:
|
38
|
+
options = { name: scope.transaction_name, source: scope.transaction_source, op: OP_NAME }
|
37
39
|
transaction = Sentry::Transaction.from_sentry_trace(sentry_trace, baggage: baggage, **options) if sentry_trace
|
38
40
|
Sentry.start_transaction(transaction: transaction, **options)
|
39
41
|
end
|
@@ -16,6 +16,8 @@ module Sentry
|
|
16
16
|
end
|
17
17
|
|
18
18
|
class SentryReporter
|
19
|
+
OP_NAME = "queue.active_job".freeze
|
20
|
+
|
19
21
|
class << self
|
20
22
|
def record(job, &block)
|
21
23
|
Sentry.with_scope do |scope|
|
@@ -25,7 +27,7 @@ module Sentry
|
|
25
27
|
if job.is_a?(::Sentry::SendEventJob)
|
26
28
|
nil
|
27
29
|
else
|
28
|
-
Sentry.start_transaction(name: scope.transaction_name, source: scope.transaction_source, op:
|
30
|
+
Sentry.start_transaction(name: scope.transaction_name, source: scope.transaction_source, op: OP_NAME)
|
29
31
|
end
|
30
32
|
|
31
33
|
scope.set_span(transaction) if transaction
|
@@ -3,8 +3,11 @@ module Sentry
|
|
3
3
|
def _perform(&block)
|
4
4
|
block.call
|
5
5
|
ensure
|
6
|
-
#
|
7
|
-
ActiveRecord::Base.
|
6
|
+
# some applications have partial or even no AR connection
|
7
|
+
if ActiveRecord::Base.connected?
|
8
|
+
# make sure the background worker returns AR connection if it accidentally acquire one during serialization
|
9
|
+
ActiveRecord::Base.connection_pool.release_connection
|
10
|
+
end
|
8
11
|
end
|
9
12
|
end
|
10
13
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module Sentry
|
2
2
|
module Rails
|
3
3
|
class CaptureExceptions < Sentry::Rack::CaptureExceptions
|
4
|
-
def initialize(
|
4
|
+
def initialize(_)
|
5
5
|
super
|
6
6
|
|
7
|
-
if
|
8
|
-
@
|
7
|
+
if Sentry.initialized?
|
8
|
+
@assets_regexp = Sentry.configuration.rails.assets_regexp
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -17,7 +17,7 @@ module Sentry
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def transaction_op
|
20
|
-
"
|
20
|
+
"http.server".freeze
|
21
21
|
end
|
22
22
|
|
23
23
|
def capture_exception(exception, env)
|
@@ -36,7 +36,7 @@ module Sentry
|
|
36
36
|
|
37
37
|
options = { name: scope.transaction_name, source: scope.transaction_source, op: transaction_op }
|
38
38
|
|
39
|
-
if @
|
39
|
+
if @assets_regexp && scope.transaction_name.match?(@assets_regexp)
|
40
40
|
options.merge!(sampled: false)
|
41
41
|
end
|
42
42
|
|
@@ -60,10 +60,28 @@ module Sentry
|
|
60
60
|
|
61
61
|
attr_accessor :tracing_subscribers
|
62
62
|
|
63
|
+
# sentry-rails by default skips asset request' transactions by checking if the path matches
|
64
|
+
#
|
65
|
+
# ```rb
|
66
|
+
# %r(\A/{0,2}#{::Rails.application.config.assets.prefix})
|
67
|
+
# ```
|
68
|
+
#
|
69
|
+
# If you want to use a different pattern, you can configure the `assets_regexp` option like:
|
70
|
+
#
|
71
|
+
# ```rb
|
72
|
+
# Sentry.init do |config|
|
73
|
+
# config.rails.assets_regexp = /my_regexp/
|
74
|
+
# end
|
75
|
+
# ```
|
76
|
+
attr_accessor :assets_regexp
|
77
|
+
|
63
78
|
def initialize
|
64
79
|
@register_error_subscriber = false
|
65
80
|
@report_rescued_exceptions = true
|
66
81
|
@skippable_job_adapters = []
|
82
|
+
@assets_regexp = if defined?(::Sprockets::Rails)
|
83
|
+
%r(\A/{0,2}#{::Rails.application.config.assets.prefix})
|
84
|
+
end
|
67
85
|
@tracing_subscribers = Set.new([
|
68
86
|
Sentry::Rails::Tracing::ActionControllerSubscriber,
|
69
87
|
Sentry::Rails::Tracing::ActionViewSubscriber,
|
@@ -3,7 +3,9 @@ module Sentry
|
|
3
3
|
module ControllerTransaction
|
4
4
|
def self.included(base)
|
5
5
|
base.prepend_before_action do |controller|
|
6
|
-
Sentry.
|
6
|
+
if Sentry.initialized?
|
7
|
+
Sentry.get_current_scope.set_transaction_name("#{controller.class}##{controller.action_name}", source: :view)
|
8
|
+
end
|
7
9
|
end
|
8
10
|
end
|
9
11
|
end
|
@@ -8,6 +8,7 @@ module Sentry
|
|
8
8
|
extend InstrumentPayloadCleanupHelper
|
9
9
|
|
10
10
|
EVENT_NAMES = ["process_action.action_controller"].freeze
|
11
|
+
OP_NAME = "view.process_action.action_controller".freeze
|
11
12
|
|
12
13
|
def self.subscribe!
|
13
14
|
subscribe_to_event(EVENT_NAMES) do |event_name, duration, payload|
|
@@ -15,7 +16,7 @@ module Sentry
|
|
15
16
|
action = payload[:action]
|
16
17
|
|
17
18
|
record_on_current_span(
|
18
|
-
op:
|
19
|
+
op: OP_NAME,
|
19
20
|
start_timestamp: payload[START_TIMESTAMP_NAME],
|
20
21
|
description: "#{controller}##{action}",
|
21
22
|
duration: duration
|
@@ -21,7 +21,7 @@ module Sentry
|
|
21
21
|
|
22
22
|
def self.subscribe!
|
23
23
|
subscribe_to_event(EVENT_NAMES) do |event_name, duration, payload|
|
24
|
-
record_on_current_span(op: event_name, start_timestamp: payload[START_TIMESTAMP_NAME], description: payload[:service], duration: duration) do |span|
|
24
|
+
record_on_current_span(op: "file.#{event_name}".freeze, start_timestamp: payload[START_TIMESTAMP_NAME], description: payload[:service], duration: duration) do |span|
|
25
25
|
payload.each do |key, value|
|
26
26
|
span.set_data(key, value) unless key == START_TIMESTAMP_NAME
|
27
27
|
end
|
data/lib/sentry/rails/tracing.rb
CHANGED
data/lib/sentry/rails/version.rb
CHANGED
data/sentry-rails.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sentry-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sentry Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 5.
|
33
|
+
version: 5.6.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 5.
|
40
|
+
version: 5.6.0
|
41
41
|
description: A gem that provides Rails integration for the Sentry error logger
|
42
42
|
email: accounts@sentry.io
|
43
43
|
executables: []
|