sentry-rails 5.3.0 → 5.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c10021ca91c13dc4b34f024269a01974d75e8971b72b027f497c7c3c248ba448
4
- data.tar.gz: e4daa4206bd67b93787a7b08653808d72f7e1f667caab27f2382496e9dec474b
3
+ metadata.gz: aa8698c9fc741267d62945d23aeb54d5e558a64cd0f818c9f724754107cac35e
4
+ data.tar.gz: 6a3b1f71e222aea88ef9a50aabf739de21413ba1c943592ac7caf3145a0d84cd
5
5
  SHA512:
6
- metadata.gz: 18b27b1e7b1acc3facd390069f7cd62ef434bd94b5dee2cd440f6f29cfb7b3411193c7425851116aaa199394f57df93c3d1be4c634e8d9a985786342a7ca6745
7
- data.tar.gz: f4a3c87c7b053b9e3c0adaffa620570b0d92be984d8c2337df552fcab1a9cae1b34c299f3bdb5506106037d960f35b8cc8f51a9f3b73d8666e2ee0ae02634055
6
+ metadata.gz: 55999e366e8d9b0eb977f77015940c1c88e3a6e629b4d4418060c0863f98a4e8a910686fa08d5f3fce5f726703811bdf778fd5c08460892d87209f4d6a3b95df
7
+ data.tar.gz: 115f41de03b33a570d916605134b259c181173179d8c2942c7f8074d96f0d706469de2a9eeee99c02c0e316e2965943b628f6d47dd99bd02bacbda092a089ce4
data/Gemfile CHANGED
@@ -18,12 +18,14 @@ else
18
18
  gem "sqlite3", platform: :ruby
19
19
  end
20
20
 
21
- if rails_version >= Gem::Version.new("7.0.0")
22
- gem "rails", github: "rails/rails", branch: "7-0-stable"
21
+ if rails_version > Gem::Version.new("7.0.0")
22
+ gem "rails", github: "rails/rails"
23
23
  else
24
24
  gem "rails", "~> #{rails_version}"
25
25
  end
26
26
 
27
+ gem "mini_magick"
28
+
27
29
  gem "sprockets-rails"
28
30
 
29
31
  gem "sidekiq"
@@ -1,15 +1,10 @@
1
1
  module Sentry
2
2
  class BackgroundWorker
3
3
  def _perform(&block)
4
- # some applications have partial or even no AR connection
5
- if ActiveRecord::Base.connected?
6
- # make sure the background worker returns AR connection if it accidentally acquire one during serialization
7
- ActiveRecord::Base.connection_pool.with_connection do
8
- block.call
9
- end
10
- else
11
- block.call
12
- end
4
+ block.call
5
+ ensure
6
+ # make sure the background worker returns AR connection if it accidentally acquire one during serialization
7
+ ActiveRecord::Base.connection_pool.release_connection
13
8
  end
14
9
  end
15
10
  end
@@ -20,14 +20,21 @@ module Sentry
20
20
  "rails.request".freeze
21
21
  end
22
22
 
23
- def capture_exception(exception)
23
+ def capture_exception(exception, env)
24
+ request = ActionDispatch::Request.new(env)
25
+
26
+ # the exception will be swallowed by ShowExceptions middleware
27
+ return if request.show_exceptions? && !Sentry.configuration.rails.report_rescued_exceptions
28
+
24
29
  current_scope = Sentry.get_current_scope
25
30
 
26
- if original_transaction = current_scope.rack_env["sentry.original_transaction"]
31
+ if original_transaction = env["sentry.original_transaction"]
27
32
  current_scope.set_transaction_name(original_transaction)
28
33
  end
29
34
 
30
- Sentry::Rails.capture_exception(exception)
35
+ Sentry::Rails.capture_exception(exception).tap do |event|
36
+ env[ERROR_EVENT_ID_KEY] = event.event_id if event
37
+ end
31
38
  end
32
39
 
33
40
  def start_transaction(env, scope)
@@ -3,8 +3,17 @@ module Sentry
3
3
  # This is not a user-facing class. You should use it with Rails 7.0's error reporter feature and its interfaces.
4
4
  # See https://github.com/rails/rails/blob/main/activesupport/lib/active_support/error_reporter.rb for more information.
5
5
  class ErrorSubscriber
6
- def report(error, handled:, severity:, context:)
7
- Sentry::Rails.capture_exception(error, level: severity, contexts: { "rails.error" => context }, tags: { handled: handled })
6
+ SKIP_SOURCES = Regexp.union([/.*_cache_store.active_support/])
7
+
8
+ def report(error, handled:, severity:, context:, source: nil)
9
+ tags = { handled: handled }
10
+
11
+ if source
12
+ return if SKIP_SOURCES.match?(source)
13
+ tags[:source] = source
14
+ end
15
+
16
+ Sentry::Rails.capture_exception(error, level: severity, contexts: { "rails.error" => context }, tags: tags)
8
17
  end
9
18
  end
10
19
  end
@@ -53,6 +53,11 @@ module Sentry
53
53
  runner do
54
54
  next unless Sentry.initialized?
55
55
  Sentry.configuration.background_worker_threads = 0
56
+
57
+ at_exit do
58
+ # TODO: Add a condition for Rails 7.1 to avoid confliction with https://github.com/rails/rails/pull/44999
59
+ Sentry::Rails.capture_exception($ERROR_INFO, tags: { source: "runner" }) if $ERROR_INFO
60
+ end
56
61
  end
57
62
 
58
63
  def configure_project_root
@@ -1,5 +1,5 @@
1
1
  module Sentry
2
2
  module Rails
3
- VERSION = "5.3.0"
3
+ VERSION = "5.4.1"
4
4
  end
5
5
  end
data/sentry-rails.gemspec CHANGED
@@ -23,5 +23,5 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ["lib"]
24
24
 
25
25
  spec.add_dependency "railties", ">= 5.0"
26
- spec.add_dependency "sentry-ruby-core", "~> 5.3.0"
26
+ spec.add_dependency "sentry-ruby", "~> 5.4.1"
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: 5.3.0
4
+ version: 5.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sentry Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-27 00:00:00.000000000 Z
11
+ date: 2022-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -25,19 +25,19 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '5.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: sentry-ruby-core
28
+ name: sentry-ruby
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 5.3.0
33
+ version: 5.4.1
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.3.0
40
+ version: 5.4.1
41
41
  description: A gem that provides Rails integration for the Sentry error logger
42
42
  email: accounts@sentry.io
43
43
  executables: []