sentry-sidekiq 5.3.0 → 5.8.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: 1584357111f05e18e82d62df9b3b048177f2c0383d8e40d4a01f4f69d068289a
4
- data.tar.gz: 76ba2a9c731b52e99bf2945e30a4a6dcbcb62d7ccaf41466721f3af7f41ccd6f
3
+ metadata.gz: 44c8479eaa5470e9bd28d1987bb089a511d24edc9cc0a3ba86f46157c3b1741f
4
+ data.tar.gz: 2150561d2d2bef72a8111e70d43ec30515686c998dbc484ecd1871010c90aba0
5
5
  SHA512:
6
- metadata.gz: 4367783995f3910ada62d72e7cecafd40dfba48735ec65ddbc13a9726a7dee865b1c2a59d47a80df4cac919df482d4552fd41df0b2fb60d13a219a932920c109
7
- data.tar.gz: 5fec11d42210ed3f12b295bbee5a1c7f01fe421a872c560b8910cea28024597f9d615a8e2424091fc7a9860723a4c0059c7b8eb5bc136f8aa67e14fcf8762b18
6
+ metadata.gz: 5bd47c75a78d878945390e63dffe90ae0bc7834203bb47577f5fedc1898f582552fd3ada4373b0cd84c9c707a4f180954d34e1ae4501cf7abc83104b2f0b0a83
7
+ data.tar.gz: 0e7a96c232c43fa318348c6b1cb70687444686b4fd88771c53bbb5e7bff21e5b09728d07f6e73c04033f589eb8b1f191f8d61913c31b195a5dccf743a0622cdb
@@ -26,6 +26,9 @@ module Sentry
26
26
  end
27
27
  end
28
28
 
29
+ # Sidekiq 7.0 started adding `_config` to the context, which is not easily serialisable
30
+ # And it's presence could be confusing so it's better to remove it until we decided to add it for a reason
31
+ filtered_context.delete(:_config)
29
32
  filtered_context
30
33
  end
31
34
 
@@ -3,13 +3,15 @@ require 'sentry/sidekiq/context_filter'
3
3
  module Sentry
4
4
  module Sidekiq
5
5
  class ErrorHandler
6
+ WITH_SIDEKIQ_7 = ::Gem::Version.new(::Sidekiq::VERSION) >= ::Gem::Version.new("7.0")
7
+
6
8
  def call(ex, context)
7
9
  return unless Sentry.initialized?
8
10
 
9
11
  context_filter = Sentry::Sidekiq::ContextFilter.new(context)
10
12
 
11
13
  scope = Sentry.get_current_scope
12
- scope.set_transaction_name(context_filter.transaction_name) unless scope.transaction_name
14
+ scope.set_transaction_name(context_filter.transaction_name, source: :task) unless scope.transaction_name
13
15
 
14
16
  if Sentry.configuration.sidekiq.report_after_job_retries && retryable?(context)
15
17
  retry_count = context.dig(:job, "retry_count")
@@ -40,7 +42,13 @@ module Sentry
40
42
  when Integer
41
43
  limit
42
44
  when TrueClass
43
- ::Sidekiq.options[:max_retries] || 25
45
+ max_retries =
46
+ if WITH_SIDEKIQ_7
47
+ ::Sidekiq.default_configuration[:max_retries]
48
+ else
49
+ ::Sidekiq.options[:max_retries]
50
+ end
51
+ max_retries || 25
44
52
  else
45
53
  0
46
54
  end
@@ -3,6 +3,8 @@ require 'sentry/sidekiq/context_filter'
3
3
  module Sentry
4
4
  module Sidekiq
5
5
  class SentryContextServerMiddleware
6
+ OP_NAME = "queue.sidekiq".freeze
7
+
6
8
  def call(_worker, job, queue)
7
9
  return yield unless Sentry.initialized?
8
10
 
@@ -16,8 +18,8 @@ module Sentry
16
18
  scope.set_tags(queue: queue, jid: job["jid"])
17
19
  scope.set_tags(build_tags(job["tags"]))
18
20
  scope.set_contexts(sidekiq: job.merge("queue" => queue))
19
- scope.set_transaction_name(context_filter.transaction_name)
20
- transaction = start_transaction(scope.transaction_name, job["sentry_trace"])
21
+ scope.set_transaction_name(context_filter.transaction_name, source: :task)
22
+ transaction = start_transaction(scope, job["sentry_trace"])
21
23
  scope.set_span(transaction) if transaction
22
24
 
23
25
  begin
@@ -37,8 +39,8 @@ module Sentry
37
39
  Array(tags).each_with_object({}) { |name, tags_hash| tags_hash[:"sidekiq.#{name}"] = true }
38
40
  end
39
41
 
40
- def start_transaction(transaction_name, sentry_trace)
41
- options = { name: transaction_name, op: "sidekiq" }
42
+ def start_transaction(scope, sentry_trace)
43
+ options = { name: scope.transaction_name, source: scope.transaction_source, op: OP_NAME }
42
44
  transaction = Sentry::Transaction.from_sentry_trace(sentry_trace, **options) if sentry_trace
43
45
  Sentry.start_transaction(transaction: transaction, **options)
44
46
  end
@@ -1,5 +1,5 @@
1
1
  module Sentry
2
2
  module Sidekiq
3
- VERSION = "5.3.0"
3
+ VERSION = "5.8.0"
4
4
  end
5
5
  end
@@ -22,6 +22,6 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ["lib"]
24
24
 
25
- spec.add_dependency "sentry-ruby-core", "~> 5.3.0"
25
+ spec.add_dependency "sentry-ruby", "~> 5.8.0"
26
26
  spec.add_dependency "sidekiq", ">= 3.0"
27
27
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.0
4
+ version: 5.8.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-04-27 00:00:00.000000000 Z
11
+ date: 2023-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: sentry-ruby-core
14
+ name: sentry-ruby
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 5.3.0
19
+ version: 5.8.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 5.3.0
26
+ version: 5.8.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sidekiq
29
29
  requirement: !ruby/object:Gem::Requirement