sentry-sidekiq 4.7.2 → 4.8.2

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: bdf23944483ee1cd2326aa006a9e571a55bcc4ae6236933b522f43b60d5133ee
4
- data.tar.gz: bf74d3c1c26831a66cf0c6a19dd74c52e03579ba5c3140c0cd89bdeb9259f9e8
3
+ metadata.gz: ead1e13e14c95b619cf9edf29e806d918a5ba13decfbd20f8c0ead049ebb2ece
4
+ data.tar.gz: ae9e66ef64845049655181cb73eb8d4bd8ce333454b8ebce829dc56bdf3c2dbd
5
5
  SHA512:
6
- metadata.gz: a405d079263c93631e7f1ba7b2929eaf553033e599364bbb798d0be735525e6a13f6b0f5c80e11fd7eb69ce723b0972d1ae93f36ff97b402287e8aeef1567a37
7
- data.tar.gz: 73837bd36ca00e0acb667a9582e5a750b03ab377e00b4abfb769e56bee6da16469ac751e951f2e88e408e0bd5e94fa8115c956c080e4240f106b9be814b5d180
6
+ metadata.gz: d4af9ee4ee83a06a906a49e73dc72c551f697f4ba9d7231a3f0520439313fc821f755ebc17d122e7471f2adc253df5370823ac55911a9c846a861876affefb60
7
+ data.tar.gz: c3d3e959203d98c3ce28958bff10c338f913e9f2db29e4f705e1e7aae484c00d012f25cdbf638964dacbb5a010d309ef24101045bb2eedeaf0cad9004d39d9a2
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
data/example/Gemfile CHANGED
@@ -5,3 +5,4 @@ gem "sentry-sidekiq", path: "../"
5
5
  gem "sentry-ruby", path: "../../sentry-ruby"
6
6
 
7
7
  gem "pry"
8
+ gem "debug", github: "ruby/debug"
@@ -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.2"
3
+ VERSION = "4.8.2"
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.2"
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.2
4
+ version: 4.8.2
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-09 00:00:00.000000000 Z
11
+ date: 2022-01-04 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.2
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.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sidekiq
29
29
  requirement: !ruby/object:Gem::Requirement