sidekiq_publisher 1.7.0.rc0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Appraisals +18 -0
- data/CHANGELOG.md +7 -1
- data/README.md +15 -0
- data/gemfiles/rails_6.1_sidekiq_5.2.gemfile +9 -0
- data/gemfiles/rails_6.1_sidekiq_6.0.gemfile +9 -0
- data/gemfiles/rails_6.1_sidekiq_6.1.gemfile +9 -0
- data/lib/sidekiq_publisher/datadog_apm.rb +10 -6
- data/lib/sidekiq_publisher/report_unpublished_count.rb +12 -0
- data/lib/sidekiq_publisher/version.rb +1 -1
- data/sidekiq_publisher.gemspec +1 -1
- metadata +14 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b87dcb63524894c48e9a75cb8ed5773fddaa897e599fbb0f9c18c2fc06d7c30e
|
4
|
+
data.tar.gz: f8656103322b18569ee5f5ca131e1a40348d3f7d686eb3d3f22b9481a816d89a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11199b4b29998e62288777547706a6c545b2c0a2d74bf883a5ed5264031edca7d259fb702e131e473865aaff7f447d1fbdccb6c48a5786b3cda21dba23636afc
|
7
|
+
data.tar.gz: 2789c1e753de096ce9b42a964e0daea6df2e542430d4ff8bd775eedae5db26ec5bf4ea17cfde021870d0f1c41869ce068d9f3230f3494a94fc3ec561d839a666
|
data/Appraisals
CHANGED
@@ -52,3 +52,21 @@ appraise "rails-6.0-sidekiq-6.1" do
|
|
52
52
|
gem "activesupport", "~> 6.0.0"
|
53
53
|
gem "sidekiq", "~> 6.1.0"
|
54
54
|
end
|
55
|
+
|
56
|
+
appraise "rails-6.1-sidekiq-5.2" do
|
57
|
+
gem "activejob", "~> 6.1.0"
|
58
|
+
gem "activesupport", "~> 6.1.0"
|
59
|
+
gem "sidekiq", "~> 5.2.0"
|
60
|
+
end
|
61
|
+
|
62
|
+
appraise "rails-6.1-sidekiq-6.0" do
|
63
|
+
gem "activejob", "~> 6.1.0"
|
64
|
+
gem "activesupport", "~> 6.1.0"
|
65
|
+
gem "sidekiq", "~> 6.0.1"
|
66
|
+
end
|
67
|
+
|
68
|
+
appraise "rails-6.1-sidekiq-6.1" do
|
69
|
+
gem "activejob", "~> 6.1.0"
|
70
|
+
gem "activesupport", "~> 6.1.0"
|
71
|
+
gem "sidekiq", "~> 6.1.0"
|
72
|
+
end
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
# sidekiq_publisher
|
2
2
|
|
3
|
-
## v1.
|
3
|
+
## v1.8.0
|
4
|
+
- Extend support to Rails 6.1.
|
5
|
+
|
6
|
+
## v1.7.1
|
7
|
+
- Gracefully handle database connection errors in ReportUnpublishedCount by attempting to reconnect.
|
8
|
+
|
9
|
+
## v1.7.0
|
4
10
|
- Add instrumentation using `ActiveSupport::Notifications`.
|
5
11
|
- Reimplement `metrics_reporter` and `exception_reporter` support using
|
6
12
|
`ActiveSupport::Subscriber`.
|
data/README.md
CHANGED
@@ -136,6 +136,21 @@ class MyJob < ApplicationJob
|
|
136
136
|
end
|
137
137
|
```
|
138
138
|
|
139
|
+
#### ActiveJob Exception Reporting
|
140
|
+
|
141
|
+
Many exception monitoring service (e.g. Sentry, Airbrake, Honeybadger, etc) already provide basic integration support for `Sidekiq`.
|
142
|
+
These integration should also work with `SidekiqPublisher`.
|
143
|
+
However, you may need to explicitly include
|
144
|
+
`ActiveJob::QueueAdapters::SidekiqPublisherAdapter` as a compatible adapter for this to work properly.
|
145
|
+
|
146
|
+
Alternatively, you can manually report the exception:
|
147
|
+
|
148
|
+
```ruby
|
149
|
+
retry_on SomeError, attempts: 10 do |_job, exception|
|
150
|
+
Raven.capture_exception(exception, extra: { custom: :foo }) # Reporting using the Sentry gem
|
151
|
+
end
|
152
|
+
```
|
153
|
+
|
139
154
|
### SidekiqPublisher::Worker
|
140
155
|
|
141
156
|
Sidekiq workers are usually defined by including `Sidekiq::Worker` in a class.
|
@@ -5,6 +5,8 @@ require "ddtrace"
|
|
5
5
|
|
6
6
|
module SidekiqPublisher
|
7
7
|
module DatadogAPM
|
8
|
+
OPERATION = "sidekiq_publisher"
|
9
|
+
|
8
10
|
class << self
|
9
11
|
attr_writer :service
|
10
12
|
|
@@ -24,11 +26,13 @@ module SidekiqPublisher
|
|
24
26
|
|
25
27
|
private
|
26
28
|
|
27
|
-
def start_span(operation, payload)
|
28
|
-
|
29
|
-
|
29
|
+
def start_span(operation, payload, resource = nil)
|
30
|
+
resource ||= operation
|
31
|
+
payload[:datadog_span] = Datadog.tracer.trace(operation, service: service, resource: resource)
|
32
|
+
end
|
30
33
|
|
31
|
-
|
34
|
+
def start_primary_span(resource, payload)
|
35
|
+
start_span(OPERATION, payload, resource)
|
32
36
|
end
|
33
37
|
|
34
38
|
def finish_span(payload)
|
@@ -43,7 +47,7 @@ module SidekiqPublisher
|
|
43
47
|
|
44
48
|
class ListenerSubscriber < Subscriber
|
45
49
|
def start(_name, _id, payload)
|
46
|
-
|
50
|
+
start_primary_span("listener.timeout", payload)
|
47
51
|
end
|
48
52
|
|
49
53
|
subscribe_to "timeout.listener.sidekiq_publisher"
|
@@ -52,7 +56,7 @@ module SidekiqPublisher
|
|
52
56
|
class RunnerSubscriber < Subscriber
|
53
57
|
def start(name, _id, payload)
|
54
58
|
op_name = name.split(".").first
|
55
|
-
|
59
|
+
start_primary_span("publisher.#{op_name}", payload)
|
56
60
|
end
|
57
61
|
|
58
62
|
subscribe_to "start.publisher.sidekiq_publisher"
|
@@ -1,10 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "active_record"
|
4
|
+
require "pg"
|
5
|
+
|
3
6
|
module SidekiqPublisher
|
4
7
|
module ReportUnpublishedCount
|
5
8
|
def self.call(instrumenter: Instrumenter.new)
|
6
9
|
instrumenter.instrument("unpublished.reporter",
|
7
10
|
unpublished_count: SidekiqPublisher::Job.unpublished.count)
|
11
|
+
rescue ActiveRecord::StatementInvalid, PG::UnableToSend, PG::ConnectionBad => e
|
12
|
+
ActiveRecord::Base.clear_active_connections! if db_connection_error?(e)
|
13
|
+
raise
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.db_connection_error?(error)
|
17
|
+
cause = error.is_a?(ActiveRecord::StatementInvalid) ? error.cause : error
|
18
|
+
cause.is_a?(PG::UnableToSend) || cause.is_a?(PG::ConnectionBad)
|
8
19
|
end
|
20
|
+
private_class_method :db_connection_error?
|
9
21
|
end
|
10
22
|
end
|
data/sidekiq_publisher.gemspec
CHANGED
@@ -58,6 +58,6 @@ Gem::Specification.new do |spec|
|
|
58
58
|
spec.add_development_dependency "simplecov", "< 0.18"
|
59
59
|
|
60
60
|
spec.add_runtime_dependency "activerecord-postgres_pub_sub", ">= 0.4.0"
|
61
|
-
spec.add_runtime_dependency "activesupport", ">= 5.1", "< 6.
|
61
|
+
spec.add_runtime_dependency "activesupport", ">= 5.1", "< 6.2"
|
62
62
|
spec.add_runtime_dependency "sidekiq", ">= 5.0.4", "< 7.0"
|
63
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq_publisher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ezCater, Inc
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|
@@ -243,7 +243,7 @@ dependencies:
|
|
243
243
|
version: '5.1'
|
244
244
|
- - "<"
|
245
245
|
- !ruby/object:Gem::Version
|
246
|
-
version: '6.
|
246
|
+
version: '6.2'
|
247
247
|
type: :runtime
|
248
248
|
prerelease: false
|
249
249
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -253,7 +253,7 @@ dependencies:
|
|
253
253
|
version: '5.1'
|
254
254
|
- - "<"
|
255
255
|
- !ruby/object:Gem::Version
|
256
|
-
version: '6.
|
256
|
+
version: '6.2'
|
257
257
|
- !ruby/object:Gem::Dependency
|
258
258
|
name: sidekiq
|
259
259
|
requirement: !ruby/object:Gem::Requirement
|
@@ -300,6 +300,9 @@ files:
|
|
300
300
|
- gemfiles/rails_6.0_sidekiq_5.2.gemfile
|
301
301
|
- gemfiles/rails_6.0_sidekiq_6.0.gemfile
|
302
302
|
- gemfiles/rails_6.0_sidekiq_6.1.gemfile
|
303
|
+
- gemfiles/rails_6.1_sidekiq_5.2.gemfile
|
304
|
+
- gemfiles/rails_6.1_sidekiq_6.0.gemfile
|
305
|
+
- gemfiles/rails_6.1_sidekiq_6.1.gemfile
|
303
306
|
- lib/active_job/queue_adapters/sidekiq_publisher_adapter.rb
|
304
307
|
- lib/generators/sidekiq_publisher/install_generator.rb
|
305
308
|
- lib/generators/sidekiq_publisher/templates/create_sidekiq_publisher_jobs.rb
|
@@ -325,7 +328,7 @@ licenses:
|
|
325
328
|
- MIT
|
326
329
|
metadata:
|
327
330
|
allowed_push_host: https://rubygems.org
|
328
|
-
post_install_message:
|
331
|
+
post_install_message:
|
329
332
|
rdoc_options: []
|
330
333
|
require_paths:
|
331
334
|
- lib
|
@@ -336,12 +339,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
336
339
|
version: '0'
|
337
340
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
338
341
|
requirements:
|
339
|
-
- - "
|
342
|
+
- - ">="
|
340
343
|
- !ruby/object:Gem::Version
|
341
|
-
version:
|
344
|
+
version: '0'
|
342
345
|
requirements: []
|
343
|
-
|
344
|
-
|
346
|
+
rubyforge_project:
|
347
|
+
rubygems_version: 2.7.6.2
|
348
|
+
signing_key:
|
345
349
|
specification_version: 4
|
346
350
|
summary: Publisher for enqueuing jobs to Sidekiq
|
347
351
|
test_files: []
|