sentry-sidekiq 0.2.0 → 4.1.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: 4d22287b7a4c79dcf5feefe8c5cb99fa9c2df29969b84dab1633084621ae1b60
4
- data.tar.gz: 54c9713d04731667756ece9ec36390841beac16b69d9ed897263756407a21d56
3
+ metadata.gz: a5ba9a7bc48974dbb919d2859fc58f2db605e1cffcddaa3058a7e0d8ee924832
4
+ data.tar.gz: fd590a815c902b52205fc2121b3e093439f9681fe66900809c2440f95af1594f
5
5
  SHA512:
6
- metadata.gz: 67e3ac109162c9e4244d81cb91068a2e59908d4666d12f6d2dec310390551cf1d6112e3bf2d3697681f70b38dcaf05acdb3277f83bfa6d0aff5a1263c985c658
7
- data.tar.gz: f14f69f0b14651ad7d1e17f41b5c83e51b6cec888ab821b41c250d6721a208277b4804f602ba730265ca74d23527e5de566e3efa1a474a3a79670d51b2f602c4
6
+ metadata.gz: 02b0bbab55d0a6fd6d01cc51bc51999e7ba5b81e13da199ebef25ebdec96bf9ed7a417936d9e26263db17dea462d9fa6b4fbcacc5035a6d34e8f9f8dd00828b8
7
+ data.tar.gz: 8e8aa01a87c52d657b38a674a9e892ce8d474b89c164ea27c67ed4ce9baba9bcfeb450efb465347792a5acaf881834cd7711f56db8fcc93823c98ea0f4946823
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.1.3
4
+
5
+ - Use sentry-ruby-core as the main SDK dependency [#1245](https://github.com/getsentry/sentry-ruby/pull/1245)
6
+
7
+ ## 4.1.2
8
+
9
+ - Fix sidekiq middleware [#1175](https://github.com/getsentry/sentry-ruby/pull/1175)
10
+ - Fixes [#1173](https://github.com/getsentry/sentry-ruby/issues/1173)
11
+ - Adopt Integrable module [#1177](https://github.com/getsentry/sentry-ruby/pull/1177)
12
+
13
+ ## 4.1.1
14
+
15
+ - Use stricter dependency declaration [#1159](https://github.com/getsentry/sentry-ruby/pull/1159)
16
+
17
+ ## 4.1.0
18
+
19
+ - Check SDK initialization before running integrations [#1151](https://github.com/getsentry/sentry-ruby/pull/1151)
20
+ - Fixes [#1145](https://github.com/getsentry/sentry-ruby/pull/1145)
21
+
22
+ ## 4.0.0
23
+
24
+ - Only documents update for the official release and no API/feature changes.
25
+
3
26
  ## 0.2.0
4
27
 
5
28
  - Major API changes: [1123](https://github.com/getsentry/sentry-ruby/pull/1123)
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ gemspec
5
5
 
6
6
  gem "rake", "~> 12.0"
7
7
  gem "rspec", "~> 3.0"
8
- gem "codecov"
8
+ gem "codecov", "0.2.12"
9
9
 
10
10
  gem "sidekiq"
11
11
  gem "activejob"
@@ -0,0 +1,3 @@
1
+ build:
2
+ bundle install
3
+ gem build sentry-sidekiq.gemspec
data/README.md CHANGED
@@ -17,7 +17,7 @@
17
17
  [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=sentry-sidekiq&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=sentry-sidekiq&package-manager=bundler&version-scheme=semver)
18
18
 
19
19
 
20
- [Documentation](https://docs.sentry.io/clients/ruby/) | [Bug Tracker](https://github.com/getsentry/sentry-ruby/issues) | [Forum](https://forum.sentry.io/) | IRC: irc.freenode.net, #sentry
20
+ [Documentation](https://docs.sentry.io/platforms/ruby/guides/sidekiq/) | [Bug Tracker](https://github.com/getsentry/sentry-ruby/issues) | [Forum](https://forum.sentry.io/) | IRC: irc.freenode.net, #sentry
21
21
 
22
22
  The official Ruby-language client and integration layer for the [Sentry](https://github.com/getsentry/sentry) error reporting API.
23
23
 
@@ -27,6 +27,7 @@ The official Ruby-language client and integration layer for the [Sentry](https:/
27
27
  ### Install
28
28
 
29
29
  ```ruby
30
+ gem "sentry-ruby"
30
31
  gem "sentry-sidekiq"
31
32
  ```
32
33
 
@@ -1,24 +1,23 @@
1
1
  require "sidekiq"
2
2
  require "sentry-ruby"
3
+ require "sentry/integrable"
3
4
  require "sentry/sidekiq/version"
4
5
  require "sentry/sidekiq/error_handler"
5
- require "sentry/sidekiq/cleanup_middleware"
6
+ require "sentry/sidekiq/sentry_context_middleware"
6
7
  # require "sentry/sidekiq/configuration"
7
8
 
8
9
  module Sentry
9
10
  module Sidekiq
10
- META = { "name" => "sentry.ruby.sidekiq", "version" => Sentry::Sidekiq::VERSION }.freeze
11
- end
11
+ extend Sentry::Integrable
12
12
 
13
- def self.sdk_meta
14
- Sentry::Sidekiq::META
13
+ register_integration name: "sidekiq", version: Sentry::Sidekiq::VERSION
15
14
  end
16
15
  end
17
16
 
18
17
  Sidekiq.configure_server do |config|
19
18
  config.error_handlers << Sentry::Sidekiq::ErrorHandler.new
20
19
  config.server_middleware do |chain|
21
- chain.add Sentry::Sidekiq::CleanupMiddleware
20
+ chain.add Sentry::Sidekiq::SentryContextMiddleware
22
21
  end
23
22
  end
24
23
 
@@ -2,6 +2,8 @@ module Sentry
2
2
  module Sidekiq
3
3
  class CleanupMiddleware
4
4
  def call(_worker, job, queue)
5
+ return yield unless Sentry.initialized?
6
+
5
7
  Sentry.clone_hub_to_current_thread
6
8
  Sentry.with_scope do |scope|
7
9
  scope.set_extras(sidekiq: job.merge("queue" => queue))
@@ -10,7 +12,7 @@ module Sentry
10
12
  begin
11
13
  yield
12
14
  rescue => ex
13
- Sentry.capture_exception(ex)
15
+ Sentry::Sidekiq.capture_exception(ex, hint: { background: false })
14
16
  end
15
17
  end
16
18
  end
@@ -6,15 +6,16 @@ module Sentry
6
6
  SIDEKIQ_NAME = "Sidekiq".freeze
7
7
 
8
8
  def call(ex, context)
9
+ return unless Sentry.initialized?
9
10
  context = Sentry::Sidekiq::ContextFilter.new.filter_context(context)
11
+ scope = Sentry.get_current_scope
12
+ scope.set_transaction_name(transaction_from_context(context)) unless scope.transaction_name
10
13
 
11
- Sentry.with_scope do |scope|
12
- scope.set_transaction_name transaction_from_context(context)
13
- Sentry.capture_exception(
14
- ex,
15
- extra: { sidekiq: context }
16
- )
17
- end
14
+ Sentry::Sidekiq.capture_exception(
15
+ ex,
16
+ extra: { sidekiq: context },
17
+ hint: { background: false }
18
+ )
18
19
  end
19
20
 
20
21
  private
@@ -0,0 +1,20 @@
1
+ module Sentry
2
+ module Sidekiq
3
+ class SentryContextMiddleware
4
+ def call(_worker, job, queue)
5
+ return yield unless Sentry.initialized?
6
+
7
+ Sentry.clone_hub_to_current_thread
8
+ scope = Sentry.get_current_scope
9
+ scope.set_extras(sidekiq: job.merge("queue" => queue))
10
+ scope.set_transaction_name("Sidekiq/#{job["class"]}")
11
+
12
+ yield
13
+
14
+ # don't need to use ensure here
15
+ # if the job failed, we need to keep the scope for error handler. and the scope will be cleared there
16
+ scope.clear
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,5 +1,5 @@
1
1
  module Sentry
2
2
  module Sidekiq
3
- VERSION = "0.2.0"
3
+ VERSION = "4.1.3"
4
4
  end
5
5
  end
@@ -16,11 +16,11 @@ Gem::Specification.new do |spec|
16
16
 
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = spec.homepage
19
- spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
19
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/sentry-sidekiq/CHANGELOG.md"
20
20
 
21
21
  spec.bindir = "exe"
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", ">= 0.3.0"
25
+ spec.add_dependency "sentry-ruby-core", "~> 4.1.2"
26
26
  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: 0.2.0
4
+ version: 4.1.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: 2020-12-04 00:00:00.000000000 Z
11
+ date: 2021-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: sentry-ruby
14
+ name: sentry-ruby-core
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.3.0
19
+ version: 4.1.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: 0.3.0
26
+ version: 4.1.2
27
27
  description: A gem that provides Sidekiq integration for the Sentry error logger
28
28
  email: accounts@sentry.io
29
29
  executables: []
@@ -35,11 +35,11 @@ files:
35
35
  - ".craft.yml"
36
36
  - ".gitignore"
37
37
  - ".rspec"
38
- - ".travis.yml"
39
38
  - CHANGELOG.md
40
39
  - CODE_OF_CONDUCT.md
41
40
  - Gemfile
42
41
  - LICENSE.txt
42
+ - Makefile
43
43
  - README.md
44
44
  - Rakefile
45
45
  - bin/console
@@ -52,6 +52,7 @@ files:
52
52
  - lib/sentry/sidekiq/cleanup_middleware.rb
53
53
  - lib/sentry/sidekiq/context_filter.rb
54
54
  - lib/sentry/sidekiq/error_handler.rb
55
+ - lib/sentry/sidekiq/sentry_context_middleware.rb
55
56
  - lib/sentry/sidekiq/version.rb
56
57
  - sentry-sidekiq.gemspec
57
58
  homepage: https://github.com/getsentry/sentry-ruby
@@ -60,7 +61,7 @@ licenses:
60
61
  metadata:
61
62
  homepage_uri: https://github.com/getsentry/sentry-ruby
62
63
  source_code_uri: https://github.com/getsentry/sentry-ruby
63
- changelog_uri: https://github.com/getsentry/sentry-ruby/blob/master/CHANGELOG.md
64
+ changelog_uri: https://github.com/getsentry/sentry-ruby/blob/master/sentry-sidekiq/CHANGELOG.md
64
65
  post_install_message:
65
66
  rdoc_options: []
66
67
  require_paths:
@@ -1,6 +0,0 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.6.5
6
- before_install: gem install bundler -v 2.1.1