sentry-sidekiq 4.7.1 → 4.8.1

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: e879f07a1d8fd71a766314d25e51c819c188c619ad6df259104f38e92414e1fb
4
- data.tar.gz: 2e0b06a8a89414c6d1b8183427ee4c107b8cb6cb068b9582b773667752d3d20b
3
+ metadata.gz: 949887e093455257abbf40b7ff7d8adbb3b28a149bc99a9668be4998089fca0c
4
+ data.tar.gz: c98f7768b82b010bfe34dc78b2920503e2599c1183efea781773d2be44dfa9af
5
5
  SHA512:
6
- metadata.gz: 223c44c83ca6c0bd9153512ef7f275517d5bc6e863cba9bfa5e51154be0517c19d2563f1b34f089b188506c1ce94d0899ec0e19dee1191642c80dc0823a072e4
7
- data.tar.gz: 338ce1a0fba4c419161b9c8a44907e76df51a40a49c466e61420d6846a485fcb1001520fdea59c5965930d63bfebfd8902eb3d4774fa960c1dc413b95795a5ca
6
+ metadata.gz: fcfcf7c10ff0ca683834944b711bcf4a57492209b32aca63505db44be6fabcd9ed3e9c1671b8fc3c993a385671c5d88d732b7498140b022d45b9e0466e487780
7
+ data.tar.gz: 3c6594dba69cfb982254f40442ff6817a57e35c5359e7c330c6717a7855995d463b82f11ab191346575f6054e6b65fce69f12d2a1bcbb5ae3962f448aa939c09
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"
@@ -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.1"
3
+ VERSION = "4.8.1"
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.1"
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.1
4
+ version: 4.8.1
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-22 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.1
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.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sidekiq
29
29
  requirement: !ruby/object:Gem::Requirement