sentry-sidekiq 5.22.1 → 5.23.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: 2aa3f4ae82ab8d6fc5fba46337262b12da3a0dd00d5e62ff4489ecf533b93869
4
- data.tar.gz: 0f337deae3dd7d56fcf5309ba511ed42aa5f97ea6754e77cf931dc91eea9f099
3
+ metadata.gz: f148056f19ce53c66ebaf8333a6b3c709e86a8e7969de532ebe533b7ab85bc56
4
+ data.tar.gz: ee4b228e87bade38000c0611bf7ff30c97f9760a6bb4c6124749f29047d02a1b
5
5
  SHA512:
6
- metadata.gz: 611488068db6136aa27ec043d01e5787f0e8d7199ffbc3a6628ab1fd6bab8692f50e19dd42718e14c15623422704b53a8ca052bbdf1d194bbec7dfeb6ef5609c
7
- data.tar.gz: 896d0b90b5ef1992d0137ba905e2db8b1c6a5c04ab2f6d3ee9b7f9cb1fc016796bb3dbcf42b550074c83677701c825e4609c019ef8fd91412bb02328ad3f2920
6
+ metadata.gz: aebc7d66e3784931eb99880ab5cc57b68aa3e9fa5c3869bba9ae6ccb0e1ed30b3094efda604fe14f96c1cddd0816628e7c9fcc40046fe6fd01de1371221662ef
7
+ data.tar.gz: 389145a410e38c17e9504e2fb43102086328fa32cb17fc68dd4314376cde96fee336bd65749deddc707beb87f5a380b4ca91c30ba6a0536f2cde6f4caeddeb88
data/Gemfile CHANGED
@@ -3,8 +3,11 @@
3
3
  source "https://rubygems.org"
4
4
  git_source(:github) { |name| "https://github.com/#{name}.git" }
5
5
 
6
+ eval_gemfile "../Gemfile"
7
+
6
8
  # Specify your gem's dependencies in sentry-ruby.gemspec
7
9
  gemspec
10
+
8
11
  gem "sentry-ruby", path: "../sentry-ruby"
9
12
  gem "sentry-rails", path: "../sentry-rails"
10
13
 
@@ -26,5 +29,3 @@ end
26
29
  gem "rails", "> 5.0.0"
27
30
 
28
31
  gem "timecop"
29
-
30
- eval_gemfile File.expand_path("../Gemfile", __dir__)
@@ -11,7 +11,10 @@ module Sentry
11
11
  end
12
12
 
13
13
  module Sidekiq
14
- IGNORE_DEFAULT = ["Sidekiq::JobRetry::Skip"]
14
+ IGNORE_DEFAULT = [
15
+ "Sidekiq::JobRetry::Skip",
16
+ "Sidekiq::JobRetry::Handled"
17
+ ]
15
18
 
16
19
  class Configuration
17
20
  # Set this option to true if you want Sentry to only capture the last job
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sentry
4
+ module Sidekiq
5
+ module Cron
6
+ module Helpers
7
+ # This is used by Cron::Job and Scheduler
8
+ def self.monitor_config(cron)
9
+ cron_parts = cron.strip.split(" ")
10
+
11
+ if cron_parts.length > 5
12
+ timezone = cron_parts.pop
13
+ cron_without_timezone = cron_parts.join(" ")
14
+
15
+ Sentry::Cron::MonitorConfig.from_crontab(cron_without_timezone, timezone: timezone)
16
+ else
17
+ Sentry::Cron::MonitorConfig.from_crontab(cron)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -55,7 +55,7 @@ module Sentry
55
55
  klass_const.send(:include, Sentry::Cron::MonitorCheckIns)
56
56
  klass_const.send(:sentry_monitor_check_ins,
57
57
  slug: name.to_s,
58
- monitor_config: Sentry::Cron::MonitorConfig.from_crontab(parsed_cron.original))
58
+ monitor_config: Sentry::Sidekiq::Cron::Helpers.monitor_config(parsed_cron.original))
59
59
  end
60
60
 
61
61
  true
@@ -31,6 +31,19 @@ module Sentry
31
31
  end
32
32
  end
33
33
 
