rails-autoscale-resque 1.7.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rails-autoscale-resque.rb +1 -1
- metadata +7 -30
- data/Gemfile +0 -14
- data/Rakefile +0 -11
- data/judoscale-resque.gemspec +0 -30
- data/lib/judoscale/resque/latency_extension.rb +0 -23
- data/lib/judoscale/resque/metrics_collector.rb +0 -48
- data/lib/judoscale/resque/version.rb +0 -7
- data/lib/judoscale/resque.rb +0 -16
- data/lib/judoscale-resque.rb +0 -3
- data/rails-autoscale-resque.gemspec +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87d3d1572a095dab053e9529b443c8fd7a4022100032187915520cf760ed6b0a
|
4
|
+
data.tar.gz: a5b39392f9741522b7a0958a0275325795a0fd7b19c0f5b402d4189ec60c51d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ad265c26cfe2e0f3436cb762ae51876493585105546a4c902ab9dd9690a2c1b029777b6c2eac90186bbf6f1f5bbe460bce2f50586367417f840364a6529b5ab
|
7
|
+
data.tar.gz: 29618f9e8a726e8744fd922e2b416a816aa543834e73a92a5257a836cd42aba9b33f14029712e476aa375bd26ad38d915fac39ac21fef52124d242e06dc0a75c
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-autoscale-resque
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam McCrea
|
@@ -10,36 +10,22 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-
|
13
|
+
date: 2024-07-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
16
|
+
name: judoscale-resque
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
21
|
+
version: 1.8.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 1.
|
29
|
-
- !ruby/object:Gem::Dependency
|
30
|
-
name: resque
|
31
|
-
requirement: !ruby/object:Gem::Requirement
|
32
|
-
requirements:
|
33
|
-
- - ">="
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version: '2.0'
|
36
|
-
type: :runtime
|
37
|
-
prerelease: false
|
38
|
-
version_requirements: !ruby/object:Gem::Requirement
|
39
|
-
requirements:
|
40
|
-
- - ">="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: '2.0'
|
28
|
+
version: 1.8.0
|
43
29
|
description:
|
44
30
|
email:
|
45
31
|
- hello@judoscale.com
|
@@ -47,16 +33,7 @@ executables: []
|
|
47
33
|
extensions: []
|
48
34
|
extra_rdoc_files: []
|
49
35
|
files:
|
50
|
-
- Gemfile
|
51
|
-
- Rakefile
|
52
|
-
- judoscale-resque.gemspec
|
53
|
-
- lib/judoscale-resque.rb
|
54
|
-
- lib/judoscale/resque.rb
|
55
|
-
- lib/judoscale/resque/latency_extension.rb
|
56
|
-
- lib/judoscale/resque/metrics_collector.rb
|
57
|
-
- lib/judoscale/resque/version.rb
|
58
36
|
- lib/rails-autoscale-resque.rb
|
59
|
-
- rails-autoscale-resque.gemspec
|
60
37
|
homepage: https://judoscale.com
|
61
38
|
licenses:
|
62
39
|
- MIT
|
@@ -74,14 +51,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
74
51
|
requirements:
|
75
52
|
- - ">="
|
76
53
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
54
|
+
version: '0'
|
78
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
56
|
requirements:
|
80
57
|
- - ">="
|
81
58
|
- !ruby/object:Gem::Version
|
82
59
|
version: '0'
|
83
60
|
requirements: []
|
84
|
-
rubygems_version: 3.
|
61
|
+
rubygems_version: 3.5.11
|
85
62
|
signing_key:
|
86
63
|
specification_version: 4
|
87
64
|
summary: Autoscaling for Resque workers.
|
data/Gemfile
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
gemspec name: "judoscale-resque"
|
4
|
-
|
5
|
-
gem "judoscale-ruby", path: "../judoscale-ruby"
|
6
|
-
gem "minitest"
|
7
|
-
gem "rake"
|
8
|
-
gem "debug"
|
9
|
-
|
10
|
-
# Lock to known working versions to keep tests passing.
|
11
|
-
# Without this, `bundle install` will update `Gemfile.lock` due to
|
12
|
-
# https://github.com/rubygems/bundler/issues/6069
|
13
|
-
gem "resque", "~> 2.2.0"
|
14
|
-
gem "redis", "~> 4.0"
|
data/Rakefile
DELETED
data/judoscale-resque.gemspec
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
lib = File.expand_path("../lib", __FILE__)
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require "judoscale/resque/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "judoscale-resque"
|
7
|
-
spec.version = Judoscale::Resque::VERSION
|
8
|
-
spec.authors = ["Adam McCrea", "Carlos Antonio da Silva", "Jon Sullivan"]
|
9
|
-
spec.email = ["hello@judoscale.com"]
|
10
|
-
|
11
|
-
spec.summary = "Autoscaling for Resque 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::Resque::VERSION
|
29
|
-
spec.add_dependency "resque", ">= 2.0"
|
30
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module Judoscale
|
2
|
-
module Resque
|
3
|
-
module LatencyExtension
|
4
|
-
# Store the time when jobs are pushed to the queue in order to calculate latency.
|
5
|
-
def push(queue, item)
|
6
|
-
item["timestamp"] = Time.now.utc.to_f
|
7
|
-
super
|
8
|
-
end
|
9
|
-
|
10
|
-
# Calculate latency for the given queue using the stored timestamp of the oldest item in the queue.
|
11
|
-
def latency(queue)
|
12
|
-
if (item = peek(queue))
|
13
|
-
timestamp = item["timestamp"]
|
14
|
-
timestamp ? Time.now.utc.to_f - timestamp.to_f : 0.0
|
15
|
-
else
|
16
|
-
0.0
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
::Resque.extend(Judoscale::Resque::LatencyExtension)
|
@@ -1,48 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "judoscale/job_metrics_collector"
|
4
|
-
require "judoscale/metric"
|
5
|
-
|
6
|
-
module Judoscale
|
7
|
-
module Resque
|
8
|
-
class MetricsCollector < Judoscale::JobMetricsCollector
|
9
|
-
def self.adapter_config
|
10
|
-
Judoscale::Config.instance.resque
|
11
|
-
end
|
12
|
-
|
13
|
-
def collect
|
14
|
-
metrics = []
|
15
|
-
current_queues = ::Resque.queues
|
16
|
-
|
17
|
-
if track_busy_jobs?
|
18
|
-
busy_counts = Hash.new { |h, k| h[k] = 0 }
|
19
|
-
|
20
|
-
::Resque.working.each do |worker|
|
21
|
-
if !worker.idle? && (job = worker.job)
|
22
|
-
busy_counts[job["queue"]] += 1
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
self.queues |= current_queues
|
28
|
-
|
29
|
-
queues.each do |queue|
|
30
|
-
next if queue.nil? || queue.empty?
|
31
|
-
depth = ::Resque.size(queue)
|
32
|
-
latency = (::Resque.latency(queue) * 1000).ceil
|
33
|
-
|
34
|
-
metrics.push Metric.new(:qd, depth, Time.now, queue)
|
35
|
-
metrics.push Metric.new(:qt, latency, Time.now, queue)
|
36
|
-
|
37
|
-
if track_busy_jobs?
|
38
|
-
busy_count = busy_counts[queue]
|
39
|
-
metrics.push Metric.new(:busy, busy_count, Time.now, queue)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
log_collection(metrics)
|
44
|
-
metrics
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
data/lib/judoscale/resque.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "judoscale-ruby"
|
4
|
-
require "judoscale/config"
|
5
|
-
require "judoscale/resque/version"
|
6
|
-
require "judoscale/resque/metrics_collector"
|
7
|
-
require "resque"
|
8
|
-
require "judoscale/resque/latency_extension"
|
9
|
-
|
10
|
-
Judoscale.add_adapter :"judoscale-resque",
|
11
|
-
{
|
12
|
-
adapter_version: Judoscale::Resque::VERSION,
|
13
|
-
framework_version: ::Resque::VERSION
|
14
|
-
},
|
15
|
-
metrics_collector: Judoscale::Resque::MetricsCollector,
|
16
|
-
expose_config: Judoscale::Config::JobAdapterConfig.new(:resque)
|
data/lib/judoscale-resque.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
lib = File.expand_path("../lib", __FILE__)
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require "judoscale/resque/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "rails-autoscale-resque"
|
7
|
-
spec.version = Judoscale::Resque::VERSION
|
8
|
-
spec.authors = ["Adam McCrea", "Carlos Antonio da Silva", "Jon Sullivan"]
|
9
|
-
spec.email = ["hello@judoscale.com"]
|
10
|
-
|
11
|
-
spec.summary = "Autoscaling for Resque 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::Resque::VERSION
|
29
|
-
spec.add_dependency "resque", ">= 2.0"
|
30
|
-
end
|