sentry-rails 4.1.4 → 4.1.5
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/CHANGELOG.md +11 -0
- data/lib/sentry/rails/active_job.rb +9 -5
- data/lib/sentry/rails/breadcrumb/active_support_logger.rb +13 -3
- data/lib/sentry/rails/configuration.rb +1 -0
- data/lib/sentry/rails/railtie.rb +2 -2
- data/lib/sentry/rails/rescued_exception_interceptor.rb +9 -0
- data/lib/sentry/rails/tracing/action_view_subscriber.rb +3 -11
- data/lib/sentry/rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea1c3fea4d0f1f017e5b56786e85414e459a181e8e4cebe2a45374b6c3e648dc
|
4
|
+
data.tar.gz: b41da6b3dc3a3a7836ed533029821b4f53dc40e8b7cb0d10023a52af13236218
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 359b3757908046fa6dfde636715b598a6977c3a131b11e4a7f8d8df3666246e867867ca3c32161bbb645fe9bc0110c50efac415ed42b4db754e21cf36878af86
|
7
|
+
data.tar.gz: 4605d701de78b04adc04c74dc7b7dd1a1e02c1d500a663965d4ba9de35cf35db4a70331d21afd2b2c07a5c2917d2ccb0e2b7a7cced8f5026188e189cf119ecdb
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 4.1.5
|
4
|
+
|
5
|
+
- Add `ActionDispatch::Http::MimeNegotiation::InvalidType` to the list of default ignored Rails exceptions [#1215](https://github.com/getsentry/sentry-ruby/pull/1215) (by @agrobbin)
|
6
|
+
- Continue ActiveJob execution if Sentry is not initialized [#1217](https://github.com/getsentry/sentry-ruby/pull/1217)
|
7
|
+
- Fixes [#1211](https://github.com/getsentry/sentry-ruby/issues/1211) and [#1216](https://github.com/getsentry/sentry-ruby/issues/1216)
|
8
|
+
- Only extend ActiveJob when it's defined [#1218](https://github.com/getsentry/sentry-ruby/pull/1218)
|
9
|
+
- Fixes [#1210](https://github.com/getsentry/sentry-ruby/issues/1210)
|
10
|
+
- Filter out redundant event/payload from breadcrumbs logger [#1222](https://github.com/getsentry/sentry-ruby/pull/1222)
|
11
|
+
- Copy request env before Rails' ShowExceptions middleware [#1223](https://github.com/getsentry/sentry-ruby/pull/1223)
|
12
|
+
- Don't subscribe render_partial and render_collection events [#1224](https://github.com/getsentry/sentry-ruby/pull/1224)
|
13
|
+
|
3
14
|
## 4.1.4
|
4
15
|
|
5
16
|
- Don't include headers & request info in tracing span or breadcrumb [#1199](https://github.com/getsentry/sentry-ruby/pull/1199)
|
@@ -8,12 +8,16 @@ module Sentry
|
|
8
8
|
def self.included(base)
|
9
9
|
base.class_eval do
|
10
10
|
around_perform do |job, block|
|
11
|
-
if
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
if Sentry.initialized?
|
12
|
+
if already_supported_by_specific_integration?(job)
|
13
|
+
block.call
|
14
|
+
else
|
15
|
+
Sentry.with_scope do
|
16
|
+
capture_and_reraise_with_sentry(job, block)
|
17
|
+
end
|
16
18
|
end
|
19
|
+
else
|
20
|
+
block.call
|
17
21
|
end
|
18
22
|
end
|
19
23
|
end
|
@@ -3,12 +3,16 @@ module Sentry
|
|
3
3
|
module Breadcrumb
|
4
4
|
module ActiveSupportLogger
|
5
5
|
class << self
|
6
|
+
IGNORED_DATA_TYPES = [:request, :headers, :exception, :exception_object]
|
7
|
+
|
6
8
|
def add(name, started, _finished, _unique_id, data)
|
7
|
-
|
9
|
+
# skip Rails' internal events
|
10
|
+
return if name.start_with?("!")
|
11
|
+
|
12
|
+
if data.is_a?(Hash)
|
8
13
|
# we should only mutate the copy of the data
|
9
14
|
data = data.dup
|
10
|
-
data
|
11
|
-
data.delete(:headers)
|
15
|
+
cleanup_data(data)
|
12
16
|
end
|
13
17
|
|
14
18
|
crumb = Sentry::Breadcrumb.new(
|
@@ -19,6 +23,12 @@ module Sentry
|
|
19
23
|
Sentry.add_breadcrumb(crumb)
|
20
24
|
end
|
21
25
|
|
26
|
+
def cleanup_data(data)
|
27
|
+
IGNORED_DATA_TYPES.each do |key|
|
28
|
+
data.delete(key) if data.key?(key)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
22
32
|
def inject
|
23
33
|
@subscriber = ::ActiveSupport::Notifications.subscribe(/.*/) do |name, started, finished, unique_id, data|
|
24
34
|
# we only record events that has a started timestamp
|
@@ -20,6 +20,7 @@ module Sentry
|
|
20
20
|
'ActionController::RoutingError',
|
21
21
|
'ActionController::UnknownAction',
|
22
22
|
'ActionController::UnknownFormat',
|
23
|
+
'ActionDispatch::Http::MimeNegotiation::InvalidType',
|
23
24
|
'ActionController::UnknownHttpMethod',
|
24
25
|
'ActionDispatch::Http::Parameters::ParseError',
|
25
26
|
'ActiveJob::DeserializationError', # Can cause infinite loops
|
data/lib/sentry/rails/railtie.rb
CHANGED
@@ -4,7 +4,6 @@ require "sentry/rails/rescued_exception_interceptor"
|
|
4
4
|
require "sentry/rails/backtrace_cleaner"
|
5
5
|
require "sentry/rails/controller_methods"
|
6
6
|
require "sentry/rails/controller_transaction"
|
7
|
-
require "sentry/rails/active_job"
|
8
7
|
require "sentry/rails/overrides/streaming_reporter"
|
9
8
|
|
10
9
|
module Sentry
|
@@ -22,7 +21,7 @@ module Sentry
|
|
22
21
|
|
23
22
|
configure_sentry_logger
|
24
23
|
extend_controller_methods
|
25
|
-
extend_active_job
|
24
|
+
extend_active_job if defined?(ActiveJob)
|
26
25
|
override_streaming_reporter
|
27
26
|
setup_backtrace_cleanup_callback
|
28
27
|
inject_breadcrumbs_logger
|
@@ -34,6 +33,7 @@ module Sentry
|
|
34
33
|
end
|
35
34
|
|
36
35
|
def extend_active_job
|
36
|
+
require "sentry/rails/active_job"
|
37
37
|
ActiveJob::Base.send(:prepend, Sentry::Rails::ActiveJobExtensions)
|
38
38
|
end
|
39
39
|
|
@@ -11,6 +11,15 @@ module Sentry
|
|
11
11
|
begin
|
12
12
|
@app.call(env)
|
13
13
|
rescue => e
|
14
|
+
request = ActionDispatch::Request.new(env)
|
15
|
+
|
16
|
+
# Rails' ShowExceptions#render_exception will mutate env for the exceptions app
|
17
|
+
# so we need to hold a copy of env to report the accurate data (like request's url)
|
18
|
+
if request.show_exceptions?
|
19
|
+
scope = Sentry.get_current_scope
|
20
|
+
scope.set_rack_env(scope.rack_env.dup)
|
21
|
+
end
|
22
|
+
|
14
23
|
env["sentry.rescued_exception"] = e if Sentry.configuration.rails.report_rescued_exceptions
|
15
24
|
raise e
|
16
25
|
end
|
@@ -2,19 +2,11 @@ module Sentry
|
|
2
2
|
module Rails
|
3
3
|
module Tracing
|
4
4
|
class ActionViewSubscriber < AbstractSubscriber
|
5
|
-
|
5
|
+
EVENT_NAME = "render_template.action_view".freeze
|
6
6
|
|
7
7
|
def self.subscribe!
|
8
|
-
|
9
|
-
|
10
|
-
record_on_current_span(op: event_name, start_timestamp: payload[:start_timestamp], description: payload[:identifier], duration: duration)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.unsubscribe!
|
16
|
-
EVENT_NAMES.each do |event_name|
|
17
|
-
ActiveSupport::Notifications.unsubscribe(event_name)
|
8
|
+
subscribe_to_event(EVENT_NAME) do |event_name, duration, payload|
|
9
|
+
record_on_current_span(op: event_name, start_timestamp: payload[:start_timestamp], description: payload[:identifier], duration: duration)
|
18
10
|
end
|
19
11
|
end
|
20
12
|
end
|
data/lib/sentry/rails/version.rb
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: 4.1.
|
4
|
+
version: 4.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sentry Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|