sentry-sidekiq 4.6.5 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 666a6688ac42b70a0134030d26e15b8391adf574d024a6abbab9a949f26e2fd3
4
- data.tar.gz: '09eea35fbd0433bd0d9d2afae1a46327d1f14227aa6c72204ffa76b5267b8dc7'
3
+ metadata.gz: 4b3171c41f5f846d3f8c4f1ccb50636dead582c00abe5600cb552ba56e4c2b2e
4
+ data.tar.gz: 781f0ae3e22206cfd162ded78ac0199013890de73fadba2ccc360a023c5d9321
5
5
  SHA512:
6
- metadata.gz: 917768117376b8289170f04ce12df6df04f8acac8b86263ce2078a1b9c8799b75f9a85b745860537763eef6f8b36f111e3aa03620cebb03c3cf2493a0e423ac9
7
- data.tar.gz: 62bba56cd1a0e337f072f8446656c59d22d45ca4d69449a3069a52a7306255bbd678dd7393e09dd1fc348d05d8237b1a33929a0559733b0c8801885c5ce81605
6
+ metadata.gz: 1b857c91e200172af2d28d69df3b8069a0e70f1146f20828483595ea423621ccc4e12b06d050727c32aaab07a90c2638a38a46f88301320385e2ae1d30c040c1
7
+ data.tar.gz: 8a028b2c535d7b8a0e3740be347aeb443bfd05fa7b2db0594858c3d97019837b4612b7ad364c4098f89fe78599ca73daa60389fd9f7eb2011b26129db5e5b891
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)
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.5"
3
+ VERSION = "4.7.0"
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.5
4
+ version: 4.7.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-08-12 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