sentry-sidekiq 5.23.0 → 5.24.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 +4 -4
- data/Gemfile +19 -7
- data/lib/sentry/sidekiq/configuration.rb +8 -0
- data/lib/sentry/sidekiq/cron/job.rb +7 -1
- data/lib/sentry/sidekiq/error_handler.rb +3 -0
- data/lib/sentry/sidekiq/sentry_context_middleware.rb +20 -2
- data/lib/sentry/sidekiq/version.rb +1 -1
- data/sentry-sidekiq.gemspec +1 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8059c79e6f44f60a67c9014d92ec376d1f4a5d5f848c0f8f2317bcba96b312a3
|
4
|
+
data.tar.gz: 6a8a566a5f5c73de22dd903528ff1100f73d0ff0beb3cd5805e5c14d9b0c7bb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 010cce88c774bc2dc1d75738ebb006a8dc044475c775f0778bc759c881dcde4ef8b1d388e4789e777095271fde6e3d610b6e06b25a92362f1aa78533ac97e6cd
|
7
|
+
data.tar.gz: 9d321e52221456ff95f6ebb68a7a36b7689c02c0109749271d5af083b82041bbe55d3aa732688d98acd83302a044df2464b0f39f7823a7ba6842b2dbaf74b984
|
data/Gemfile
CHANGED
@@ -15,17 +15,29 @@ gem "sentry-rails", path: "../sentry-rails"
|
|
15
15
|
# loofah changed the required ruby version in a patch so we need to explicitly pin it
|
16
16
|
gem "loofah", "2.20.0" if RUBY_VERSION.to_f < 2.5
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
sidekiq_version =
|
21
|
-
|
22
|
-
|
18
|
+
if ENV["SIDEKIQ_MAIN"]
|
19
|
+
gem "sidekiq", github: "sidekiq/sidekiq", branch: "main"
|
20
|
+
sidekiq_version = "main"
|
21
|
+
else
|
22
|
+
sidekiq_version = ENV["SIDEKIQ_VERSION"]
|
23
|
+
sidekiq_version = "7.0" if sidekiq_version.nil?
|
24
|
+
sidekiq_version = Gem::Version.new(sidekiq_version)
|
25
|
+
|
26
|
+
gem "sidekiq", "~> #{sidekiq_version}"
|
27
|
+
end
|
23
28
|
|
24
|
-
if RUBY_VERSION.to_f >= 2.7 && sidekiq_version >= Gem::Version.new("6.0")
|
29
|
+
if sidekiq_version == "main" || RUBY_VERSION.to_f >= 2.7 && sidekiq_version >= Gem::Version.new("6.0")
|
25
30
|
gem "sidekiq-cron"
|
26
|
-
|
31
|
+
|
32
|
+
if sidekiq_version == "main" || sidekiq_version >= Gem::Version.new("8.0")
|
33
|
+
gem "sidekiq-scheduler", "~> 6.0.0.beta"
|
34
|
+
else
|
35
|
+
gem "sidekiq-scheduler", "~> 5.0.0"
|
36
|
+
end
|
27
37
|
end
|
28
38
|
|
29
39
|
gem "rails", "> 5.0.0"
|
30
40
|
|
31
41
|
gem "timecop"
|
42
|
+
|
43
|
+
gem "vernier", platforms: :ruby if RUBY_VERSION >= "3.2.1"
|
@@ -21,8 +21,16 @@ module Sentry
|
|
21
21
|
# retry if it fails.
|
22
22
|
attr_accessor :report_after_job_retries
|
23
23
|
|
24
|
+
# Only report jobs that don't have `dead: false` set in the job's `sidekiq_options`
|
25
|
+
attr_accessor :report_only_dead_jobs
|
26
|
+
|
27
|
+
# Whether we should inject headers while enqueuing the job in order to have a connected trace
|
28
|
+
attr_accessor :propagate_traces
|
29
|
+
|
24
30
|
def initialize
|
25
31
|
@report_after_job_retries = false
|
32
|
+
@report_only_dead_jobs = false
|
33
|
+
@propagate_traces = true
|
26
34
|
end
|
27
35
|
end
|
28
36
|
end
|
@@ -45,11 +45,17 @@ module Sentry
|
|
45
45
|
# fail gracefully if can't find class
|
46
46
|
klass_const =
|
47
47
|
begin
|
48
|
-
::Sidekiq::Cron::Support.
|
48
|
+
if ::Sidekiq::Cron::Support.respond_to?(:safe_constantize)
|
49
|
+
::Sidekiq::Cron::Support.safe_constantize(klass.to_s)
|
50
|
+
else
|
51
|
+
::Sidekiq::Cron::Support.constantize(klass.to_s)
|
52
|
+
end
|
49
53
|
rescue NameError
|
50
54
|
return true
|
51
55
|
end
|
52
56
|
|
57
|
+
return true if klass_const.nil? # Sidekiq::Cron returns nil if class is not found
|
58
|
+
|
53
59
|
# only patch if not explicitly included in job by user
|
54
60
|
unless klass_const.send(:ancestors).include?(Sentry::Cron::MonitorCheckIns)
|
55
61
|
klass_const.send(:include, Sentry::Cron::MonitorCheckIns)
|
@@ -31,6 +31,9 @@ module Sentry
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
# See if we want to ignore jobs that have dead: false
|
35
|
+
return if Sentry.configuration.sidekiq.report_only_dead_jobs && context.dig(:job, "dead") == false
|
36
|
+
|
34
37
|
# Check if the retry count is below the attempt_threshold
|
35
38
|
attempt_threshold = context.dig(:job, "attempt_threshold")
|
36
39
|
if attempt_threshold && retryable?(context)
|
@@ -13,6 +13,20 @@ module Sentry
|
|
13
13
|
span.set_data(Span::DataConventions::MESSAGING_MESSAGE_RECEIVE_LATENCY, latency) if latency
|
14
14
|
span.set_data(Span::DataConventions::MESSAGING_MESSAGE_RETRY_COUNT, retry_count) if retry_count
|
15
15
|
end
|
16
|
+
|
17
|
+
if ::Gem::Version.new(::Sidekiq::VERSION) >= ::Gem::Version.new("8.0.0")
|
18
|
+
def calculate_latency(job)
|
19
|
+
now_in_ms - job["enqueued_at"] if job["enqueued_at"]
|
20
|
+
end
|
21
|
+
else
|
22
|
+
def calculate_latency(job)
|
23
|
+
((Time.now.to_f - job["enqueued_at"]) * 1000).round if job["enqueued_at"]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def now_in_ms
|
28
|
+
::Process.clock_gettime(::Process::CLOCK_REALTIME, :millisecond)
|
29
|
+
end
|
16
30
|
end
|
17
31
|
|
18
32
|
class SentryContextServerMiddleware
|
@@ -40,7 +54,8 @@ module Sentry
|
|
40
54
|
if transaction
|
41
55
|
scope.set_span(transaction)
|
42
56
|
|
43
|
-
latency = (
|
57
|
+
latency = calculate_latency(job)
|
58
|
+
|
44
59
|
set_span_data(
|
45
60
|
transaction,
|
46
61
|
id: job["jid"],
|
@@ -95,7 +110,10 @@ module Sentry
|
|
95
110
|
|
96
111
|
user = Sentry.get_current_scope.user
|
97
112
|
job["sentry_user"] = user unless user.empty?
|
98
|
-
|
113
|
+
|
114
|
+
if Sentry.configuration.sidekiq.propagate_traces
|
115
|
+
job["trace_propagation_headers"] ||= Sentry.get_trace_propagation_headers
|
116
|
+
end
|
99
117
|
|
100
118
|
Sentry.with_child_span(op: "queue.publish", description: worker_class.to_s) do |span|
|
101
119
|
set_span_data(span, id: job["jid"], queue: queue)
|
data/sentry-sidekiq.gemspec
CHANGED
@@ -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.
|
33
|
+
spec.add_dependency "sentry-ruby", "~> 5.24.0"
|
34
34
|
spec.add_dependency "sidekiq", ">= 3.0"
|
35
35
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sentry-sidekiq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.24.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sentry Team
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: sentry-ruby
|
@@ -15,14 +15,14 @@ dependencies:
|
|
15
15
|
requirements:
|
16
16
|
- - "~>"
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 5.
|
18
|
+
version: 5.24.0
|
19
19
|
type: :runtime
|
20
20
|
prerelease: false
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
22
22
|
requirements:
|
23
23
|
- - "~>"
|
24
24
|
- !ruby/object:Gem::Version
|
25
|
-
version: 5.
|
25
|
+
version: 5.24.0
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: sidekiq
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,8 +42,8 @@ email: accounts@sentry.io
|
|
42
42
|
executables: []
|
43
43
|
extensions: []
|
44
44
|
extra_rdoc_files:
|
45
|
-
- README.md
|
46
45
|
- LICENSE.txt
|
46
|
+
- README.md
|
47
47
|
files:
|
48
48
|
- ".gitignore"
|
49
49
|
- ".rspec"
|
@@ -69,15 +69,15 @@ files:
|
|
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.
|
72
|
+
homepage: https://github.com/getsentry/sentry-ruby/tree/5.24.0/sentry-sidekiq
|
73
73
|
licenses:
|
74
74
|
- MIT
|
75
75
|
metadata:
|
76
|
-
homepage_uri: https://github.com/getsentry/sentry-ruby/tree/5.
|
77
|
-
source_code_uri: https://github.com/getsentry/sentry-ruby/tree/5.
|
78
|
-
changelog_uri: https://github.com/getsentry/sentry-ruby/blob/5.
|
76
|
+
homepage_uri: https://github.com/getsentry/sentry-ruby/tree/5.24.0/sentry-sidekiq
|
77
|
+
source_code_uri: https://github.com/getsentry/sentry-ruby/tree/5.24.0/sentry-sidekiq
|
78
|
+
changelog_uri: https://github.com/getsentry/sentry-ruby/blob/5.24.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.
|
80
|
+
documentation_uri: http://www.rubydoc.info/gems/sentry-sidekiq/5.24.0
|
81
81
|
rdoc_options: []
|
82
82
|
require_paths:
|
83
83
|
- lib
|
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '0'
|
94
94
|
requirements: []
|
95
|
-
rubygems_version: 3.6.
|
95
|
+
rubygems_version: 3.6.7
|
96
96
|
specification_version: 4
|
97
97
|
summary: A gem that provides Sidekiq integration for the Sentry error logger
|
98
98
|
test_files: []
|