sentry-rails 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77b9b80b3b1a86d1ae7505e280d02e11e434c63b0952921fc4bf5e7e8784c7a6
4
- data.tar.gz: fa67dc90e35e176250e8c1bc6634d96be8fb10a4c59d150010939d786a9e660d
3
+ metadata.gz: 9e5e6de4bbd5e0e1530fcd38e5978b153c846bac123e92db1941fd8c58318eef
4
+ data.tar.gz: 3b0ea04fd34eab29d19052fde261954890e3ce59e8f090592e23653e1aab7a4f
5
5
  SHA512:
6
- metadata.gz: '0949c417ea51c4bf46c73ab457fb0b5dccfeae5b6e19d94236a1cce86f84ce6818dfc2c86ad8390bd0fbdd7dca2e256e6e45c90ca9911607088783cd9be009fb'
7
- data.tar.gz: 002ad77da75a4d906822cd6f42cc1334ebea2ce3998623db5fc27bcc229f1afc02b4c30b0d375a106f47ea69adf7f6b472c1a8d3d82be158fed8d5e8341ef578
6
+ metadata.gz: 785b7d05b9ff2a18e5e3939aeac265ae02426a617f9fda15865fc69d1d196706fcc658a4a54731dd3eb918f714e6825651002528c2f20ad0b426e5fa0b248d24
7
+ data.tar.gz: f9065c5331efae105803df2fcaed4e7c7cf18286d2b07ae046e1e48004cde67c0c3e171a5ca82cfae2cada9f23bb4a9ee12442fc3391415e2634389799ead5af
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.1.0
4
+
5
+ - Merge & rename 2 Rack middlewares [#1147](https://github.com/getsentry/sentry-ruby/pull/1147)
6
+ - Fixes [#1153](https://github.com/getsentry/sentry-ruby/pull/1153)
7
+ - Removed `Sentry::Rack::Tracing` middleware and renamed `Sentry::Rack::CaptureException` to `Sentry::Rack::CaptureExceptions`
8
+ - Tidy up rails integration [#1150](https://github.com/getsentry/sentry-ruby/pull/1150)
9
+ - Check SDK initialization before running integrations [#1151](https://github.com/getsentry/sentry-ruby/pull/1151)
10
+ - Fixes [#1145](https://github.com/getsentry/sentry-ruby/pull/1145)
11
+
3
12
  ## 4.0.0
4
13
 
5
14
  - Only documents update for the official release and no API/feature changes.
@@ -14,7 +14,10 @@ module Sentry
14
14
 
15
15
  def inject
16
16
  @subscriber = ::ActiveSupport::Notifications.subscribe(/.*/) do |name, started, finished, unique_id, data|
17
- add(name, started, finished, unique_id, data)
17
+ # we only record events that has a started timestamp
18
+ if started.is_a?(Time)
19
+ add(name, started, finished, unique_id, data)
20
+ end
18
21
  end
19
22
  end
20
23
 
@@ -1,6 +1,6 @@
1
1
  module Sentry
2
2
  module Rails
3
- class CaptureException < Sentry::Rack::CaptureException
3
+ class CaptureExceptions < Sentry::Rack::CaptureExceptions
4
4
  def collect_exception(env)
5
5
  super || env["action_dispatch.exception"]
6
6
  end
@@ -1,5 +1,5 @@
1
1
  require "rails"
2
- require "sentry/rails/capture_exception"
2
+ require "sentry/rails/capture_exceptions"
3
3
  require "sentry/rails/backtrace_cleaner"
4
4
  require "sentry/rails/controller_methods"
5
5
  require "sentry/rails/controller_transaction"
@@ -8,12 +8,33 @@ require "sentry/rails/overrides/streaming_reporter"
8
8
 
9
9
  module Sentry
10
10
  class Railtie < ::Rails::Railtie
11
+ # middlewares can't be injected after initialize
11
12
  initializer "sentry.use_rack_middleware" do |app|
12
- app.config.middleware.insert 0, Sentry::Rails::CaptureException
13
- app.config.middleware.insert 0, Sentry::Rack::Tracing
13
+ app.config.middleware.insert 0, Sentry::Rails::CaptureExceptions
14
14
  end
15
15
 
16
- initializer 'sentry.action_controller' do
16
+ config.after_initialize do
17
+ next unless Sentry.initialized?
18
+
19
+ configure_sentry_logger
20
+ extend_controller_methods
21
+ extend_active_job
22
+ override_exceptions_handling
23
+ override_streaming_reporter
24
+ setup_backtrace_cleanup_callback
25
+ inject_breadcrumbs_logger
26
+ activate_tracing
27
+ end
28
+
29
+ def configure_sentry_logger
30
+ Sentry.configuration.logger = ::Rails.logger
31
+ end
32
+
33
+ def extend_active_job
34
+ ActiveJob::Base.send(:prepend, Sentry::Rails::ActiveJobExtensions)
35
+ end
36
+
37
+ def extend_controller_methods
17
38
  ActiveSupport.on_load :action_controller do
18
39
  include Sentry::Rails::ControllerMethods
19
40
  include Sentry::Rails::ControllerTransaction
@@ -21,26 +42,22 @@ module Sentry
21
42
  end
22
43
  end
23
44
 
24
- initializer 'sentry.action_view' do
25
- ActiveSupport.on_load :action_view do
26
- ActionView::StreamingTemplateRenderer::Body.send(:prepend, Sentry::Rails::Overrides::StreamingReporter)
45
+ def inject_breadcrumbs_logger
46
+ if Sentry.configuration.breadcrumbs_logger.include?(:active_support_logger)
47
+ require 'sentry/rails/breadcrumb/active_support_logger'
48
+ Sentry::Rails::Breadcrumb::ActiveSupportLogger.inject
27
49
  end
28
50
  end
29
51
 
30
- config.after_initialize do
31
- Sentry.configuration.logger = ::Rails.logger
32
-
52
+ def setup_backtrace_cleanup_callback
33
53
  backtrace_cleaner = Sentry::Rails::BacktraceCleaner.new
34
54
 
35
55
  Sentry.configuration.backtrace_cleanup_callback = lambda do |backtrace|
36
56
  backtrace_cleaner.clean(backtrace)
37
57
  end
58
+ end
38
59
 
39
- if Sentry.configuration.breadcrumbs_logger.include?(:active_support_logger)
40
- require 'sentry/rails/breadcrumb/active_support_logger'
41
- Sentry::Rails::Breadcrumb::ActiveSupportLogger.inject
42
- end
43
-
60
+ def override_exceptions_handling
44
61
  if Sentry.configuration.rails.report_rescued_exceptions
45
62
  require 'sentry/rails/overrides/debug_exceptions_catcher'
46
63
  if defined?(::ActionDispatch::DebugExceptions)
@@ -51,21 +68,19 @@ module Sentry
51
68
 
52
69
  exceptions_class.send(:prepend, Sentry::Rails::Overrides::DebugExceptionsCatcher)
53
70
  end
71
+ end
54
72
 
55
- if Sentry.configuration.tracing_enabled?
56
- Sentry::Rails::Tracing.subscribe_tracing_events
57
- Sentry::Rails::Tracing.patch_active_support_notifications
73
+ def override_streaming_reporter
74
+ ActiveSupport.on_load :action_view do
75
+ ActionView::StreamingTemplateRenderer::Body.send(:prepend, Sentry::Rails::Overrides::StreamingReporter)
58
76
  end
59
77
  end
60
78
 
61
- initializer 'sentry.active_job' do
62
- ActiveSupport.on_load :active_job do
63
- require 'sentry/rails/active_job'
79
+ def activate_tracing
80
+ if Sentry.configuration.tracing_enabled?
81
+ Sentry::Rails::Tracing.subscribe_tracing_events
82
+ Sentry::Rails::Tracing.patch_active_support_notifications
64
83
  end
65
84
  end
66
-
67
- # rake_tasks do
68
- # require 'sentry/integrations/tasks'
69
- # end
70
85
  end
71
86
  end
@@ -1,5 +1,5 @@
1
1
  module Sentry
2
2
  module Rails
3
- VERSION = "4.0.0"
3
+ VERSION = "4.1.0"
4
4
  end
5
5
  end
@@ -23,5 +23,5 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ["lib"]
24
24
 
25
25
  spec.add_dependency "rails", ">= 5.0"
26
- spec.add_dependency "sentry-ruby", ">= 4.0.0"
26
+ spec.add_dependency "sentry-ruby", ">= 4.1.0"
27
27
  end
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.0.0
4
+ version: 4.1.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: 2020-12-10 00:00:00.000000000 Z
11
+ date: 2020-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 4.0.0
33
+ version: 4.1.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: 4.0.0
40
+ version: 4.1.0
41
41
  description: A gem that provides Rails integration for the Sentry error logger
42
42
  email: accounts@sentry.io
43
43
  executables: []
@@ -63,7 +63,7 @@ files:
63
63
  - lib/sentry/rails/active_job.rb
64
64
  - lib/sentry/rails/backtrace_cleaner.rb
65
65
  - lib/sentry/rails/breadcrumb/active_support_logger.rb
66
- - lib/sentry/rails/capture_exception.rb
66
+ - lib/sentry/rails/capture_exceptions.rb
67
67
  - lib/sentry/rails/configuration.rb
68
68
  - lib/sentry/rails/controller_methods.rb
69
69
  - lib/sentry/rails/controller_transaction.rb