sentry-rails 5.5.0 → 5.7.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/railtie.rb +1 -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: 39e565d80c5e7b06167a001ffeb76c3fdb7c572d3ccb8649f7535c3b993b3941
|
4
|
+
data.tar.gz: 01740ea86056c45a8c0395a3604fe21e1ebf37094ae8fb7b2f4a84f2269e0078
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd73427c4b45e52aa7472364c63c762879e86255e291333323a01c637ecddaba496a2fe8bdeaca42c2547113268d940c5c37afe9a30d714b5d1c247b1141090a
|
7
|
+
data.tar.gz: 2cacd8fa7398b013b9bf2b78859485b9097a5eb5c3428b564c2f5e687d006b68ef1b6a927bf4dd62a3eb6193b46f8b5cc35be8530f2142f284e227a0392d569d
|
@@ -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
|
data/lib/sentry/rails/railtie.rb
CHANGED
@@ -115,7 +115,7 @@ module Sentry
|
|
115
115
|
end
|
116
116
|
|
117
117
|
def activate_tracing
|
118
|
-
if Sentry.configuration.tracing_enabled?
|
118
|
+
if Sentry.configuration.tracing_enabled? && Sentry.configuration.instrumenter == :sentry
|
119
119
|
subscribers = Sentry.configuration.rails.tracing_subscribers
|
120
120
|
Sentry::Rails::Tracing.register_subscribers(subscribers)
|
121
121
|
Sentry::Rails::Tracing.subscribe_tracing_events
|
@@ -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.7.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-12-01 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.7.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.7.0
|
41
41
|
description: A gem that provides Rails integration for the Sentry error logger
|
42
42
|
email: accounts@sentry.io
|
43
43
|
executables: []
|