sentry-rails 5.2.1 → 5.3.0
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/lib/sentry/rails/background_worker.rb +7 -2
- data/lib/sentry/rails/capture_exceptions.rb +1 -1
- data/lib/sentry/rails/configuration.rb +7 -0
- data/lib/sentry/rails/railtie.rb +1 -1
- data/lib/sentry/rails/tracing/abstract_subscriber.rb +6 -9
- data/lib/sentry/rails/version.rb +1 -1
- data/sentry-rails.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c10021ca91c13dc4b34f024269a01974d75e8971b72b027f497c7c3c248ba448
|
4
|
+
data.tar.gz: e4daa4206bd67b93787a7b08653808d72f7e1f667caab27f2382496e9dec474b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18b27b1e7b1acc3facd390069f7cd62ef434bd94b5dee2cd440f6f29cfb7b3411193c7425851116aaa199394f57df93c3d1be4c634e8d9a985786342a7ca6745
|
7
|
+
data.tar.gz: f4a3c87c7b053b9e3c0adaffa620570b0d92be984d8c2337df552fcab1a9cae1b34c299f3bdb5506106037d960f35b8cc8f51a9f3b73d8666e2ee0ae02634055
|
@@ -1,8 +1,13 @@
|
|
1
1
|
module Sentry
|
2
2
|
class BackgroundWorker
|
3
3
|
def _perform(&block)
|
4
|
-
#
|
5
|
-
ActiveRecord::Base.
|
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
|
6
11
|
block.call
|
7
12
|
end
|
8
13
|
end
|
@@ -39,7 +39,7 @@ module Sentry
|
|
39
39
|
end
|
40
40
|
|
41
41
|
transaction = Sentry::Transaction.from_sentry_trace(sentry_trace, **options) if sentry_trace
|
42
|
-
Sentry.start_transaction(transaction: transaction, **options)
|
42
|
+
Sentry.start_transaction(transaction: transaction, custom_sampling_context: { env: env }, **options)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -42,6 +42,12 @@ module Sentry
|
|
42
42
|
'ActiveRecord::RecordNotFound'
|
43
43
|
].freeze
|
44
44
|
class Configuration
|
45
|
+
# Rails 7.0 introduced a new error reporter feature, which the SDK once opted-in by default.
|
46
|
+
# But after receiving multiple issue reports, the integration seemed to cause serious troubles to some users.
|
47
|
+
# So the integration is now controlled by this configuration, which is disabled (false) by default.
|
48
|
+
# More information can be found from: https://github.com/rails/rails/pull/43625#issuecomment-1072514175
|
49
|
+
attr_accessor :register_error_subscriber
|
50
|
+
|
45
51
|
# Rails catches exceptions in the ActionDispatch::ShowExceptions or
|
46
52
|
# ActionDispatch::DebugExceptions middlewares, depending on the environment.
|
47
53
|
# When `rails_report_rescued_exceptions` is true (it is by default), Sentry
|
@@ -55,6 +61,7 @@ module Sentry
|
|
55
61
|
attr_accessor :tracing_subscribers
|
56
62
|
|
57
63
|
def initialize
|
64
|
+
@register_error_subscriber = false
|
58
65
|
@report_rescued_exceptions = true
|
59
66
|
@skippable_job_adapters = []
|
60
67
|
@tracing_subscribers = Set.new([
|
data/lib/sentry/rails/railtie.rb
CHANGED
@@ -47,7 +47,7 @@ module Sentry
|
|
47
47
|
inject_breadcrumbs_logger
|
48
48
|
activate_tracing
|
49
49
|
|
50
|
-
register_error_subscriber(app) if ::Rails.version.to_f >= 7.0
|
50
|
+
register_error_subscriber(app) if ::Rails.version.to_f >= 7.0 && Sentry.configuration.rails.register_error_subscriber
|
51
51
|
end
|
52
52
|
|
53
53
|
runner do
|
@@ -40,15 +40,12 @@ module Sentry
|
|
40
40
|
def record_on_current_span(duration:, **options)
|
41
41
|
return unless options[:start_timestamp]
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
# so we need to covert it as second before calculating the timestamp
|
50
|
-
span.set_timestamp(span.start_timestamp + duration / 1000)
|
51
|
-
yield(span) if block_given?
|
43
|
+
Sentry.with_child_span(**options) do |child_span|
|
44
|
+
# duration in ActiveSupport is computed in millisecond
|
45
|
+
# so we need to covert it as second before calculating the timestamp
|
46
|
+
child_span.set_timestamp(child_span.start_timestamp + duration / 1000)
|
47
|
+
yield(child_span) if block_given?
|
48
|
+
end
|
52
49
|
end
|
53
50
|
end
|
54
51
|
end
|
data/lib/sentry/rails/version.rb
CHANGED
data/sentry-rails.gemspec
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: 5.
|
4
|
+
version: 5.3.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: 2022-
|
11
|
+
date: 2022-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 5.
|
33
|
+
version: 5.3.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: 5.
|
40
|
+
version: 5.3.0
|
41
41
|
description: A gem that provides Rails integration for the Sentry error logger
|
42
42
|
email: accounts@sentry.io
|
43
43
|
executables: []
|