sentry-rails 5.7.0 → 5.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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: 7338e366bfa078e533320c9d9fcac994ca4202104a3a3efb2069644d4ac80e9c
|
4
|
+
data.tar.gz: 27b90498fc73e7884ffcdea4733244723fa0e6f8a48d3322f9e7a91b25f8b73b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c67ec56cf2d1cd69d8808f7a83ce2af69fea58781fff3c5979bac4005ea077451b9682e6e45b1b8333d9d1b42cb29690dc53cc59b6baef4ba2ef47895bd0bb0
|
7
|
+
data.tar.gz: 1ec19c91b4d6e7bd2255c2f73ad12f035d90433a1d36a6fbba4f7ec21cbe6d5694b9ec44690ac22411003ab2e6948b9a56da8ba441123a84daa1d4b477266a51
|
@@ -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.8.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-02-06 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.8.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.8.0
|
41
41
|
description: A gem that provides Rails integration for the Sentry error logger
|
42
42
|
email: accounts@sentry.io
|
43
43
|
executables: []
|