sentry-sidekiq 0.1.3 → 4.1.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: d6071f98aa7f9cc6a30bd6d295010742fa3aaeb74408ca643876a64d8b782c61
4
- data.tar.gz: c96a082c6907f10f17f0343a8bd178973f5e81dd62aff35dae1126c102a26c73
3
+ metadata.gz: 4370fdcec568ea785e549d24e250575ad8bb93b7a46bd27e777e9c6776407a57
4
+ data.tar.gz: 99a527bf321e1645843a159f9706ea8215976485833b8c20dcb243b56bce6016
5
5
  SHA512:
6
- metadata.gz: 619aca07c663eea832604390ad0a1afb9492b297d6660dc9bb3fcd39e1c214a0dce3a4f7bda7021f3f59b79a48e882634db847461f079cb92ee33f5b17af4d99
7
- data.tar.gz: 874e3856fc69ca947cd597066833cbf324afa58f1fe0c18127a3a3b8758bcb849149b1cf22a9aea655dcbc77f6c417ecd722a91e74d458aa94a12d7b4f4e596c
6
+ metadata.gz: 6fdd057e634833b1ee467af9800ba759d2bca7a88ae9a1a8f84d844c8afa99b6aeb5d241b3f267275b5e42176c56943286a2b89407f5b7cc135fac520d04e833
7
+ data.tar.gz: 53ca304f50dc403af8a7f5d7011c2d1d6850ce111859796bac193736b8c6a5778428822db519eae7c0e412290a56b709e09fd59031093613b089b96379f9d38c
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.1.2
4
+
5
+ - Fix sidekiq middleware [#1175](https://github.com/getsentry/sentry-ruby/pull/1175)
6
+ - Fixes [#1173](https://github.com/getsentry/sentry-ruby/issues/1173)
7
+ - Adopt Integrable module [#1177](https://github.com/getsentry/sentry-ruby/pull/1177)
8
+
9
+ ## 4.1.1
10
+
11
+ - Use stricter dependency declaration [#1159](https://github.com/getsentry/sentry-ruby/pull/1159)
12
+
13
+ ## 4.1.0
14
+
15
+ - Check SDK initialization before running integrations [#1151](https://github.com/getsentry/sentry-ruby/pull/1151)
16
+ - Fixes [#1145](https://github.com/getsentry/sentry-ruby/pull/1145)
17
+
18
+ ## 4.0.0
19
+
20
+ - Only documents update for the official release and no API/feature changes.
21
+
22
+ ## 0.2.0
23
+
24
+ - Major API changes: [1123](https://github.com/getsentry/sentry-ruby/pull/1123)
25
+
3
26
  ## 0.1.3
4
27
 
5
28
  - Small fixes
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"
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.1.3"
3
+ VERSION = "4.1.2"
4
4
  end
5
5
  end
@@ -22,5 +22,5 @@ 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", ">= 0.2.0"
25
+ spec.add_dependency "sentry-ruby", "~> 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.1.3
4
+ version: 4.1.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: 2020-11-30 00:00:00.000000000 Z
11
+ date: 2020-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sentry-ruby
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.2.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.2.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: []
@@ -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