rails-autoscale-core 1.4.1 → 1.5.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a22cddac1042235674c4791e42efaefc877d395b1f30d1be5cd41eea9f305e8
|
4
|
+
data.tar.gz: 40881260d060de8799c14ce08142eb6e3d524bc5f91f36157d3a5e4879e32e47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cc88cc9824d09c1b4066d02ebf0dd8c8af4605e3d2fa2949523248494064f3f70fdf25e151674b85b6a71b3badeb7a8ddeb93c4cf00cb2d74db136f53817d49
|
7
|
+
data.tar.gz: ab01d857a7a2b9c244cced61071ac265e2a07929cba1042108f01b40af9fba182f5817bd877ef727ff6c6123528a28a1170ce559495f4d9fb3bd4630efcabde0
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
judoscale-ruby (1.
|
4
|
+
judoscale-ruby (1.5.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -31,6 +31,7 @@ GEM
|
|
31
31
|
PLATFORMS
|
32
32
|
arm64-darwin-20
|
33
33
|
arm64-darwin-21
|
34
|
+
arm64-darwin-22
|
34
35
|
x86_64-darwin-21
|
35
36
|
x86_64-linux
|
36
37
|
|
data/lib/judoscale/config.rb
CHANGED
@@ -5,35 +5,14 @@ require "logger"
|
|
5
5
|
|
6
6
|
module Judoscale
|
7
7
|
class Config
|
8
|
-
class RuntimeContainer
|
9
|
-
# E.g.:
|
10
|
-
# (Heroku) => "worker_fast", "3"
|
11
|
-
# (Render) => "srv-cfa1es5a49987h4vcvfg", "5497f74465-m5wwr", "web" (or "worker", "pserv", "cron", "static")
|
12
|
-
def initialize(service_name = nil, instance = nil, service_type = nil)
|
13
|
-
@service_name = service_name
|
14
|
-
@instance = instance
|
15
|
-
@service_type = service_type
|
16
|
-
end
|
17
|
-
|
18
|
-
def to_s
|
19
|
-
# heroku: 'worker_fast.5'
|
20
|
-
# render: 'srv-cfa1es5a49987h4vcvfg.5497f74465-m5wwr'
|
21
|
-
"#{@service_name}.#{@instance}"
|
22
|
-
end
|
23
|
-
|
24
|
-
def web?
|
25
|
-
# NOTE: Heroku isolates 'web' as the required _name_ for its web process
|
26
|
-
# type, Render exposes the actual service type more explicitly
|
27
|
-
@service_name == "web" || @service_type == "web"
|
28
|
-
end
|
29
|
-
|
8
|
+
class RuntimeContainer < String
|
30
9
|
# Since Heroku exposes ordinal dyno 'numbers', we can tell if the current
|
31
10
|
# instance is redundant (and thus skip collecting some metrics sometimes)
|
32
11
|
# We don't have a means of determining that on Render though — so every
|
33
12
|
# instance must be considered non-redundant
|
34
13
|
def redundant_instance?
|
35
|
-
|
36
|
-
|
14
|
+
instance_number = split(".")[1].to_i
|
15
|
+
instance_number > 1
|
37
16
|
end
|
38
17
|
end
|
39
18
|
|
@@ -106,14 +85,15 @@ module Judoscale
|
|
106
85
|
|
107
86
|
if ENV["RENDER_INSTANCE_ID"]
|
108
87
|
instance = ENV["RENDER_INSTANCE_ID"].delete_prefix(ENV["RENDER_SERVICE_ID"]).delete_prefix("-")
|
109
|
-
@current_runtime_container = RuntimeContainer.new
|
88
|
+
@current_runtime_container = RuntimeContainer.new instance
|
110
89
|
@api_base_url ||= "https://adapter.judoscale.com/api/#{ENV["RENDER_SERVICE_ID"]}"
|
111
90
|
elsif ENV["DYNO"]
|
112
|
-
|
113
|
-
|
91
|
+
@current_runtime_container = RuntimeContainer.new ENV["DYNO"]
|
92
|
+
elsif (metadata_uri = ENV["ECS_CONTAINER_METADATA_URI"])
|
93
|
+
@current_runtime_container = RuntimeContainer.new(metadata_uri.split("/").last)
|
114
94
|
else
|
115
95
|
# unsupported platform? Don't want to leave @current_runtime_container nil though
|
116
|
-
@current_runtime_container = RuntimeContainer.new
|
96
|
+
@current_runtime_container = RuntimeContainer.new("")
|
117
97
|
end
|
118
98
|
end
|
119
99
|
|
data/lib/judoscale/version.rb
CHANGED
@@ -5,12 +5,6 @@ require "judoscale/metrics_store"
|
|
5
5
|
|
6
6
|
module Judoscale
|
7
7
|
class WebMetricsCollector < MetricsCollector
|
8
|
-
# NOTE: We collect metrics on all running web processes since they
|
9
|
-
# all receive and handle requests independently
|
10
|
-
def self.collect?(config)
|
11
|
-
config.current_runtime_container.web?
|
12
|
-
end
|
13
|
-
|
14
8
|
def collect
|
15
9
|
MetricsStore.instance.flush
|
16
10
|
end
|
metadata
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-autoscale-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam McCrea
|
8
8
|
- Carlos Antonio da Silva
|
9
9
|
- Jon Sullivan
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2023-
|
13
|
+
date: 2023-07-21 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
|
-
description:
|
15
|
+
description:
|
16
16
|
email:
|
17
17
|
- hello@judoscale.com
|
18
18
|
executables: []
|
@@ -49,7 +49,7 @@ metadata:
|
|
49
49
|
documentation_uri: https://judoscale.com/docs
|
50
50
|
changelog_uri: https://github.com/judoscale/judoscale-ruby/blob/main/CHANGELOG.md
|
51
51
|
source_code_uri: https://github.com/judoscale/judoscale-ruby
|
52
|
-
post_install_message:
|
52
|
+
post_install_message:
|
53
53
|
rdoc_options: []
|
54
54
|
require_paths:
|
55
55
|
- lib
|
@@ -64,8 +64,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
- !ruby/object:Gem::Version
|
65
65
|
version: '0'
|
66
66
|
requirements: []
|
67
|
-
rubygems_version: 3.
|
68
|
-
signing_key:
|
67
|
+
rubygems_version: 3.4.10
|
68
|
+
signing_key:
|
69
69
|
specification_version: 4
|
70
70
|
summary: This gem works with the Judoscale Heroku add-on to automatically scale your
|
71
71
|
web and worker dynos.
|