judoscale-ruby 1.0.0.rc1 → 1.0.0.rc2
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.lock +1 -1
- data/judoscale-ruby.gemspec +6 -1
- data/lib/judoscale/adapter_api.rb +1 -1
- data/lib/judoscale/config.rb +22 -16
- data/lib/judoscale/job_metrics_collector.rb +2 -2
- data/lib/judoscale/report.rb +1 -3
- data/lib/judoscale/version.rb +1 -1
- data/lib/judoscale-ruby.rb +2 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ec3b89458d553902b60287bec9c3d5a86db77bc17d525264733e35da6bc4447
|
4
|
+
data.tar.gz: ce7fa95c5d69b38f84afe75bb24ab51f07687299eadd112945d2eed75d7c2607
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01bc6d8713dec20c578fdcbf3dd91cbcf3cf6c1894e7431773d26b4f1fc63fd8b45d5170e8ad47a43b905d0a56f53e0c1f8ab7192056ac10f1bcd11b9d809b44
|
7
|
+
data.tar.gz: 227e0a5a91a4f7389d72a0b34fb8b19627616c3f8e772bf05c921f2ed761233e1ff0ff4d4cc937993c35fa92fff660252bd743202a690a4460050df34277c142
|
data/Gemfile.lock
CHANGED
data/judoscale-ruby.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["Adam McCrea", "Carlos Antonio da Silva"]
|
9
9
|
spec.email = ["adam@adamlogic.com"]
|
10
10
|
|
11
|
-
spec.summary = "This gem
|
11
|
+
spec.summary = "This gem is deprecated. See https://github.com/rails-autoscale/rails-autoscale-gems to integrate your Ruby app with the Judoscale Heroku add-on."
|
12
12
|
spec.homepage = "https://judoscale.com"
|
13
13
|
spec.license = "MIT"
|
14
14
|
|
@@ -24,4 +24,9 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.require_paths = ["lib"]
|
25
25
|
|
26
26
|
spec.required_ruby_version = ">= 2.6.0"
|
27
|
+
|
28
|
+
spec.post_install_message = <<~EOS
|
29
|
+
`judoscale-ruby` is deprecated! Please migrate to `rails-autoscale-core`.
|
30
|
+
See https://github.com/rails-autoscale/rails-autoscale-gems for the installation guide.
|
31
|
+
EOS
|
27
32
|
end
|
data/lib/judoscale/config.rb
CHANGED
@@ -22,9 +22,14 @@ module Judoscale
|
|
22
22
|
UUID_REGEXP = /[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/
|
23
23
|
DEFAULT_QUEUE_FILTER = ->(queue_name) { !UUID_REGEXP.match?(queue_name) }
|
24
24
|
|
25
|
-
attr_accessor :enabled, :max_queues, :queues, :queue_filter, :track_busy_jobs
|
25
|
+
attr_accessor :identifier, :enabled, :max_queues, :queues, :queue_filter, :track_busy_jobs
|
26
26
|
|
27
|
-
def initialize
|
27
|
+
def initialize(identifier)
|
28
|
+
@identifier = identifier
|
29
|
+
reset
|
30
|
+
end
|
31
|
+
|
32
|
+
def reset
|
28
33
|
@enabled = true
|
29
34
|
@max_queues = 20
|
30
35
|
@queues = []
|
@@ -34,24 +39,29 @@ module Judoscale
|
|
34
39
|
|
35
40
|
def as_json
|
36
41
|
{
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
42
|
+
identifier => {
|
43
|
+
max_queues: max_queues,
|
44
|
+
queues: queues,
|
45
|
+
queue_filter: queue_filter != DEFAULT_QUEUE_FILTER,
|
46
|
+
track_busy_jobs: track_busy_jobs
|
47
|
+
}
|
41
48
|
}
|
42
49
|
end
|
43
50
|
end
|
44
51
|
|
45
52
|
include Singleton
|
46
53
|
|
47
|
-
@adapter_configs =
|
54
|
+
@adapter_configs = []
|
48
55
|
class << self
|
49
56
|
attr_reader :adapter_configs
|
50
57
|
end
|
51
58
|
|
52
|
-
def self.
|
53
|
-
|
54
|
-
|
59
|
+
def self.expose_adapter_config(config_instance)
|
60
|
+
adapter_configs << config_instance
|
61
|
+
|
62
|
+
define_method(config_instance.identifier) do
|
63
|
+
config_instance
|
64
|
+
end
|
55
65
|
end
|
56
66
|
|
57
67
|
attr_accessor :api_base_url, :report_interval_seconds, :max_request_size_bytes, :logger
|
@@ -70,9 +80,7 @@ module Judoscale
|
|
70
80
|
self.log_level = ENV["JUDOSCALE_LOG_LEVEL"]
|
71
81
|
@logger = ::Logger.new($stdout)
|
72
82
|
|
73
|
-
self.class.adapter_configs.each
|
74
|
-
instance_variable_set(:"@#{identifier}", config_class.new)
|
75
|
-
end
|
83
|
+
self.class.adapter_configs.each(&:reset)
|
76
84
|
end
|
77
85
|
|
78
86
|
def dyno=(dyno_string)
|
@@ -84,9 +92,7 @@ module Judoscale
|
|
84
92
|
end
|
85
93
|
|
86
94
|
def as_json
|
87
|
-
adapter_configs_json = self.class.adapter_configs.
|
88
|
-
hash[identifier] = public_send(identifier).as_json
|
89
|
-
end
|
95
|
+
adapter_configs_json = self.class.adapter_configs.reduce({}) { |hash, config| hash.merge!(config.as_json) }
|
90
96
|
|
91
97
|
{
|
92
98
|
log_level: log_level,
|
@@ -18,11 +18,11 @@ module Judoscale
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.adapter_identifier
|
21
|
-
|
21
|
+
adapter_config.identifier
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.adapter_config
|
25
|
-
|
25
|
+
raise "Implement `self.adapter_config` in individual job metrics collectors."
|
26
26
|
end
|
27
27
|
|
28
28
|
def initialize
|
data/lib/judoscale/report.rb
CHANGED
@@ -15,9 +15,7 @@ module Judoscale
|
|
15
15
|
dyno: config.dyno,
|
16
16
|
pid: Process.pid,
|
17
17
|
config: config.as_json,
|
18
|
-
adapters: adapters.
|
19
|
-
hash.merge!(adapter.as_json)
|
20
|
-
},
|
18
|
+
adapters: adapters.reduce({}) { |hash, adapter| hash.merge!(adapter.as_json) },
|
21
19
|
metrics: metrics.map { |metric|
|
22
20
|
[
|
23
21
|
metric.time.to_i,
|
data/lib/judoscale/version.rb
CHANGED
data/lib/judoscale-ruby.rb
CHANGED
@@ -26,7 +26,8 @@ module Judoscale
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
def self.add_adapter(identifier, adapter_info, metrics_collector: nil)
|
29
|
+
def self.add_adapter(identifier, adapter_info, metrics_collector: nil, expose_config: nil)
|
30
|
+
Config.expose_adapter_config(expose_config) if expose_config
|
30
31
|
@adapters << Adapter.new(identifier, adapter_info, metrics_collector)
|
31
32
|
end
|
32
33
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: judoscale-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam McCrea
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-09-07 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email:
|
@@ -46,7 +46,9 @@ metadata:
|
|
46
46
|
documentation_uri: https://judoscale.com/docs
|
47
47
|
changelog_uri: https://github.com/judoscale/judoscale-ruby/blob/main/CHANGELOG.md
|
48
48
|
source_code_uri: https://github.com/judoscale/judoscale-ruby
|
49
|
-
post_install_message:
|
49
|
+
post_install_message: |
|
50
|
+
`judoscale-ruby` is deprecated! Please migrate to `rails-autoscale-core`.
|
51
|
+
See https://github.com/rails-autoscale/rails-autoscale-gems for the installation guide.
|
50
52
|
rdoc_options: []
|
51
53
|
require_paths:
|
52
54
|
- lib
|
@@ -64,6 +66,6 @@ requirements: []
|
|
64
66
|
rubygems_version: 3.2.32
|
65
67
|
signing_key:
|
66
68
|
specification_version: 4
|
67
|
-
summary: This gem
|
68
|
-
|
69
|
+
summary: This gem is deprecated. See https://github.com/rails-autoscale/rails-autoscale-gems
|
70
|
+
to integrate your Ruby app with the Judoscale Heroku add-on.
|
69
71
|
test_files: []
|