sentry-rails 5.7.0 → 5.9.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 +2 -1
- data/lib/sentry/rails/configuration.rb +0 -1
- data/lib/sentry/rails/controller_transaction.rb +27 -3
- data/lib/sentry/rails/error_subscriber.rb +5 -0
- data/lib/sentry/rails/railtie.rb +3 -1
- data/lib/sentry/rails/tracing/action_controller_subscriber.rb +5 -0
- data/lib/sentry/rails/tracing/active_record_subscriber.rb +1 -0
- 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: 93209fe5a0b0e76d0260c3355410492f36d8d72ef4f4852b4345d80656eb9dc6
|
4
|
+
data.tar.gz: e67e804834d28db4c5237757caffded4856d6a9594f337b2412e76c874a1cd58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eadf2d1e97b5ab7a6abf9fdc03609bf1c362e1ebba96b369f895c04a8d8341acbb2d3f121c1d03420fbcb32083abc1a07489a1f1b12b02c99b8b4c8bebfdbd41
|
7
|
+
data.tar.gz: 1c71775f931fd3b08a7dc1567a3baff47d6c56a128f34e5eb8ab42be9c1b89fae3e2201feba4e495e09e1fb8a343039ce4be3ccdc88bcea9ed63c6b024366a06
|
@@ -20,8 +20,9 @@ module Sentry
|
|
20
20
|
scope.set_span(transaction) if transaction
|
21
21
|
|
22
22
|
begin
|
23
|
-
block.call
|
23
|
+
result = block.call
|
24
24
|
finish_transaction(transaction, 200)
|
25
|
+
result
|
25
26
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
26
27
|
Sentry::Rails.capture_exception(e)
|
27
28
|
finish_transaction(transaction, 500)
|
@@ -83,7 +83,6 @@ module Sentry
|
|
83
83
|
%r(\A/{0,2}#{::Rails.application.config.assets.prefix})
|
84
84
|
end
|
85
85
|
@tracing_subscribers = Set.new([
|
86
|
-
Sentry::Rails::Tracing::ActionControllerSubscriber,
|
87
86
|
Sentry::Rails::Tracing::ActionViewSubscriber,
|
88
87
|
Sentry::Rails::Tracing::ActiveRecordSubscriber,
|
89
88
|
Sentry::Rails::Tracing::ActiveStorageSubscriber
|
@@ -2,10 +2,34 @@ module Sentry
|
|
2
2
|
module Rails
|
3
3
|
module ControllerTransaction
|
4
4
|
def self.included(base)
|
5
|
-
base.
|
6
|
-
|
7
|
-
|
5
|
+
base.prepend_around_action(:sentry_around_action)
|
6
|
+
end
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def sentry_around_action
|
11
|
+
if Sentry.initialized?
|
12
|
+
transaction_name = "#{self.class}##{action_name}"
|
13
|
+
Sentry.get_current_scope.set_transaction_name(transaction_name, source: :view)
|
14
|
+
Sentry.with_child_span(op: "view.process_action.action_controller", description: transaction_name) do |child_span|
|
15
|
+
if child_span
|
16
|
+
begin
|
17
|
+
result = yield
|
18
|
+
ensure
|
19
|
+
child_span.set_http_status(response.status)
|
20
|
+
child_span.set_data(:format, request.format)
|
21
|
+
child_span.set_data(:method, request.method)
|
22
|
+
child_span.set_data(:path, request.path)
|
23
|
+
child_span.set_data(:params, request.params)
|
24
|
+
end
|
25
|
+
|
26
|
+
result
|
27
|
+
else
|
28
|
+
yield
|
29
|
+
end
|
8
30
|
end
|
31
|
+
else
|
32
|
+
yield
|
9
33
|
end
|
10
34
|
end
|
11
35
|
end
|
@@ -14,6 +14,11 @@ module Sentry
|
|
14
14
|
tags[:source] = source
|
15
15
|
end
|
16
16
|
|
17
|
+
if context[:tags].is_a?(Hash)
|
18
|
+
context = context.dup
|
19
|
+
tags.merge!(context.delete(:tags))
|
20
|
+
end
|
21
|
+
|
17
22
|
Sentry::Rails.capture_exception(error, level: severity, contexts: { "rails.error" => context }, tags: tags)
|
18
23
|
end
|
19
24
|
end
|
data/lib/sentry/rails/railtie.rb
CHANGED
@@ -56,7 +56,9 @@ module Sentry
|
|
56
56
|
|
57
57
|
at_exit do
|
58
58
|
# TODO: Add a condition for Rails 7.1 to avoid confliction with https://github.com/rails/rails/pull/44999
|
59
|
-
|
59
|
+
if $ERROR_INFO && !($ERROR_INFO.is_a?(SystemExit) && $ERROR_INFO.success?)
|
60
|
+
Sentry::Rails.capture_exception($ERROR_INFO, tags: { source: "runner" })
|
61
|
+
end
|
60
62
|
end
|
61
63
|
end
|
62
64
|
|
@@ -11,6 +11,11 @@ module Sentry
|
|
11
11
|
OP_NAME = "view.process_action.action_controller".freeze
|
12
12
|
|
13
13
|
def self.subscribe!
|
14
|
+
Sentry.logger.warn <<~MSG
|
15
|
+
DEPRECATION WARNING: sentry-rails has changed its approach on controller span recording and #{self.name} is now depreacted.
|
16
|
+
Please stop using or referencing #{self.name} as it will be removed in the next major release.
|
17
|
+
MSG
|
18
|
+
|
14
19
|
subscribe_to_event(EVENT_NAMES) do |event_name, duration, payload|
|
15
20
|
controller = payload[:controller]
|
16
21
|
action = payload[:action]
|
@@ -14,6 +14,7 @@ module Sentry
|
|
14
14
|
|
15
15
|
record_on_current_span(op: SPAN_PREFIX + event_name, start_timestamp: payload[START_TIMESTAMP_NAME], description: payload[:sql], duration: duration) do |span|
|
16
16
|
span.set_data(:connection_id, payload[:connection_id])
|
17
|
+
span.set_tag(:cached, true) if payload.fetch(:cached, false) # cached key is only set for hits in the QueryCache, from Rails 5.1
|
17
18
|
end
|
18
19
|
end
|
19
20
|
end
|
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.9.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:
|
11
|
+
date: 2023-04-19 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.9.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.9.0
|
41
41
|
description: A gem that provides Rails integration for the Sentry error logger
|
42
42
|
email: accounts@sentry.io
|
43
43
|
executables: []
|