34
+ # Check if the retry count is below the attempt_threshold
35
+ attempt_threshold = context.dig(:job, "attempt_threshold")
36
+ if attempt_threshold && retryable?(context)
37
+ attempt_threshold = attempt_threshold.to_i
38
+ retry_count = context.dig(:job, "retry_count")
39
+ # attempt 1 - retry_count is nil
40
+ # attempt 2 - this is your first retry so retry_count is 0
41
+ # attempt 3 - you have retried once, retry_count is 1
42
+ attempt = retry_count.nil? ? 1 : retry_count.to_i + 2
43
+
44
+ return if attempt < attempt_threshold
45
+ end
46
+
34
47
  Sentry::Sidekiq.capture_exception(
35
48
  ex,
36
49
  contexts: { sidekiq: context_filter.filtered },
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sentry
4
4
  module Sidekiq
5
- VERSION = "5.22.1"
5
+ VERSION = "5.23.0"
6
6
  end
7
7
  end
@@ -38,19 +38,7 @@ module Sentry
38
38
  monitor_config =
39
39
  case interval_type
40
40
  when "cron"
41
- # fugit is a second order dependency of sidekiq-scheduler via rufus-scheduler
42
- parsed_cron = ::Fugit.parse_cron(schedule)
43
- timezone = parsed_cron.timezone
44
-
45
- # fugit supports having the timezone part of the cron string,
46
- # so we need to pull that with some hacky stuff
47
- if timezone
48
- parsed_cron.instance_variable_set(:@timezone, nil)
49
- cron_without_timezone = parsed_cron.to_cron_s
50
- Sentry::Cron::MonitorConfig.from_crontab(cron_without_timezone, timezone: timezone.name)
51
- else
52
- Sentry::Cron::MonitorConfig.from_crontab(schedule)
53
- end
41
+ Sentry::Sidekiq::Cron::Helpers.monitor_config(schedule)
54
42
  when "every", "interval"
55
43
  Sentry::Cron::MonitorConfig.from_interval(rufus_job.frequency.to_i / 60, :minute)
56
44
  end
@@ -43,5 +43,6 @@ Sidekiq.configure_client do |config|
43
43
  end
44
44
 
45
45
  # patches
46
+ require "sentry/sidekiq/cron/helpers"
46
47
  require "sentry/sidekiq/cron/job"
47
48
  require "sentry/sidekiq-scheduler/scheduler"
@@ -30,6 +30,6 @@ Gem::Specification.new do |spec|
30
30
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
31
  spec.require_paths = ["lib"]
32
32
 
33
- spec.add_dependency "sentry-ruby", "~> 5.22.1"
33
+ spec.add_dependency "sentry-ruby", "~> 5.23.0"
34
34
  spec.add_dependency "sidekiq", ">= 3.0"
35
35
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-sidekiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.22.1
4
+ version: 5.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sentry Team
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-12-16 00:00:00.000000000 Z
10
+ date: 2025-03-11 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: sentry-ruby
@@ -16,14 +15,14 @@ dependencies:
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: 5.22.1
18
+ version: 5.23.0
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: 5.22.1
25
+ version: 5.23.0
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: sidekiq
29
28
  requirement: !ruby/object:Gem::Requirement
@@ -64,21 +63,21 @@ files:
64
63
  - lib/sentry/sidekiq-scheduler/scheduler.rb
65
64
  - lib/sentry/sidekiq/configuration.rb
66
65
  - lib/sentry/sidekiq/context_filter.rb
66
+ - lib/sentry/sidekiq/cron/helpers.rb
67
67
  - lib/sentry/sidekiq/cron/job.rb
68
68
  - lib/sentry/sidekiq/error_handler.rb
69
69
  - lib/sentry/sidekiq/sentry_context_middleware.rb
70
70
  - lib/sentry/sidekiq/version.rb
71
71
  - sentry-sidekiq.gemspec
72
- homepage: https://github.com/getsentry/sentry-ruby/tree/5.22.1/sentry-sidekiq
72
+ homepage: https://github.com/getsentry/sentry-ruby/tree/5.23.0/sentry-sidekiq
73
73
  licenses:
74
74
  - MIT
75
75
  metadata:
76
- homepage_uri: https://github.com/getsentry/sentry-ruby/tree/5.22.1/sentry-sidekiq
77
- source_code_uri: https://github.com/getsentry/sentry-ruby/tree/5.22.1/sentry-sidekiq
78
- changelog_uri: https://github.com/getsentry/sentry-ruby/blob/5.22.1/CHANGELOG.md
76
+ homepage_uri: https://github.com/getsentry/sentry-ruby/tree/5.23.0/sentry-sidekiq
77
+ source_code_uri: https://github.com/getsentry/sentry-ruby/tree/5.23.0/sentry-sidekiq
78
+ changelog_uri: https://github.com/getsentry/sentry-ruby/blob/5.23.0/CHANGELOG.md
79
79
  bug_tracker_uri: https://github.com/getsentry/sentry-ruby/issues
80
- documentation_uri: http://www.rubydoc.info/gems/sentry-sidekiq/5.22.1
81
- post_install_message:
80
+ documentation_uri: http://www.rubydoc.info/gems/sentry-sidekiq/5.23.0
82
81
  rdoc_options: []
83
82
  require_paths:
84
83
  - lib
@@ -93,8 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
92
  - !ruby/object:Gem::Version
94
93
  version: '0'
95
94
  requirements: []
96
- rubygems_version: 3.5.22
97
- signing_key:
95
+ rubygems_version: 3.6.2
98
96
  specification_version: 4
99
97
  summary: A gem that provides Sidekiq integration for the Sentry error logger
100
98
  test_files: []