judoscale-resque 1.0.0.rc1 → 1.0.0.rc2

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: 7deeebf5eec99c390e3c8ca7f5bde2c1738e00df21c94859c7f01f92a3a8d8bc
4
- data.tar.gz: e71578e2cc7d72ef2044c1e97005fb7f0657afa2922a3c3f4023f400789b9d5f
3
+ metadata.gz: 7caf083d01edd33b3a09c0d8e34dd3365936f609929c45d87273be58dc8d9132
4
+ data.tar.gz: 5e58f3b635f98efcd2d0c2ba48d12bdb539abfb6261dde72780f306cf215ecf0
5
5
  SHA512:
6
- metadata.gz: 28c1483091686e5ac07ea2fc6889463e6a05830831f3d8bd6457a01b31c8bfa4aa02c68008b18133427da04edab5b8c69e15511fc51bcd2a74f36b0186a9e23e
7
- data.tar.gz: f1278a7258bdb73f760ec4b0611712457d7fecd66a73b452d93c0dd84aedfb3ffc16d737bda138a7112eca59628ab9dafd3ec2d6821dce72ea35fef961e63b3f
6
+ metadata.gz: cba7a62dc8a424f07d614ce916cf12867e53516c50ef677b56c2ec258caeba5f15ddfff3ed18b359c891bc3d5431501653aecf5fc9ba0e1b56b8c671d24bca7c
7
+ data.tar.gz: 0b45c55b28902393973c42758dfbe9b52f5e2b45acda2ed46592e7548f264ed9612da73ce10803daefaa1fde7f86816e25125588ca0135dc4226ae692b4e9eeb
data/Gemfile.lock CHANGED
@@ -1,12 +1,12 @@
1
1
  PATH
2
2
  remote: ../judoscale-ruby
3
3
  specs:
4
- judoscale-ruby (1.0.0.rc1)
4
+ judoscale-ruby (1.0.0.rc2)
5
5
 
6
6
  PATH
7
7
  remote: .
8
8
  specs:
9
- judoscale-resque (1.0.0.rc1)
9
+ judoscale-resque (1.0.0.rc2)
10
10
  judoscale-ruby
11
11
  resque (>= 2.0)
12
12
 
@@ -16,27 +16,27 @@ GEM
16
16
  minitest (5.15.0)
17
17
  mono_logger (1.1.1)
18
18
  multi_json (1.15.0)
19
- mustermann (1.1.1)
19
+ mustermann (2.0.2)
20
20
  ruby2_keywords (~> 0.0.1)
21
- rack (2.2.3)
22
- rack-protection (2.2.0)
21
+ rack (2.2.4)
22
+ rack-protection (2.2.2)
23
23
  rack
24
24
  rake (13.0.6)
25
- redis (4.6.0)
26
- redis-namespace (1.8.2)
27
- redis (>= 3.0.4)
25
+ redis (4.7.1)
26
+ redis-namespace (1.9.0)
27
+ redis (>= 4)
28
28
  resque (2.2.1)
29
29
  mono_logger (~> 1.0)
30
30
  multi_json (~> 1.0)
31
31
  redis-namespace (~> 1.6)
32
32
  sinatra (>= 0.9.2)
33
33
  ruby2_keywords (0.0.5)
34
- sinatra (2.2.0)
35
- mustermann (~> 1.0)
34
+ sinatra (2.2.2)
35
+ mustermann (~> 2.0)
36
36
  rack (~> 2.2)
37
- rack-protection (= 2.2.0)
37
+ rack-protection (= 2.2.2)
38
38
  tilt (~> 2.0)
39
- tilt (2.0.10)
39
+ tilt (2.0.11)
40
40
 
41
41
  PLATFORMS
42
42
  arm64-darwin-20
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ["Adam McCrea", "Carlos Antonio da Silva"]
9
9
  spec.email = ["adam@adamlogic.com"]
10
10
 
11
- spec.summary = "This gem provides Resque integration with the Judoscale autoscaling add-on for Heroku."
11
+ spec.summary = "This gem is deprecated. See https://github.com/rails-autoscale/rails-autoscale-gems to integrate Resque with the Judoscale Heroku add-on."
12
12
  spec.homepage = "https://judoscale.com"
