sentry-rails 4.8.1 → 4.8.3

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: 5457a6fe448b94ade0388542ea975187fb7dd532d5a4ee3ec8caf65b6b2d785d
4
- data.tar.gz: a4d537a4d7c3ddebc41afdb1e00187c5a776bfa269c4342f802cc1252146d4f6
3
+ metadata.gz: d3fac86beaf3aa169dfed1a73e0836e066bd8ec0a4c0c79dd91391d8dac20e29
4
+ data.tar.gz: 264f9fa5c867f13c8d1a69263e5956f1aa5e6123af5937db597cb4e43b6396dd
5
5
  SHA512:
6
- metadata.gz: 6aff15bc8465765af61e404ea7a709057531a12d018fd93624fa7f470e5d7c2c51c5105c4ef63225ec66a867b54cab57e0d8b40046f145d1a43d7b641c454a58
7
- data.tar.gz: e597ec4f143aca81cc4b3bf5aa47315eb84f02df0f93a4d402b701dfe32a811dcc2eba7c437bde430cd21d2fea98eae3ee4c3f324dedc24a63941b06bdcf82bb
6
+ metadata.gz: 0a0890d576cdbe46e5a80834820014fc4bd5c201075f7ffad9156ec9d523783e799daa789ac5bfb9702980957fbcf6abd4277269dbb12ebe6a501bdf11273818
7
+ data.tar.gz: 56be8d335560de6e7e696ce0c62b0a5e86f672d4366a4c4da97fa79c8e7731c9b5778b79a8150e52799beedc7b688a1c3a436ea590ee3baa914f0355dd3828e7
@@ -16,8 +16,8 @@ if defined?(ActiveJob)
16
16
  discard_on ActiveJob::DeserializationError
17
17
  else
18
18
  # mimic what discard_on does for Rails 5.0
19
- rescue_from ActiveJob::DeserializationError do
20
- logger.error "Discarded #{self.class} due to a #{exception}. The original exception was #{error.cause.inspect}."
19
+ rescue_from ActiveJob::DeserializationError do |exception|
20
+ logger.error "Discarded #{self.class} due to a #{exception}. The original exception was #{exception.cause.inspect}."
21
21
  end
22
22
  end
23
23
 
@@ -1,28 +1,22 @@
1
1
  module Sentry
2
2
  module Rails
3
3
  module ActiveJobExtensions
4
- def self.included(base)
5
- base.class_eval do
6
- around_perform do |job, block|
7
- if Sentry.initialized?
8
- if already_supported_by_specific_integration?(job)
9
- block.call
10
- else
11
- Sentry.with_scope do |scope|
12
- capture_and_reraise_with_sentry(job, scope, block)
13
- end
14
- end
15
- else
16
- block.call
4
+ def perform_now
5
+ if !Sentry.initialized? || already_supported_by_sentry_integration?
6
+ super
7
+ else
8
+ Sentry.with_scope do |scope|
9
+ capture_and_reraise_with_sentry(scope) do
10
+ super
17
11
  end
18
12
  end
19
13
  end
20
14
  end
21
15
 
22
- def capture_and_reraise_with_sentry(job, scope, block)
23
- scope.set_transaction_name(job.class.name)
16
+ def capture_and_reraise_with_sentry(scope, &block)
17
+ scope.set_transaction_name(self.class.name)
24
18
  transaction =
25
- if job.is_a?(::Sentry::SendEventJob)
19
+ if is_a?(::Sentry::SendEventJob)
26
20
  nil
27
21
  else
28
22
  Sentry.start_transaction(name: scope.transaction_name, op: "active_job")
@@ -30,50 +24,46 @@ module Sentry
30
24
 
31
25
  scope.set_span(transaction) if transaction
32
26
 
33
- block.call
27
+ return_value = block.call
34
28
 
35
- finish_transaction(transaction, 200)
29
+ finish_sentry_transaction(transaction, 200)
30
+
31
+ return_value
36
32
  rescue Exception => e # rubocop:disable Lint/RescueException
37
- rescue_handler_result = rescue_with_handler(e)
38
- finish_transaction(transaction, 500)
39
- return rescue_handler_result if rescue_handler_result
33
+ finish_sentry_transaction(transaction, 500)
40
34
 
41
35
  Sentry::Rails.capture_exception(
42
36
  e,
43
- extra: sentry_context(job),
37
+ extra: sentry_context,
44
38
  tags: {
45
- job_id: job.job_id,
46
- provider_job_id: job.provider_job_id
39
+ job_id: job_id,
40
+ provider_job_id:provider_job_id
47
41
  }
48
42
  )
49
43
  raise e
50
44
  end
51
45
 
52
- def finish_transaction(transaction, status)
46
+ def finish_sentry_transaction(transaction, status)
53
47
  return unless transaction
54
48
 
55
49
  transaction.set_http_status(status)
56
50
  transaction.finish
57
51
  end
58
52
 
59
- def already_supported_by_specific_integration?(job)
60
- Sentry.configuration.rails.skippable_job_adapters.include?(job.class.queue_adapter.class.to_s)
53
+ def already_supported_by_sentry_integration?
54
+ Sentry.configuration.rails.skippable_job_adapters.include?(self.class.queue_adapter.class.to_s)
61
55
  end
62
56
 
63
- def sentry_context(job)
57
+ def sentry_context
64
58
  {
65
- active_job: job.class.name,
66
- arguments: job.arguments,
67
- scheduled_at: job.scheduled_at,
68
- job_id: job.job_id,
69
- provider_job_id: job.provider_job_id,
70
- locale: job.locale
59
+ active_job: self.class.name,
60
+ arguments: arguments,
61
+ scheduled_at: scheduled_at,
62
+ job_id: job_id,
63
+ provider_job_id: provider_job_id,
64
+ locale: locale
71
65
  }
72
66
  end
73
67
  end
74
68
  end
75
69
  end
76
-
77
- class ActiveJob::Base
78
- include Sentry::Rails::ActiveJobExtensions
79
- end
@@ -1,5 +1,5 @@
1
1
  module Sentry
2
2
  module Rails
3
- VERSION = "4.8.1"
3
+ VERSION = "4.8.3"
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", "~> 4.8.1"
26
+ spec.add_dependency "sentry-ruby-core", "~> 4.8.3"
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.8.1
4
+ version: 4.8.3
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-22 00:00:00.000000000 Z
11
+ date: 2022-01-05 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: 4.8.1
33
+ version: 4.8.3
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.8.1
40
+ version: 4.8.3
41
41
  description: A gem that provides Rails integration for the Sentry error logger
42
42
  email: accounts@sentry.io
43
43
  executables: []