sentry-rails 6.0.0 → 6.1.1
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/.rspec +1 -1
- data/Gemfile +7 -5
- data/bin/test +1 -1
- data/lib/sentry/rails/capture_exceptions.rb +1 -0
- data/lib/sentry/rails/log_subscribers/action_controller_subscriber.rb +2 -0
- data/lib/sentry/rails/log_subscribers/action_mailer_subscriber.rb +4 -0
- data/lib/sentry/rails/log_subscribers/active_job_subscriber.rb +8 -0
- data/lib/sentry/rails/log_subscribers/active_record_subscriber.rb +23 -0
- data/lib/sentry/rails/tracing/active_record_subscriber.rb +15 -34
- data/lib/sentry/rails/version.rb +1 -1
- data/sentry-rails.gemspec +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a75df6b4765c66d4c8844187b1cf607e75c8089441e846ecdf6b7bb4fa9e48e4
|
|
4
|
+
data.tar.gz: df1a64e0c65f65600664b2f3259a227debd7d346a0dd5f8ce6497ddbea7b9644
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 46e20af7bc76d8d1b66337c1e25a5fec1eabcae2817960a88d11a76ddea251076f1d39970fefee0b54fb2d80c9f6fec8b1a4b88d299f4a61bdfcf9a0a4cdb1ef
|
|
7
|
+
data.tar.gz: d7637f46e1fb2df9c2d6b5f07bb0c4d075f17ee013979b535d9643354abce15be08eca759851439763e79b747b062ba331a20acd557291ceea54655bdcbec287
|
data/.rspec
CHANGED
data/Gemfile
CHANGED
|
@@ -30,16 +30,18 @@ rails_version = Gem::Version.new(rails_version)
|
|
|
30
30
|
|
|
31
31
|
gem "rails", "~> #{rails_version}"
|
|
32
32
|
|
|
33
|
-
if rails_version >= Gem::Version.new("8.
|
|
34
|
-
gem "rspec-rails"
|
|
33
|
+
if rails_version >= Gem::Version.new("8.1.0")
|
|
34
|
+
gem "rspec-rails", "~> 8.0.0"
|
|
35
|
+
gem "sqlite3", "~> 2.1.1", platform: :ruby
|
|
36
|
+
elsif rails_version >= Gem::Version.new("8.0.0")
|
|
37
|
+
gem "rspec-rails", "~> 8.0.0"
|
|
35
38
|
gem "sqlite3", "~> 2.1.1", platform: :ruby
|
|
36
39
|
elsif rails_version >= Gem::Version.new("7.1.0")
|
|
37
40
|
gem "psych", "~> 4.0.0"
|
|
38
|
-
gem "rspec-rails"
|
|
41
|
+
gem "rspec-rails", "~> 7.0"
|
|
39
42
|
gem "sqlite3", "~> 1.7.3", platform: :ruby
|
|
40
43
|
elsif rails_version >= Gem::Version.new("6.1.0")
|
|
41
|
-
gem "rspec-rails", "~>
|
|
42
|
-
|
|
44
|
+
gem "rspec-rails", "~> 6.0"
|
|
43
45
|
gem "sqlite3", "~> 1.7.3", platform: :ruby
|
|
44
46
|
else
|
|
45
47
|
gem "psych", "~> 3.0.0"
|
data/bin/test
CHANGED
|
@@ -27,6 +27,7 @@ module Sentry
|
|
|
27
27
|
|
|
28
28
|
def capture_exception(exception, env)
|
|
29
29
|
# the exception will be swallowed by ShowExceptions middleware
|
|
30
|
+
return unless Sentry.initialized?
|
|
30
31
|
return if show_exceptions?(exception, env) && !Sentry.configuration.rails.report_rescued_exceptions
|
|
31
32
|
|
|
32
33
|
Sentry::Rails.capture_exception(exception).tap do |event|
|
|
@@ -26,6 +26,8 @@ module Sentry
|
|
|
26
26
|
#
|
|
27
27
|
# @param event [ActiveSupport::Notifications::Event] The email delivery event
|
|
28
28
|
def deliver(event)
|
|
29
|
+
return unless Sentry.initialized?
|
|
30
|
+
|
|
29
31
|
payload = event.payload
|
|
30
32
|
|
|
31
33
|
mailer = payload[:mailer]
|
|
@@ -57,6 +59,8 @@ module Sentry
|
|
|
57
59
|
#
|
|
58
60
|
# @param event [ActiveSupport::Notifications::Event] The email processing event
|
|
59
61
|
def process(event)
|
|
62
|
+
return unless Sentry.initialized?
|
|
63
|
+
|
|
60
64
|
payload = event.payload
|
|
61
65
|
|
|
62
66
|
mailer = payload[:mailer]
|
|
@@ -26,6 +26,8 @@ module Sentry
|
|
|
26
26
|
#
|
|
27
27
|
# @param event [ActiveSupport::Notifications::Event] The job performance event
|
|
28
28
|
def perform(event)
|
|
29
|
+
return unless Sentry.initialized?
|
|
30
|
+
|
|
29
31
|
job = event.payload[:job]
|
|
30
32
|
duration = duration_ms(event)
|
|
31
33
|
|
|
@@ -63,6 +65,8 @@ module Sentry
|
|
|
63
65
|
#
|
|
64
66
|
# @param event [ActiveSupport::Notifications::Event] The job enqueue event
|
|
65
67
|
def enqueue(event)
|
|
68
|
+
return unless Sentry.initialized?
|
|
69
|
+
|
|
66
70
|
job = event.payload[:job]
|
|
67
71
|
|
|
68
72
|
attributes = {
|
|
@@ -89,6 +93,8 @@ module Sentry
|
|
|
89
93
|
end
|
|
90
94
|
|
|
91
95
|
def retry_stopped(event)
|
|
96
|
+
return unless Sentry.initialized?
|
|
97
|
+
|
|
92
98
|
job = event.payload[:job]
|
|
93
99
|
error = event.payload[:error]
|
|
94
100
|
|
|
@@ -111,6 +117,8 @@ module Sentry
|
|
|
111
117
|
end
|
|
112
118
|
|
|
113
119
|
def discard(event)
|
|
120
|
+
return unless Sentry.initialized?
|
|
121
|
+
|
|
114
122
|
job = event.payload[:job]
|
|
115
123
|
error = event.payload[:error]
|
|
116
124
|
|
|
@@ -29,6 +29,8 @@ module Sentry
|
|
|
29
29
|
#
|
|
30
30
|
# @param event [ActiveSupport::Notifications::Event] The SQL event
|
|
31
31
|
def sql(event)
|
|
32
|
+
return unless Sentry.initialized?
|
|
33
|
+
return if logger && !logger.info?
|
|
32
34
|
return if EXCLUDED_NAMES.include?(event.payload[:name])
|
|
33
35
|
|
|
34
36
|
sql = event.payload[:sql]
|
|
@@ -46,6 +48,17 @@ module Sentry
|
|
|
46
48
|
cached: cached
|
|
47
49
|
}
|
|
48
50
|
|
|
51
|
+
binds = event.payload[:binds]
|
|
52
|
+
|
|
53
|
+
if Sentry.configuration.send_default_pii && !binds&.empty?
|
|
54
|
+
type_casted_binds = type_casted_binds(event)
|
|
55
|
+
|
|
56
|
+
binds.each_with_index do |bind, index|
|
|
57
|
+
name = bind.is_a?(Symbol) ? bind : bind.name
|
|
58
|
+
attributes["db.query.parameter.#{name}"] = type_casted_binds[index].to_s
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
49
62
|
attributes[:statement_name] = statement_name if statement_name && statement_name != "SQL"
|
|
50
63
|
attributes[:connection_id] = connection_id if connection_id
|
|
51
64
|
|
|
@@ -60,6 +73,16 @@ module Sentry
|
|
|
60
73
|
)
|
|
61
74
|
end
|
|
62
75
|
|
|
76
|
+
if RUBY_ENGINE == "jruby"
|
|
77
|
+
def type_casted_binds(event)
|
|
78
|
+
event.payload[:type_casted_binds].call
|
|
79
|
+
end
|
|
80
|
+
else
|
|
81
|
+
def type_casted_binds(event)
|
|
82
|
+
event.payload[:type_casted_binds]
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
63
86
|
private
|
|
64
87
|
|
|
65
88
|
def build_log_message(statement_name)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "sentry/rails/tracing/abstract_subscriber"
|
|
4
|
+
require "sentry/backtrace"
|
|
4
5
|
|
|
5
6
|
module Sentry
|
|
6
7
|
module Rails
|
|
@@ -14,9 +15,11 @@ module Sentry
|
|
|
14
15
|
SUPPORT_SOURCE_LOCATION = ActiveSupport::BacktraceCleaner.method_defined?(:clean_frame)
|
|
15
16
|
|
|
16
17
|
if SUPPORT_SOURCE_LOCATION
|
|
17
|
-
|
|
18
|
+
backtrace_cleaner = ActiveSupport::BacktraceCleaner.new.tap do |cleaner|
|
|
18
19
|
cleaner.add_silencer { |line| line.include?("sentry-ruby/lib") || line.include?("sentry-rails/lib") }
|
|
19
|
-
end)
|
|
20
|
+
end.method(:clean_frame)
|
|
21
|
+
|
|
22
|
+
class_attribute :backtrace_cleaner, default: backtrace_cleaner
|
|
20
23
|
end
|
|
21
24
|
|
|
22
25
|
class << self
|
|
@@ -62,43 +65,21 @@ module Sentry
|
|
|
62
65
|
span.set_data(Span::DataConventions::SERVER_PORT, db_config[:port]) if db_config[:port]
|
|
63
66
|
span.set_data(Span::DataConventions::SERVER_SOCKET_ADDRESS, db_config[:socket]) if db_config[:socket]
|
|
64
67
|
|
|
65
|
-
next unless record_query_source
|
|
66
|
-
|
|
67
68
|
# both duration and query_source_threshold are in ms
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
# Only JRuby has namespace in the backtrace
|
|
79
|
-
span.set_data(Span::DataConventions::NAMESPACE, backtrace_line.module_name) if backtrace_line.module_name
|
|
69
|
+
if record_query_source && duration >= query_source_threshold
|
|
70
|
+
backtrace_line = Backtrace.source_location(&backtrace_cleaner)
|
|
71
|
+
|
|
72
|
+
if backtrace_line
|
|
73
|
+
span.set_data(Span::DataConventions::FILEPATH, backtrace_line.file) if backtrace_line.file
|
|
74
|
+
span.set_data(Span::DataConventions::LINENO, backtrace_line.number) if backtrace_line.number
|
|
75
|
+
span.set_data(Span::DataConventions::FUNCTION, backtrace_line.method) if backtrace_line.method
|
|
76
|
+
# Only JRuby has namespace in the backtrace
|
|
77
|
+
span.set_data(Span::DataConventions::NAMESPACE, backtrace_line.module_name) if backtrace_line.module_name
|
|
78
|
+
end
|
|
80
79
|
end
|
|
81
80
|
end
|
|
82
81
|
end
|
|
83
82
|
end
|
|
84
|
-
|
|
85
|
-
# Thread.each_caller_location is an API added in Ruby 3.2 that doesn't always collect the entire stack like
|
|
86
|
-
# Kernel#caller or #caller_locations do. See https://github.com/rails/rails/pull/49095 for more context.
|
|
87
|
-
if SUPPORT_SOURCE_LOCATION && Thread.respond_to?(:each_caller_location)
|
|
88
|
-
def query_source_location
|
|
89
|
-
Thread.each_caller_location do |location|
|
|
90
|
-
frame = backtrace_cleaner.clean_frame(location)
|
|
91
|
-
return frame if frame
|
|
92
|
-
end
|
|
93
|
-
nil
|
|
94
|
-
end
|
|
95
|
-
else
|
|
96
|
-
# Since Sentry is mostly used in production, we don't want to fallback to the slower implementation
|
|
97
|
-
# and adds potentially big overhead to the application.
|
|
98
|
-
def query_source_location
|
|
99
|
-
nil
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
83
|
end
|
|
103
84
|
end
|
|
104
85
|
end
|
data/lib/sentry/rails/version.rb
CHANGED
data/sentry-rails.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sentry-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.
|
|
4
|
+
version: 6.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sentry Team
|
|
@@ -29,14 +29,14 @@ dependencies:
|
|
|
29
29
|
requirements:
|
|
30
30
|
- - "~>"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: 6.
|
|
32
|
+
version: 6.1.1
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: 6.
|
|
39
|
+
version: 6.1.1
|
|
40
40
|
description: A gem that provides Rails integration for the Sentry error logger
|
|
41
41
|
email: accounts@sentry.io
|
|
42
42
|
executables: []
|
|
@@ -89,15 +89,15 @@ files:
|
|
|
89
89
|
- lib/sentry/rails/tracing/active_support_subscriber.rb
|
|
90
90
|
- lib/sentry/rails/version.rb
|
|
91
91
|
- sentry-rails.gemspec
|
|
92
|
-
homepage: https://github.com/getsentry/sentry-ruby/tree/6.
|
|
92
|
+
homepage: https://github.com/getsentry/sentry-ruby/tree/6.1.1/sentry-rails
|
|
93
93
|
licenses:
|
|
94
94
|
- MIT
|
|
95
95
|
metadata:
|
|
96
|
-
homepage_uri: https://github.com/getsentry/sentry-ruby/tree/6.
|
|
97
|
-
source_code_uri: https://github.com/getsentry/sentry-ruby/tree/6.
|
|
98
|
-
changelog_uri: https://github.com/getsentry/sentry-ruby/blob/6.
|
|
96
|
+
homepage_uri: https://github.com/getsentry/sentry-ruby/tree/6.1.1/sentry-rails
|
|
97
|
+
source_code_uri: https://github.com/getsentry/sentry-ruby/tree/6.1.1/sentry-rails
|
|
98
|
+
changelog_uri: https://github.com/getsentry/sentry-ruby/blob/6.1.1/CHANGELOG.md
|
|
99
99
|
bug_tracker_uri: https://github.com/getsentry/sentry-ruby/issues
|
|
100
|
-
documentation_uri: http://www.rubydoc.info/gems/sentry-rails/6.
|
|
100
|
+
documentation_uri: http://www.rubydoc.info/gems/sentry-rails/6.1.1
|
|
101
101
|
rdoc_options: []
|
|
102
102
|
require_paths:
|
|
103
103
|
- lib
|