sentry-sidekiq 4.7.0 → 4.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: 4b3171c41f5f846d3f8c4f1ccb50636dead582c00abe5600cb552ba56e4c2b2e
4
- data.tar.gz: 781f0ae3e22206cfd162ded78ac0199013890de73fadba2ccc360a023c5d9321
3
+ metadata.gz: ff51b83dcd4d0cd691df4746a86024011cac343c507f991f8a0754f4508ad7b1
4
+ data.tar.gz: 428d690bef6e4443bb6083755815d84e418045a6b4fb02c18bff98090e41a9da
5
5
  SHA512:
6
- metadata.gz: 1b857c91e200172af2d28d69df3b8069a0e70f1146f20828483595ea423621ccc4e12b06d050727c32aaab07a90c2638a38a46f88301320385e2ae1d30c040c1
7
- data.tar.gz: 8a028b2c535d7b8a0e3740be347aeb443bfd05fa7b2db0594858c3d97019837b4612b7ad364c4098f89fe78599ca73daa60389fd9f7eb2011b26129db5e5b891
6
+ metadata.gz: 3f8b200f64055deaa7b7e0dff153880c3fe85c4370c546fb62de0959ae997ed6359a1bedb32f03ef7e434f1aa86185c077378b5d02b371629b7c2a6b1bbe3e8a
7
+ data.tar.gz: 10111d2baf8df65d4771e5d33542685bb803e37eda44cbc94f4ae375783b2614b9da1dc969509ae5a452b3612f3c4cb72ee4857a6c4d6513606ee7931c2f8474
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/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2020 getsentry
3
+ Copyright (c) 2020 Sentry
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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"
@@ -13,7 +13,7 @@ module Sentry
13
13
 
14
14
  retry_option = context.dig(:job, "retry")
15
15
 
16
- if Sentry.configuration.sidekiq.report_after_job_retries && retry_option.is_a?(Integer)
16
+ if Sentry.configuration.sidekiq.report_after_job_retries && retry_option.is_a?(Integer) && retry_option.positive?
17
17
  retry_count = context.dig(:job, "retry_count")
18
18
  if retry_count.nil? || retry_count < retry_option - 1
19
19
  return
@@ -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.0"
3
+ VERSION = "4.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", "~> 4.7.0"
25
+ spec.add_dependency "sentry-ruby-core", "~> 4.8.0"
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.0
4
+ version: 4.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: 2021-09-01 00:00:00.000000000 Z
11
+ date: 2021-11-11 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.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: 4.7.0
26
+ version: 4.8.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sidekiq
29
29
  requirement: !ruby/object:Gem::Requirement