sentry-sidekiq 4.6.3 → 4.7.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: 570c0f9669be2e0b3930ed00765452bf3088659d3c8655964ea94232f9dd23f0
4
- data.tar.gz: cae1948b48c4aa76b5b245509bb4c36db1138d6a9321def4178ee6d7077ba4b6
3
+ metadata.gz: e879f07a1d8fd71a766314d25e51c819c188c619ad6df259104f38e92414e1fb
4
+ data.tar.gz: 2e0b06a8a89414c6d1b8183427ee4c107b8cb6cb068b9582b773667752d3d20b
5
5
  SHA512:
6
- metadata.gz: e45cce73a9e121c689d907f234771738343ead77dfe51fd20194e5ad7c38d5a65ee8ec674bb315cad3108805ea6c1600eb832535b5b30eb42f3d540e7c7098ca
7
- data.tar.gz: f2fb4f6d5edacd7a1e92f964cf56d716b4a6ee2f47526a756359400e8a01a6c364d02f9849ce07c2154d33c2837d40c87354b8b8cc5e89e669f8df10ce53f2a4
6
+ metadata.gz: 223c44c83ca6c0bd9153512ef7f275517d5bc6e863cba9bfa5e51154be0517c19d2563f1b34f089b188506c1ce94d0899ec0e19dee1191642c80dc0823a072e4
7
+ data.tar.gz: 338ce1a0fba4c419161b9c8a44907e76df51a40a49c466e61420d6846a485fcb1001520fdea59c5965930d63bfebfd8902eb3d4774fa960c1dc413b95795a5ca
data/Gemfile CHANGED
@@ -7,8 +7,11 @@ gem "rake", "~> 12.0"
7
7
  gem "rspec", "~> 3.0"
8
8
  gem "codecov", "0.2.12"
9
9
 
10
- gem "sidekiq"
10
+ sidekiq_version = ENV["SIDEKIQ_VERSION"]
11
+ sidekiq_version = "6.0" if sidekiq_version.nil?
12
+
11
13
  gem "rails"
14
+ gem "sidekiq", "~> #{sidekiq_version}"
12
15
 
13
16
  gem "sentry-ruby", path: "../sentry-ruby"
14
17
  gem "sentry-rails", path: "../sentry-rails"
@@ -16,3 +19,4 @@ gem "sentry-rails", path: "../sentry-rails"
16
19
  gem "object_tracer"
17
20
  gem "debug", github: "ruby/debug" if RUBY_VERSION.to_f >= 2.6
18
21
  gem "pry"
22
+
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2020 st0012
3
+ Copyright (c) 2020 getsentry
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
@@ -0,0 +1,21 @@
1
+ module Sentry
2
+ class Configuration
3
+ attr_reader :sidekiq
4
+
5
+ add_post_initialization_callback do
6
+ @sidekiq = Sentry::Sidekiq::Configuration.new
7
+ end
8
+ end
9
+
10
+ module Sidekiq
11
+ class Configuration
12
+ # Set this option to true if you want Sentry to only capture the last job
13
+ # retry if it fails.
14
+ attr_accessor :report_after_job_retries
15
+
16
+ def initialize
17
+ @report_after_job_retries = false
18
+ end
19
+ end
20
+ end
21
+ end
@@ -11,6 +11,15 @@ module Sentry
11
11
  scope = Sentry.get_current_scope
12
12
  scope.set_transaction_name(context_filter.transaction_name) unless scope.transaction_name
13
13
 
14
+ retry_option = context.dig(:job, "retry")
15
+
16
+ if Sentry.configuration.sidekiq.report_after_job_retries && retry_option.is_a?(Integer) && retry_option.positive?
17
+ retry_count = context.dig(:job, "retry_count")
18
+ if retry_count.nil? || retry_count < retry_option - 1
19
+ return
20
+ end
21
+ end
22
+
14
23
  Sentry::Sidekiq.capture_exception(
15
24
  ex,
16
25
  contexts: { sidekiq: context_filter.filtered },
@@ -1,5 +1,5 @@
1
1
  module Sentry
2
2
  module Sidekiq
3
- VERSION = "4.6.3"
3
+ VERSION = "4.7.1"
4
4
  end
5
5
  end
@@ -2,6 +2,7 @@ require "sidekiq"
2
2
  require "sentry-ruby"
3
3
  require "sentry/integrable"
4
4
  require "sentry/sidekiq/version"
5
+ require "sentry/sidekiq/configuration"
5
6
  require "sentry/sidekiq/error_handler"
6
7
  require "sentry/sidekiq/sentry_context_middleware"
7
8
 
@@ -14,7 +15,7 @@ module Sentry
14
15
  if defined?(::Rails::Railtie)
15
16
  class Railtie < ::Rails::Railtie
16
17
  config.after_initialize do
17
- next unless Sentry.initialized?
18
+ next unless Sentry.initialized? && defined?(::Sentry::Rails)
18
19
 
19
20
  Sentry.configuration.rails.skippable_job_adapters << "ActiveJob::QueueAdapters::SidekiqAdapter"
20
21
  end
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
6
6
  spec.authors = ["Sentry Team"]
7
7
  spec.description = spec.summary = "A gem that provides Sidekiq integration for the Sentry error logger"
8
8
  spec.email = "accounts@sentry.io"
9
- spec.license = 'Apache-2.0'
9
+ spec.license = 'MIT'
10
10
  spec.homepage = "https://github.com/getsentry/sentry-ruby"
11
11
 
12
12
  spec.platform = Gem::Platform::RUBY
@@ -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.6.0"
25
+ spec.add_dependency "sentry-ruby-core", "~> 4.7.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.6.3
4
+ version: 4.7.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-07-26 00:00:00.000000000 Z
11
+ date: 2021-09-01 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.6.0
19
+ version: 4.7.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.6.0
26
+ version: 4.7.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sidekiq
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -62,6 +62,7 @@ files:
62
62
  - example/config/sidekiq.yml
63
63
  - example/error_worker.rb
64
64
  - lib/sentry-sidekiq.rb
65
+ - lib/sentry/sidekiq/configuration.rb
65
66
  - lib/sentry/sidekiq/context_filter.rb
66
67
  - lib/sentry/sidekiq/error_handler.rb
67
68
  - lib/sentry/sidekiq/sentry_context_middleware.rb
@@ -69,7 +70,7 @@ files:
69
70
  - sentry-sidekiq.gemspec
70
71
  homepage: https://github.com/getsentry/sentry-ruby
71
72
  licenses:
72
- - Apache-2.0
73
+ - MIT
73
74
  metadata:
74
75
  homepage_uri: https://github.com/getsentry/sentry-ruby
75
76
  source_code_uri: https://github.com/getsentry/sentry-ruby