sentry-sidekiq 5.22.0 → 5.22.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: 83fbb1f91441c9adf737eaf26f68e5161de49eaf18cbcfb3f64ca104f1de4076
4
- data.tar.gz: eb15ed9917c8677b982bfa5a81a080b80da54084051a5975ff0b678175ee0a38
3
+ metadata.gz: b36dbbd090d1178b71b8ce282e0bb053b067ea7e05e0d7c215a3d29fa3872817
4
+ data.tar.gz: 2fee63cd4fdfea8e290d089e7143b48a4324153e77fb87c9bfe22226fed27a80
5
5
  SHA512:
6
- metadata.gz: 54831f113983325cc42c0e6bdf1765a01b1bf7769cade041270ab3c0475bb14ef95ee71b6461cf95f4c1139f0cfeea82cab0c846b3a4dad6e814bfa4fec423bc
7
- data.tar.gz: 4bf2ad8e03051cf927c5f11c404bfe0a93e2cc17fc91f10b0233da2d14dc36cef4f20cf1386b871dcce982a857c8c617441495ab4a20f8bca5a1c9f6f45ef96c
6
+ metadata.gz: dc2966e26f5431bd2b6fd1a47015da73bc8f1e75cca2d19b6722498bb5cdf2c6c270e4c8d308555b6ededca6cf9a8e1e670d111aa457e1fb24719669973dadcb
7
+ data.tar.gz: 6254ece04b3c5215ca119a5f7272d7d0d101b0ccbb3700f91c00b4fd957f14b8a06fd6fd1617d437c81509931b39bfd9bda7576c153a262873dcd0e07544c148
@@ -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
@@ -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 },
@@ -6,12 +6,12 @@ module Sentry
6
6
  module Sidekiq
7
7
  module Helpers
8
8
  def set_span_data(span, id:, queue:, latency: nil, retry_count: nil)
9
- if span
10
- span.set_data("messaging.message.id", id)
11
- span.set_data("messaging.destination.name", queue)
12
- span.set_data("messaging.message.receive.latency", latency) if latency
13
- span.set_data("messaging.message.retry.count", retry_count) if retry_count
14
- end
9
+ return unless span
10
+
11
+ span.set_data(Span::DataConventions::MESSAGING_MESSAGE_ID, id)
12
+ span.set_data(Span::DataConventions::MESSAGING_DESTINATION_NAME, queue)
13
+ span.set_data(Span::DataConventions::MESSAGING_MESSAGE_RECEIVE_LATENCY, latency) if latency
14
+ span.set_data(Span::DataConventions::MESSAGING_MESSAGE_RETRY_COUNT, retry_count) if retry_count
15
15
  end
16
16
  end
17
17
 
@@ -40,7 +40,14 @@ module Sentry
40
40
  if transaction
41
41
  scope.set_span(transaction)
42
42
 
43
- set_span_data(transaction, id: job["jid"], queue: queue, latency: ((Time.now.to_f - job["enqueued_at"]) * 1000).to_i, retry_count: job["retry_count"] || 0)
43
+ latency = ((Time.now.to_f - job["enqueued_at"]) * 1000).to_i if job["enqueued_at"]
44
+ set_span_data(
45
+ transaction,
46
+ id: job["jid"],
47
+ queue: queue,
48
+ latency: latency,
49
+ retry_count: job["retry_count"] || 0
50
+ )
44
51
  end
45
52
 
46
53
  begin
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sentry
4
4
  module Sidekiq
5
- VERSION = "5.22.0"
5
+ VERSION = "5.22.2"
6
6
  end
7
7
  end
@@ -38,16 +38,14 @@ 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
41
+ # Split schedule into cron and timezone parts (if timezone exists)
42
+ cron_parts = schedule.strip.split(" ")
44
43
 
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)
44
+ if cron_parts.length > 5
45
+ timezone = cron_parts.pop
46
+ cron_without_timezone = cron_parts.join(" ")
47
+
48
+ Sentry::Cron::MonitorConfig.from_crontab(cron_without_timezone, timezone: timezone)
51
49
  else
52
50
  Sentry::Cron::MonitorConfig.from_crontab(schedule)
53
51
  end
@@ -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.0"
33
+ spec.add_dependency "sentry-ruby", "~> 5.22.2"
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.0
4
+ version: 5.22.2
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-04 00:00:00.000000000 Z
10
+ date: 2025-01-24 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.0
18
+ version: 5.22.2
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.0
25
+ version: 5.22.2
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: sidekiq
29
28
  requirement: !ruby/object:Gem::Requirement
@@ -69,16 +68,15 @@ files:
69
68
  - lib/sentry/sidekiq/sentry_context_middleware.rb
70
69
  - lib/sentry/sidekiq/version.rb
71
70
  - sentry-sidekiq.gemspec
72
- homepage: https://github.com/getsentry/sentry-ruby/tree/5.22.0/sentry-sidekiq
71
+ homepage: https://github.com/getsentry/sentry-ruby/tree/5.22.2/sentry-sidekiq
73
72
  licenses:
74
73
  - MIT
75
74
  metadata:
76
- homepage_uri: https://github.com/getsentry/sentry-ruby/tree/5.22.0/sentry-sidekiq
77
- source_code_uri: https://github.com/getsentry/sentry-ruby/tree/5.22.0/sentry-sidekiq
78
- changelog_uri: https://github.com/getsentry/sentry-ruby/blob/5.22.0/CHANGELOG.md
75
+ homepage_uri: https://github.com/getsentry/sentry-ruby/tree/5.22.2/sentry-sidekiq
76
+ source_code_uri: https://github.com/getsentry/sentry-ruby/tree/5.22.2/sentry-sidekiq
77
+ changelog_uri: https://github.com/getsentry/sentry-ruby/blob/5.22.2/CHANGELOG.md
79
78
  bug_tracker_uri: https://github.com/getsentry/sentry-ruby/issues
80
- documentation_uri: http://www.rubydoc.info/gems/sentry-sidekiq/5.22.0
81
- post_install_message:
79
+ documentation_uri: http://www.rubydoc.info/gems/sentry-sidekiq/5.22.2
82
80
  rdoc_options: []
83
81
  require_paths:
84
82
  - lib
@@ -93,8 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
91
  - !ruby/object:Gem::Version
94
92
  version: '0'
95
93
  requirements: []
96
- rubygems_version: 3.5.22
97
- signing_key:
94
+ rubygems_version: 3.6.2
98
95
  specification_version: 4
99
96
  summary: A gem that provides Sidekiq integration for the Sentry error logger
100
97
  test_files: []