rails-autoscale-shoryuken 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +10 -0
- data/Rakefile +10 -0
- data/judoscale-shoryuken.gemspec +30 -0
- data/lib/judoscale/shoryuken/metrics_collector.rb +36 -0
- data/lib/judoscale/shoryuken/version.rb +7 -0
- data/lib/judoscale/shoryuken.rb +15 -0
- data/lib/judoscale-shoryuken.rb +3 -0
- data/lib/rails-autoscale-shoryuken.rb +3 -0
- data/rails-autoscale-shoryuken.gemspec +30 -0
- metadata +87 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5ca3b4eab776766bec259c41054ca89788864984041c8bc38fc481d57e74a8b7
|
4
|
+
data.tar.gz: 04e00d805ece5e2f254037c2ff920e1cdf1748cbfe1ab612593f0285458aab62
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1699cc4467803730dbc6cdbf7d1206a81b93c2afb575808b1c86bf56f9e7bcb2095c6011fd567fe24f3c002e3a185774ca3ad37bbed097caf102c684c16039a4
|
7
|
+
data.tar.gz: 99db80070e80a4efbfa49cb4fa5f48e005cfa226ebcf0eef1f16b53ffde03adf278d896291d031521dc02d8a48c6075912615bc417d9fd226c6d27243458052d
|
data/Gemfile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gemspec name: "judoscale-shoryuken"
|
4
|
+
|
5
|
+
gem "judoscale-ruby", path: "../judoscale-ruby"
|
6
|
+
gem "shoryuken", "~> 6.2"
|
7
|
+
gem "aws-sdk-sqs" # shoryuken integration with AWS SDK v3+
|
8
|
+
gem "rexml" # aws-sdk-core requires an XML parser.
|
9
|
+
gem "minitest"
|
10
|
+
gem "rake"
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "judoscale/shoryuken/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "judoscale-shoryuken"
|
7
|
+
spec.version = Judoscale::Shoryuken::VERSION
|
8
|
+
spec.authors = ["Adam McCrea", "Carlos Antonio da Silva", "Jon Sullivan"]
|
9
|
+
spec.email = ["hello@judoscale.com"]
|
10
|
+
|
11
|
+
spec.summary = "Autoscaling for Shoryuken workers."
|
12
|
+
spec.homepage = "https://judoscale.com"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.metadata = {
|
16
|
+
"homepage_uri" => "https://judoscale.com",
|
17
|
+
"bug_tracker_uri" => "https://github.com/judoscale/judoscale-ruby/issues",
|
18
|
+
"documentation_uri" => "https://judoscale.com/docs",
|
19
|
+
"changelog_uri" => "https://github.com/judoscale/judoscale-ruby/blob/main/CHANGELOG.md",
|
20
|
+
"source_code_uri" => "https://github.com/judoscale/judoscale-ruby"
|
21
|
+
}
|
22
|
+
|
23
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.required_ruby_version = ">= 2.6.0"
|
27
|
+
|
28
|
+
spec.add_dependency "judoscale-ruby", Judoscale::Shoryuken::VERSION
|
29
|
+
spec.add_dependency "shoryuken", ">= 6.0"
|
30
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "judoscale/job_metrics_collector"
|
4
|
+
require "judoscale/metric"
|
5
|
+
|
6
|
+
module Judoscale
|
7
|
+
module Shoryuken
|
8
|
+
class MetricsCollector < Judoscale::JobMetricsCollector
|
9
|
+
SQS_QUEUE_DEPTH_ATTRIBUTE = "ApproximateNumberOfMessages"
|
10
|
+
|
11
|
+
def self.adapter_config
|
12
|
+
Judoscale::Config.instance.shoryuken
|
13
|
+
end
|
14
|
+
|
15
|
+
def collect
|
16
|
+
metrics = []
|
17
|
+
self.queues |= ::Shoryuken.ungrouped_queues
|
18
|
+
|
19
|
+
queues.each do |queue_name|
|
20
|
+
queue = ::Shoryuken::Client.queues(queue_name)
|
21
|
+
|
22
|
+
# Reach out to SQS client directly to fetch the queue attribute we need to report.
|
23
|
+
# Shoryuken has a private `queue_attributes` API to fetch all attributes, this call mimics that.
|
24
|
+
sqs_queue_attributes = ::Shoryuken.sqs_client
|
25
|
+
.get_queue_attributes(queue_url: queue.url, attribute_names: [SQS_QUEUE_DEPTH_ATTRIBUTE])
|
26
|
+
depth = sqs_queue_attributes.attributes[SQS_QUEUE_DEPTH_ATTRIBUTE]
|
27
|
+
|
28
|
+
metrics.push Metric.new(:qd, depth, Time.now, queue_name)
|
29
|
+
end
|
30
|
+
|
31
|
+
log_collection(metrics)
|
32
|
+
metrics
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "judoscale-ruby"
|
4
|
+
require "judoscale/config"
|
5
|
+
require "judoscale/shoryuken/version"
|
6
|
+
require "judoscale/shoryuken/metrics_collector"
|
7
|
+
require "shoryuken"
|
8
|
+
|
9
|
+
Judoscale.add_adapter :"judoscale-shoryuken",
|
10
|
+
{
|
11
|
+
adapter_version: Judoscale::Shoryuken::VERSION,
|
12
|
+
framework_version: ::Shoryuken::VERSION
|
13
|
+
},
|
14
|
+
metrics_collector: Judoscale::Shoryuken::MetricsCollector,
|
15
|
+
expose_config: Judoscale::Config::JobAdapterConfig.new(:shoryuken, support_busy_jobs: false)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "judoscale/shoryuken/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "rails-autoscale-shoryuken"
|
7
|
+
spec.version = Judoscale::Shoryuken::VERSION
|
8
|
+
spec.authors = ["Adam McCrea", "Carlos Antonio da Silva", "Jon Sullivan"]
|
9
|
+
spec.email = ["hello@judoscale.com"]
|
10
|
+
|
11
|
+
spec.summary = "Autoscaling for Shoryuken workers."
|
12
|
+
spec.homepage = "https://judoscale.com"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.metadata = {
|
16
|
+
"homepage_uri" => "https://judoscale.com",
|
17
|
+
"bug_tracker_uri" => "https://github.com/judoscale/judoscale-ruby/issues",
|
18
|
+
"documentation_uri" => "https://judoscale.com/docs",
|
19
|
+
"changelog_uri" => "https://github.com/judoscale/judoscale-ruby/blob/main/CHANGELOG.md",
|
20
|
+
"source_code_uri" => "https://github.com/judoscale/judoscale-ruby"
|
21
|
+
}
|
22
|
+
|
23
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.required_ruby_version = ">= 2.6.0"
|
27
|
+
|
28
|
+
spec.add_dependency "rails-autoscale-core", Judoscale::Shoryuken::VERSION
|
29
|
+
spec.add_dependency "shoryuken", ">= 6.0"
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails-autoscale-shoryuken
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.7.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adam McCrea
|
8
|
+
- Carlos Antonio da Silva
|
9
|
+
- Jon Sullivan
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2024-05-03 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rails-autoscale-core
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - '='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.7.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - '='
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: 1.7.0
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: shoryuken
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '6.0'
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '6.0'
|
43
|
+
description:
|
44
|
+
email:
|
45
|
+
- hello@judoscale.com
|
46
|
+
executables: []
|
47
|
+
extensions: []
|
48
|
+
extra_rdoc_files: []
|
49
|
+
files:
|
50
|
+
- Gemfile
|
51
|
+
- Rakefile
|
52
|
+
- judoscale-shoryuken.gemspec
|
53
|
+
- lib/judoscale-shoryuken.rb
|
54
|
+
- lib/judoscale/shoryuken.rb
|
55
|
+
- lib/judoscale/shoryuken/metrics_collector.rb
|
56
|
+
- lib/judoscale/shoryuken/version.rb
|
57
|
+
- lib/rails-autoscale-shoryuken.rb
|
58
|
+
- rails-autoscale-shoryuken.gemspec
|
59
|
+
homepage: https://judoscale.com
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata:
|
63
|
+
homepage_uri: https://judoscale.com
|
64
|
+
bug_tracker_uri: https://github.com/judoscale/judoscale-ruby/issues
|
65
|
+
documentation_uri: https://judoscale.com/docs
|
66
|
+
changelog_uri: https://github.com/judoscale/judoscale-ruby/blob/main/CHANGELOG.md
|
67
|
+
source_code_uri: https://github.com/judoscale/judoscale-ruby
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 2.6.0
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements: []
|
83
|
+
rubygems_version: 3.4.10
|
84
|
+
signing_key:
|
85
|
+
specification_version: 4
|
86
|
+
summary: Autoscaling for Shoryuken workers.
|
87
|
+
test_files: []
|