sentry-rails 4.1.6 → 4.1.7
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 +6 -0
- data/Gemfile +1 -0
- data/lib/sentry/rails/capture_exceptions.rb +21 -0
- data/lib/sentry/rails/overrides/file_handler.rb +16 -0
- data/lib/sentry/rails/railtie.rb +9 -1
- data/lib/sentry/rails/rescued_exception_interceptor.rb +3 -8
- data/lib/sentry/rails/tracing/abstract_subscriber.rb +3 -3
- data/lib/sentry/rails/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e101fa2f42e1bf68db025a8c02a391ee510cfb43d286c63156397efcbcc1f6a
|
4
|
+
data.tar.gz: 8673fc2ff559d18b09c41b05e373116feb1ae7b04cbe4de5f99637afaf05c8da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 156a36ae19a647b1b17e4278108296356339363f659d714b24dfcc095c14d59ae01ef85bc08c0c1a3331e401522bd7130214432a2a931f40fdeedff0ef6a0bcb
|
7
|
+
data.tar.gz: 897b9c2f0d82266b2725cbbd30bd8478fda5e1c3dae80927e6e3f73917d8ab417066c1be545b552a39d1ed6560f5ca8c16e0247cbf3199d3cabe110f41cd175c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 4.1.7
|
4
|
+
|
5
|
+
- Use env to carry original transaction name [#1255](https://github.com/getsentry/sentry-ruby/pull/1255)
|
6
|
+
- Fix duration of tracing event in Rails 5 [#1254](https://github.com/getsentry/sentry-ruby/pull/1254) (by @abcang)
|
7
|
+
- Filter out static file transaction [#1247](https://github.com/getsentry/sentry-ruby/pull/1247)
|
8
|
+
|
3
9
|
## 4.1.6
|
4
10
|
|
5
11
|
- Prevent exceptions app from overriding event's transaction name [#1230](https://github.com/getsentry/sentry-ruby/pull/1230)
|
data/Gemfile
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
module Sentry
|
2
2
|
module Rails
|
3
3
|
class CaptureExceptions < Sentry::Rack::CaptureExceptions
|
4
|
+
def initialize(app)
|
5
|
+
super
|
6
|
+
|
7
|
+
if defined?(::Sprockets::Rails)
|
8
|
+
@assets_regex = %r(\A/{0,2}#{::Rails.application.config.assets.prefix})
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
4
12
|
private
|
5
13
|
|
6
14
|
def collect_exception(env)
|
@@ -12,8 +20,21 @@ module Sentry
|
|
12
20
|
end
|
13
21
|
|
14
22
|
def capture_exception(exception)
|
23
|
+
current_scope = Sentry.get_current_scope
|
24
|
+
|
25
|
+
if original_transaction = current_scope.rack_env["sentry.original_transaction"]
|
26
|
+
current_scope.set_transaction_name(original_transaction)
|
27
|
+
end
|
28
|
+
|
15
29
|
Sentry::Rails.capture_exception(exception)
|
16
30
|
end
|
31
|
+
|
32
|
+
def finish_span(span, status_code)
|
33
|
+
if @assets_regex.nil? || !span.name.match?(@assets_regex)
|
34
|
+
span.set_http_status(status_code)
|
35
|
+
span.finish
|
36
|
+
end
|
37
|
+
end
|
17
38
|
end
|
18
39
|
end
|
19
40
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Sentry
|
2
|
+
module Rails
|
3
|
+
module Overrides
|
4
|
+
module FileHandler
|
5
|
+
def serve(*args)
|
6
|
+
if Sentry.initialized? && current_transaction = Sentry.get_current_scope.span
|
7
|
+
# we don't want to expose a setter for @sampled just for this case
|
8
|
+
current_transaction.instance_variable_set(:@sampled, false)
|
9
|
+
end
|
10
|
+
|
11
|
+
super
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/sentry/rails/railtie.rb
CHANGED
@@ -5,6 +5,7 @@ require "sentry/rails/backtrace_cleaner"
|
|
5
5
|
require "sentry/rails/controller_methods"
|
6
6
|
require "sentry/rails/controller_transaction"
|
7
7
|
require "sentry/rails/overrides/streaming_reporter"
|
8
|
+
require "sentry/rails/overrides/file_handler"
|
8
9
|
|
9
10
|
module Sentry
|
10
11
|
class Railtie < ::Rails::Railtie
|
@@ -16,7 +17,7 @@ module Sentry
|
|
16
17
|
app.config.middleware.use(Sentry::Rails::RescuedExceptionInterceptor)
|
17
18
|
end
|
18
19
|
|
19
|
-
config.after_initialize do
|
20
|
+
config.after_initialize do |app|
|
20
21
|
next unless Sentry.initialized?
|
21
22
|
|
22
23
|
configure_project_root
|
@@ -24,6 +25,7 @@ module Sentry
|
|
24
25
|
extend_controller_methods
|
25
26
|
extend_active_job if defined?(ActiveJob)
|
26
27
|
override_streaming_reporter
|
28
|
+
override_file_handler if app.config.public_file_server.enabled
|
27
29
|
setup_backtrace_cleanup_callback
|
28
30
|
inject_breadcrumbs_logger
|
29
31
|
activate_tracing
|
@@ -71,6 +73,12 @@ module Sentry
|
|
71
73
|
end
|
72
74
|
end
|
73
75
|
|
76
|
+
def override_file_handler
|
77
|
+
ActiveSupport.on_load :action_controller do
|
78
|
+
ActionDispatch::FileHandler.send(:prepend, Sentry::Rails::Overrides::FileHandler)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
74
82
|
def activate_tracing
|
75
83
|
if Sentry.configuration.tracing_enabled?
|
76
84
|
Sentry::Rails::Tracing.subscribe_tracing_events
|
@@ -17,14 +17,9 @@ module Sentry
|
|
17
17
|
# so we need to hold a copy of env to report the accurate data (like request's url)
|
18
18
|
if request.show_exceptions?
|
19
19
|
scope = Sentry.get_current_scope
|
20
|
-
scope.
|
21
|
-
|
22
|
-
|
23
|
-
# we also need to make sure the transaction name won't be overridden by the exceptions app
|
24
|
-
scope.add_event_processor do |event, hint|
|
25
|
-
event.transaction = transaction
|
26
|
-
event
|
27
|
-
end
|
20
|
+
copied_env = scope.rack_env.dup
|
21
|
+
copied_env["sentry.original_transaction"] = scope.transaction_name
|
22
|
+
scope.set_rack_env(copied_env)
|
28
23
|
end
|
29
24
|
|
30
25
|
env["sentry.rescued_exception"] = e if Sentry.configuration.rails.report_rescued_exceptions
|
@@ -14,11 +14,11 @@ module Sentry
|
|
14
14
|
|
15
15
|
def subscribe_to_event(event_name)
|
16
16
|
if ::Rails.version.to_i == 5
|
17
|
-
ActiveSupport::Notifications.subscribe(event_name) do |
|
17
|
+
ActiveSupport::Notifications.subscribe(event_name) do |*args|
|
18
18
|
next unless Tracing.get_current_transaction
|
19
19
|
|
20
|
-
|
21
|
-
yield(event_name, duration, payload)
|
20
|
+
event = ActiveSupport::Notifications::Event.new(*args)
|
21
|
+
yield(event_name, event.duration, event.payload)
|
22
22
|
end
|
23
23
|
else
|
24
24
|
ActiveSupport::Notifications.subscribe(event_name) do |event|
|
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.7
|
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-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- lib/sentry/rails/configuration.rb
|
68
68
|
- lib/sentry/rails/controller_methods.rb
|
69
69
|
- lib/sentry/rails/controller_transaction.rb
|
70
|
+
- lib/sentry/rails/overrides/file_handler.rb
|
70
71
|
- lib/sentry/rails/overrides/streaming_reporter.rb
|
71
72
|
- lib/sentry/rails/railtie.rb
|
72
73
|
- lib/sentry/rails/rescued_exception_interceptor.rb
|