sentry-rails 4.2.2 → 4.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/.gitignore +1 -0
- data/CHANGELOG.md +10 -0
- data/lib/sentry/rails.rb +1 -0
- data/lib/sentry/rails/active_job.rb +18 -3
- data/lib/sentry/rails/background_worker.rb +14 -0
- data/lib/sentry/rails/capture_exceptions.rb +9 -4
- data/lib/sentry/rails/version.rb +1 -1
- data/sentry-rails.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f1aafc591c356c77484bf061be1d4f8968588270e083d6ee94ada2f80054282
|
4
|
+
data.tar.gz: 74e40b15bdc17962037fd2b78b6695de5a405335a186f373c644dcb61b75aab6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 279ad65af3f35928746b8365bc494bf0384fde465414c1211cb565289bb7cbf1157c0649da6c835e4bbb79b928005eebba2805f387a52a57170bba876279b0fb
|
7
|
+
data.tar.gz: 6bf36d990e2c7f3ab51d8e5bb6bd2ec6873d924f2baa72796145502b2b4f04eea055c8c22a06a6bb8f0cbe92b2c92b15a7e29262f21252fce98be579f7e3fc38
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 4.3.0
|
4
|
+
|
5
|
+
### Features
|
6
|
+
|
7
|
+
- Support performance monitoring on ActiveJob execution [#1304](https://github.com/getsentry/sentry-ruby/pull/1304)
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
- Prevent background workers from holding ActiveRecord connections [#1320](https://github.com/getsentry/sentry-ruby/pull/1320)
|
12
|
+
|
3
13
|
## 4.2.2
|
4
14
|
|
5
15
|
- Always define Sentry::SendEventJob to avoid eager load issues [#1286](https://github.com/getsentry/sentry-ruby/pull/1286)
|
data/lib/sentry/rails.rb
CHANGED
@@ -8,8 +8,8 @@ module Sentry
|
|
8
8
|
if already_supported_by_specific_integration?(job)
|
9
9
|
block.call
|
10
10
|
else
|
11
|
-
Sentry.with_scope do
|
12
|
-
capture_and_reraise_with_sentry(job, block)
|
11
|
+
Sentry.with_scope do |scope|
|
12
|
+
capture_and_reraise_with_sentry(job, scope, block)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
else
|
@@ -19,10 +19,18 @@ module Sentry
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
def capture_and_reraise_with_sentry(job, block)
|
22
|
+
def capture_and_reraise_with_sentry(job, scope, block)
|
23
|
+
scope.set_transaction_name(job.class.name)
|
24
|
+
transaction = Sentry.start_transaction(name: scope.transaction_name, op: "active_job")
|
25
|
+
|
26
|
+
scope.set_span(transaction) if transaction
|
27
|
+
|
23
28
|
block.call
|
29
|
+
|
30
|
+
finish_transaction(transaction, 200)
|
24
31
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
25
32
|
rescue_handler_result = rescue_with_handler(e)
|
33
|
+
finish_transaction(transaction, 500)
|
26
34
|
return rescue_handler_result if rescue_handler_result
|
27
35
|
|
28
36
|
Sentry::Rails.capture_exception(
|
@@ -36,6 +44,13 @@ module Sentry
|
|
36
44
|
raise e
|
37
45
|
end
|
38
46
|
|
47
|
+
def finish_transaction(transaction, status)
|
48
|
+
return unless transaction
|
49
|
+
|
50
|
+
transaction.set_http_status(status)
|
51
|
+
transaction.finish
|
52
|
+
end
|
53
|
+
|
39
54
|
def already_supported_by_specific_integration?(job)
|
40
55
|
Sentry.configuration.rails.skippable_job_adapters.include?(job.class.queue_adapter.class.to_s)
|
41
56
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Sentry
|
2
|
+
class BackgroundWorker
|
3
|
+
alias_method :original_perform, :perform
|
4
|
+
|
5
|
+
def perform(&block)
|
6
|
+
@executor.post do
|
7
|
+
# make sure the background worker returns AR connection if it accidentally acquire one during serialization
|
8
|
+
ActiveRecord::Base.connection_pool.with_connection do
|
9
|
+
block.call
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -29,11 +29,16 @@ module Sentry
|
|
29
29
|
Sentry::Rails.capture_exception(exception)
|
30
30
|
end
|
31
31
|
|
32
|
-
def
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
def start_transaction(env, scope)
|
33
|
+
transaction = super
|
34
|
+
|
35
|
+
return unless transaction
|
36
|
+
|
37
|
+
if @assets_regex && transaction.name.match?(@assets_regex)
|
38
|
+
transaction.instance_variable_set(:@sampled, false)
|
36
39
|
end
|
40
|
+
|
41
|
+
transaction
|
37
42
|
end
|
38
43
|
end
|
39
44
|
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: 4.
|
4
|
+
version: 4.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: 2021-
|
11
|
+
date: 2021-03-12 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.
|
33
|
+
version: 4.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: 4.
|
40
|
+
version: 4.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: []
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- lib/sentry-rails.rb
|
63
63
|
- lib/sentry/rails.rb
|
64
64
|
- lib/sentry/rails/active_job.rb
|
65
|
+
- lib/sentry/rails/background_worker.rb
|
65
66
|
- lib/sentry/rails/backtrace_cleaner.rb
|
66
67
|
- lib/sentry/rails/breadcrumb/active_support_logger.rb
|
67
68
|
- lib/sentry/rails/capture_exceptions.rb
|