judoscale-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: dafaf3727137764032e23a8b29915b7cb259bc03b95569393cb6c2f6d70cd09a
|
4
|
+
data.tar.gz: 3069eb9d26c0323867ff5e8e0db22a63ec80179854896696e61573232fae3c6f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 239d278c606e72725f523e54fe1a79a48932524644a847e3ccf7d4f412a3ab24c06736ec4d780f87a034640ca1533d1a833854a8e67f86b876b9223a1ef49c66
|
7
|
+
data.tar.gz: 69ab83bfaabfae905f5fde3c1b1e960875b3c842746ee2f2dcce7bdd9f222b2f362a6ad8c2db9388c5bc45966181a6920337296e64482ecc23ef666837c9e3a5
|
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: judoscale-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: judoscale-ruby
|
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: []
|