sentry-sidekiq 4.7.3 → 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: 2ced2289bc2cc163f72721b7c7f36641e5284385dd996957a2101e56dce70c5f
4
- data.tar.gz: ac1c947bd189f9ca85120adbab8cbb4b945fd979b24df937e92c42c61642ea71
3
+ metadata.gz: 43d75b2c6fd2c97b930568e38d5245b51b800cd5882260efdd912a924506ac60
4
+ data.tar.gz: 48219eae6a251ad30c1f3feb945b5032205967dbeb224389097dd4e00e2ea5ed
5
5
  SHA512:
6
- metadata.gz: 118f5555127aa222588791c9b0e4856abaf5679a37768de42dc4bb08b21db37f01e6e6ceb2cfbf67a797b3036debd789234c943a8347144177df952b0e07ee96
7
- data.tar.gz: 3a8025305833b9e2bd216344fe2a57a0765702ea4d27111429c5edc75df1404a842a32518b5d286e59ed897f7c576c87206557e54930646018c1a76598870429
6
+ metadata.gz: 8962bfdf04a1dc793acaf342fb1d8224e568a7e4c61832fe657c086135a12722608f06ed955fc0e4a1fb045b0af23cd1aa8f0a753f772895c6be974b5aa052b2
7
+ data.tar.gz: c829d3da7ad3d1420a30904822588d98046f467f1cffde520160818960c52c0a6ba8b73863fd12347ce8f92ca7d0d91bf600f027041c7af4986efd56075bef02
data/Gemfile CHANGED
@@ -5,7 +5,9 @@ gemspec
5
5
 
6
6
  gem "rake", "~> 12.0"
7
7
  gem "rspec", "~> 3.0"
8
- gem "codecov", "0.2.12"
8
+ gem 'simplecov'
9
+ gem "simplecov-cobertura", "~> 1.4"
10
+ gem "rexml"
9
11
 
10
12
  sidekiq_version = ENV["SIDEKIQ_VERSION"]
11
13
  sidekiq_version = "6.0" if sidekiq_version.nil?
@@ -17,6 +19,6 @@ gem "sentry-ruby", path: "../sentry-ruby"
17
19
  gem "sentry-rails", path: "../sentry-rails"
18
20
 
19
21
  gem "object_tracer"
20
- gem "debug", github: "ruby/debug" if RUBY_VERSION.to_f >= 2.6
22
+ gem "debug", github: "ruby/debug", platform: :ruby if RUBY_VERSION.to_f >= 2.6
21
23
  gem "pry"
22
24
 
data/Makefile CHANGED
@@ -3,5 +3,5 @@ build:
3
3
  gem build sentry-sidekiq.gemspec
4
4
 
5
5
  test:
6
- bundle exec rspec
7
6
  WITH_SENTRY_RAILS=1 bundle exec rspec spec/sentry/rails_spec.rb
7
+ bundle exec rspec
@@ -14,14 +14,15 @@ module Sentry
14
14
  scope.set_user(user)
15
15
  end
16
16
  scope.set_tags(queue: queue, jid: job["jid"])
17
+ scope.set_tags(build_tags(job["tags"]))
17
18
  scope.set_contexts(sidekiq: job.merge("queue" => queue))
18
19
  scope.set_transaction_name(context_filter.transaction_name)
19
- transaction = Sentry.start_transaction(name: scope.transaction_name, op: "sidekiq")
20
+ transaction = start_transaction(scope.transaction_name, job["sentry_trace"])
20
21
  scope.set_span(transaction) if transaction
21
22
 
22
23
  begin
23
24
  yield
24
- rescue => e
25
+ rescue
25
26
  finish_transaction(transaction, 500)
26
27
  raise
27
28
  end
@@ -32,6 +33,16 @@ module Sentry
32
33
  scope.clear
33
34
  end
34
35
 
36
+ def build_tags(tags)
37
+ Array(tags).each_with_object({}) { |name, tags_hash| tags_hash[:"sidekiq.#{name}"] = true }
38
+ end
39
+
40
+ def start_transaction(transaction_name, sentry_trace)
41
+ options = { name: transaction_name, op: "sidekiq" }
42
+ transaction = Sentry::Transaction.from_sentry_trace(sentry_trace, **options) if sentry_trace
43
+ Sentry.start_transaction(transaction: transaction, **options)
44
+ end
45
+
35
46
  def finish_transaction(transaction, status)
36
47
  return unless transaction
37
48
 
@@ -45,7 +56,9 @@ module Sentry
45
56
  return yield unless Sentry.initialized?
46
57
 
47
58
  user = Sentry.get_current_scope.user
59
+ transaction = Sentry.get_current_scope.get_transaction
48
60
  job["sentry_user"] = user unless user.empty?
61
+ job["sentry_trace"] = transaction.to_sentry_trace if transaction
49
62
  yield
50
63
  end
51
64
  end
@@ -1,5 +1,5 @@
1
1
  module Sentry
2
2
  module Sidekiq
3
- VERSION = "4.7.3"
3
+ VERSION = "4.8.3"
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", "~> 4.7.0"
25
+ spec.add_dependency "sentry-ruby-core", "~> 4.8.3"
26
26
  spec.add_dependency "sidekiq", ">= 3.0"
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.7.3
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-09-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: sentry-ruby-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 4.7.0
19
+ version: 4.8.3
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: 4.7.0
26
+ version: 4.8.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sidekiq
29
29
  requirement: !ruby/object:Gem::Requirement