patient_http-sidekiq 1.1.0 → 1.1.1
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/CHANGELOG.md +12 -0
- data/README.md +2 -3
- data/VERSION +1 -1
- data/lib/patient_http/sidekiq/web.rb +6 -0
- data/lib/patient_http/sidekiq/web_ui.rb +36 -12
- data/patient_http-sidekiq.gemspec +0 -2
- metadata +3 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f16c7b27f88a7f84cb0b34cb6ae28a931b9be60dcfa22c8107efeff1cf9bb82c
|
|
4
|
+
data.tar.gz: f6c20d30b05984bd72d21f4faea53f4eb2f5e08637894f09c286abc1df437640
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9d79dc80c1493605c18763b89533aeed861c3ab6e49d6ae29558d7650297752bccff9efaec56bf425366f2db79c48125351db0d1dd5b7310d353bf5af50ef9bd
|
|
7
|
+
data.tar.gz: 84c003b789d2809bfccd9e6ef11ddf80d56712ed963bb3e5bc5769cf7b6b7bdbfc4720e260b034cb0b99d340991f30a526bdd774cba1adccf811cdf2fd8c07f3
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## 1.1.1
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- The Sidekiq Web UI extension now registers correctly on Sidekiq 7.3. It previously raised `NoMethodError: undefined method 'register_extension' for class Sidekiq::Web` because that method only exists in Sidekiq 8.
|
|
12
|
+
- The Web UI dashboard page now renders on Sidekiq versions before 8.1. Those versions resolve view files as `*.erb` instead of `*.html.erb`, so the template is now rendered from a string.
|
|
13
|
+
- Requiring the Web UI on Sidekiq versions before 7.3 now raises a `LoadError` with a clear message instead of an obscure error.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- `require "patient_http/sidekiq/web"` can now be used to load the Web UI extension, matching the `require "sidekiq/web"` convention. The previous `patient_http/sidekiq/web_ui` path still works.
|
|
18
|
+
|
|
7
19
|
## 1.1.0
|
|
8
20
|
|
|
9
21
|
### Changed
|
data/README.md
CHANGED
|
@@ -485,12 +485,11 @@ See the [Configuration](lib/patient_http/sidekiq/configuration.rb) class for all
|
|
|
485
485
|
|
|
486
486
|
### Web UI
|
|
487
487
|
|
|
488
|
-
If you're using Sidekiq's Web UI, you can add a tab with the async HTTP processor statistics. The
|
|
488
|
+
If you're using Sidekiq's Web UI, you can add a tab with the async HTTP processor statistics. The Web UI tab requires Sidekiq 7.3 or later.
|
|
489
489
|
|
|
490
490
|
```ruby
|
|
491
491
|
# config/routes.rb (Rails)
|
|
492
|
-
require "sidekiq/web"
|
|
493
|
-
require "patient_http-sidekiq"
|
|
492
|
+
require "patient_http/sidekiq/web"
|
|
494
493
|
|
|
495
494
|
mount Sidekiq::Web => "/sidekiq"
|
|
496
495
|
```
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.1.
|
|
1
|
+
1.1.1
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "sidekiq/version"
|
|
4
|
+
|
|
5
|
+
# Sidekiq 7.3 introduced the web extension API used here (register with
|
|
6
|
+
# keyword arguments); older versions cannot mount the tab or assets. Check
|
|
7
|
+
# before loading sidekiq/web, which can itself fail to load on old versions.
|
|
8
|
+
if Gem::Version.new(::Sidekiq::VERSION) < Gem::Version.new("7.3")
|
|
9
|
+
raise LoadError.new("patient_http/sidekiq/web requires sidekiq >= 7.3 (you have #{::Sidekiq::VERSION})")
|
|
10
|
+
end
|
|
11
|
+
|
|
3
12
|
require "sidekiq/web"
|
|
4
13
|
|
|
5
14
|
module PatientHttp
|
|
@@ -12,6 +21,13 @@ module PatientHttp
|
|
|
12
21
|
VIEWS = File.join(ROOT, "views")
|
|
13
22
|
|
|
14
23
|
class << self
|
|
24
|
+
# Sidekiq resolves symbol view names to different file names depending
|
|
25
|
+
# on the version (*.erb before 8.1, *.html.erb from 8.1 on), so the
|
|
26
|
+
# template is rendered from a string instead.
|
|
27
|
+
def template
|
|
28
|
+
@template ||= File.read(File.join(VIEWS, "patient_http.html.erb"))
|
|
29
|
+
end
|
|
30
|
+
|
|
15
31
|
# This method is called by Sidekiq::Web when registering the extension
|
|
16
32
|
def registered(app)
|
|
17
33
|
# GET route for the main PatientHttp dashboard page
|
|
@@ -31,7 +47,7 @@ module PatientHttp
|
|
|
31
47
|
current_inflight = processes.values.sum { |data| data[:inflight] }
|
|
32
48
|
utilization = (max_capacity > 0) ? (current_inflight.to_f / max_capacity * 100).round(1) : 0
|
|
33
49
|
|
|
34
|
-
erb(
|
|
50
|
+
erb(PatientHttp::Sidekiq::WebUI.template, locals: {
|
|
35
51
|
totals: totals,
|
|
36
52
|
total_requests: total_requests,
|
|
37
53
|
avg_duration: avg_duration,
|
|
@@ -52,18 +68,26 @@ module PatientHttp
|
|
|
52
68
|
end
|
|
53
69
|
end
|
|
54
70
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
71
|
+
register_options = {
|
|
72
|
+
name: "patient-http",
|
|
73
|
+
tab: "patient_http_tab",
|
|
74
|
+
index: "patient-http",
|
|
75
|
+
root_dir: PatientHttp::Sidekiq::WebUI::ROOT,
|
|
76
|
+
asset_paths: ["css", "js"]
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if ::Sidekiq::Web.respond_to?(:configure)
|
|
58
80
|
::Sidekiq::Web.configure do |config|
|
|
59
|
-
config.register_extension
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
)
|
|
81
|
+
if config.respond_to?(:register_extension)
|
|
82
|
+
# Sidekiq 8.x yields a Sidekiq::Web::Config object
|
|
83
|
+
config.register_extension(PatientHttp::Sidekiq::WebUI, **register_options)
|
|
84
|
+
else
|
|
85
|
+
# Sidekiq 7.3.5+ yields the Sidekiq::Web class, which only has register
|
|
86
|
+
config.register(PatientHttp::Sidekiq::WebUI, **register_options)
|
|
87
|
+
end
|
|
67
88
|
end
|
|
89
|
+
else
|
|
90
|
+
# Sidekiq 7.3.0 - 7.3.4 has no Sidekiq::Web.configure
|
|
91
|
+
::Sidekiq::Web.register(PatientHttp::Sidekiq::WebUI, **register_options)
|
|
68
92
|
end
|
|
69
93
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: patient_http-sidekiq
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brian Durand
|
|
@@ -37,20 +37,6 @@ dependencies:
|
|
|
37
37
|
- - ">="
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
39
|
version: 1.3.0
|
|
40
|
-
- !ruby/object:Gem::Dependency
|
|
41
|
-
name: bundler
|
|
42
|
-
requirement: !ruby/object:Gem::Requirement
|
|
43
|
-
requirements:
|
|
44
|
-
- - ">="
|
|
45
|
-
- !ruby/object:Gem::Version
|
|
46
|
-
version: '0'
|
|
47
|
-
type: :development
|
|
48
|
-
prerelease: false
|
|
49
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
-
requirements:
|
|
51
|
-
- - ">="
|
|
52
|
-
- !ruby/object:Gem::Version
|
|
53
|
-
version: '0'
|
|
54
40
|
description: This gem provides a mechanism to offload long-running HTTP requests from
|
|
55
41
|
Sidekiq workers to a dedicated async I/O processor running in the same process,
|
|
56
42
|
freeing the worker thread immediately while the HTTP request is in flight.
|
|
@@ -78,6 +64,7 @@ files:
|
|
|
78
64
|
- lib/patient_http/sidekiq/task_handler.rb
|
|
79
65
|
- lib/patient_http/sidekiq/task_monitor.rb
|
|
80
66
|
- lib/patient_http/sidekiq/task_monitor_thread.rb
|
|
67
|
+
- lib/patient_http/sidekiq/web.rb
|
|
81
68
|
- lib/patient_http/sidekiq/web_ui.rb
|
|
82
69
|
- lib/patient_http/sidekiq/web_ui/assets/patient-http/css/patient_http.css
|
|
83
70
|
- lib/patient_http/sidekiq/web_ui/locales/ar.yml
|
|
@@ -133,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
133
120
|
- !ruby/object:Gem::Version
|
|
134
121
|
version: '0'
|
|
135
122
|
requirements: []
|
|
136
|
-
rubygems_version:
|
|
123
|
+
rubygems_version: 3.6.9
|
|
137
124
|
specification_version: 4
|
|
138
125
|
summary: Offload long-running HTTP requests from Sidekiq workers to a dedicated async
|
|
139
126
|
I/O processor
|