13
13
  spec.license = "MIT"
14
14
 
@@ -27,4 +27,9 @@ Gem::Specification.new do |spec|
27
27
 
28
28
  spec.add_dependency "judoscale-ruby"
29
29
  spec.add_dependency "resque", ">= 2.0"
30
+
31
+ spec.post_install_message = <<~EOS
32
+ `judoscale-resque` is deprecated! Please migrate to `rails-autoscale-resque`.
33
+ See https://github.com/rails-autoscale/rails-autoscale-gems for the installation guide.
34
+ EOS
30
35
  end
@@ -0,0 +1,23 @@
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)
@@ -6,8 +6,8 @@ require "judoscale/metric"
6
6
  module Judoscale
7
7
  module Resque
8
8
  class MetricsCollector < Judoscale::JobMetricsCollector
9
- def self.adapter_identifier
10
- :resque
9
+ def self.adapter_config
10
+ Judoscale::Config.instance.resque
11
11
  end
12
12
 
13
13
  def collect
@@ -29,7 +29,10 @@ module Judoscale
29
29
  queues.each do |queue|
30
30
  next if queue.nil? || queue.empty?
31
31
  depth = ::Resque.size(queue)
32
+ latency = (::Resque.latency(queue) * 1000).ceil
33
+
32
34
  metrics.push Metric.new(:qd, depth, Time.now, queue)
35
+ metrics.push Metric.new(:qt, latency, Time.now, queue)
33
36
 
34
37
  if track_busy_jobs?
35
38
  busy_count = busy_counts[queue]
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Judoscale
4
4
  module Resque
5
- VERSION = "1.0.0.rc1"
5
+ VERSION = "1.0.0.rc2"
6
6
  end
7
7
  end
@@ -5,10 +5,12 @@ require "judoscale/config"
5
5
  require "judoscale/resque/version"
6
6
  require "judoscale/resque/metrics_collector"
7
7
  require "resque"
8
+ require "judoscale/resque/latency_extension"
8
9
 
9
- Judoscale.add_adapter :"judoscale-resque", {
10
- adapter_version: Judoscale::Resque::VERSION,
11
- framework_version: ::Resque::VERSION
12
- }, metrics_collector: Judoscale::Resque::MetricsCollector
13
-
14
- Judoscale::Config.add_adapter_config :resque, Judoscale::Config::JobAdapterConfig
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: judoscale-resque
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc1
4
+ version: 1.0.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam McCrea
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-04-12 00:00:00.000000000 Z
12
+ date: 2022-09-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: judoscale-ruby
@@ -52,6 +52,7 @@ files:
52
52
  - judoscale-resque.gemspec
53
53
  - lib/judoscale-resque.rb
54
54
  - lib/judoscale/resque.rb
55
+ - lib/judoscale/resque/latency_extension.rb
55
56
  - lib/judoscale/resque/metrics_collector.rb
56
57
  - lib/judoscale/resque/version.rb
57
58
  homepage: https://judoscale.com
@@ -63,7 +64,9 @@ metadata:
63
64
  documentation_uri: https://judoscale.com/docs
64
65
  changelog_uri: https://github.com/judoscale/judoscale-ruby/blob/main/CHANGELOG.md
65
66
  source_code_uri: https://github.com/judoscale/judoscale-ruby
66
- post_install_message:
67
+ post_install_message: |
68
+ `judoscale-resque` is deprecated! Please migrate to `rails-autoscale-resque`.
69
+ See https://github.com/rails-autoscale/rails-autoscale-gems for the installation guide.
67
70
  rdoc_options: []
68
71
  require_paths:
69
72
  - lib
@@ -81,6 +84,6 @@ requirements: []
81
84
  rubygems_version: 3.2.32
82
85
  signing_key:
83
86
  specification_version: 4
84
- summary: This gem provides Resque integration with the Judoscale autoscaling add-on
85
- for Heroku.
87
+ summary: This gem is deprecated. See https://github.com/rails-autoscale/rails-autoscale-gems
88
+ to integrate Resque with the Judoscale Heroku add-on.
86
89
  test_files: []