judoscale-ruby 1.4.1 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a766d2886f2a830ffbb2f0e78ccf6a57340ad6bdc2a4321cba543c0a96eebc1c
|
4
|
+
data.tar.gz: 2ef0b540e8bb96756f3f4073f14a17617bf5059cdfc4ce79cc30e32e1ca745c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d626022cf870df05d6e3c858f8f2099f87b8f4012d6fcc00a5da751a28536cd5b9417154ab2158cfd8107707634be78d681c732c84f42f4fab4a1fc2d78bc1d
|
7
|
+
data.tar.gz: dc9a0959de8f65fe02547b7b1334d60bc4e28905b4942a3e6e07f2495059ddc773612f48c72d6d6f59302b73a1b52b8037f4053f4b508b7af5de316ee1970815
|
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: judoscale-ruby
|
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.
|