judoscale-que 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: 288ad007c0af7afa58ef656c70bc54fd9878e1af5811391faaac799fb96bf4e0
4
- data.tar.gz: cdf6fe36d4a113b5f2df7154c197305257d445d84e5e88771418738c63cb5305
3
+ metadata.gz: 1928bee403da48853efb6cf9ec4ff5238eecc6d30a29555535205d5e571fe9b8
4
+ data.tar.gz: 1561549cecba98c480841404e0d8e909dc11a7b2a535196b7354bf424a608f73
5
5
  SHA512:
6
- metadata.gz: 90ef5bf2e2f7acf88075194b54348a9eb06c5a2a42f9323851d298d350e68b08338fc8f933e2072865ba7b616c492370c8e193a2b07a396f7e79b97e9cc0d669
7
- data.tar.gz: 686d49ff941967522e4a96f6cb4a8fddaf329659e5a7cb8cd76ed7e1df9bab56618a90983e670790ed11172fe84df6d0ab8b0690631829f0db052644ffe1ac38
6
+ metadata.gz: dd227662d8f047624aacd68cf2bf91649f01ff69f792c5b174150eabca2419df897fe3b8ae5dccc49dd182e4887e4df3ea22ca69f50d425a2b3616412241ff24
7
+ data.tar.gz: 02b0dbca091f210db1322d91827ea7c9910570e1f722543b175ec5b0a9bb7fc6a30b42e1764268c35686d3bc73e6eab8b4c2954d82a07e712c10dd470410b7c1
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-que (1.0.0.rc1)
9
+ judoscale-que (1.0.0.rc2)
10
10
  judoscale-ruby
11
11
  que (>= 1.0)
12
12
 
@@ -28,7 +28,7 @@ GEM
28
28
  concurrent-ruby (~> 1.0)
29
29
  minitest (5.15.0)
30
30
  pg (1.3.5)
31
- que (1.4.0)
31
+ que (2.2.0)
32
32
  rake (13.0.6)
33
33
  tzinfo (2.0.4)
34
34
  concurrent-ruby (~> 1.0)
@@ -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 Que 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 Que 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 "que", ">= 1.0"
30
+
31
+ spec.post_install_message = <<~EOS
32
+ `judoscale-que` is deprecated! Please migrate to `rails-autoscale-que`.
33
+ See https://github.com/rails-autoscale/rails-autoscale-gems for the installation guide.
34
+ EOS
30
35
  end
@@ -23,8 +23,19 @@ module Judoscale
23
23
  GROUP BY 1
24
24
  SQL
25
25
 
26
- def self.adapter_identifier
27
- :que
26
+ BUSY_METRICS_SQL = ActiveRecordHelper.cleanse_sql(<<~SQL)
27
+ SELECT queue, count(*)
28
+ FROM que_jobs
29
+ WHERE id IN (
30
+ SELECT (classid::bigint << 32) + objid::bigint AS id
31
+ FROM pg_locks
32
+ WHERE locktype = 'advisory'
33
+ )
34
+ GROUP BY 1
35
+ SQL
36
+
37
+ def self.adapter_config
38
+ Judoscale::Config.instance.que
28
39
  end
29
40
 
30
41
  def collect
@@ -34,6 +45,11 @@ module Judoscale
34
45
  run_at_by_queue = select_rows_silently(METRICS_SQL).to_h
35
46
  self.queues |= run_at_by_queue.keys
36
47
 
48
+ if track_busy_jobs?
49
+ busy_count_by_queue = select_rows_silently(BUSY_METRICS_SQL).to_h
50
+ self.queues |= busy_count_by_queue.keys
51
+ end
52
+
37
53
  queues.each do |queue|
38
54
  run_at = run_at_by_queue[queue]
39
55
  run_at = DateTime.parse(run_at) if run_at.is_a?(String)
@@ -41,6 +57,11 @@ module Judoscale
41
57
  latency_ms = 0 if latency_ms < 0
42
58
 
43
59
  metrics.push Metric.new(:qt, latency_ms, t, queue)
60
+
61
+ if track_busy_jobs?
62
+ busy_count = busy_count_by_queue[queue] || 0
63
+ metrics.push Metric.new(:busy, busy_count, Time.now, queue)
64
+ end
44
65
  end
45
66
 
46
67
  log_collection(metrics)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Judoscale
4
4
  module Que
5
- VERSION = "1.0.0.rc1"
5
+ VERSION = "1.0.0.rc2"
6
6
  end
7
7
  end
data/lib/judoscale/que.rb CHANGED
@@ -6,9 +6,10 @@ require "judoscale/que/version"
6
6
  require "judoscale/que/metrics_collector"
7
7
  require "que"
8
8
 
9
- Judoscale.add_adapter :"judoscale-que", {
10
- adapter_version: Judoscale::Que::VERSION,
11
- framework_version: ::Que::VERSION
12
- }, metrics_collector: Judoscale::Que::MetricsCollector
13
-
14
- Judoscale::Config.add_adapter_config :que, Judoscale::Config::JobAdapterConfig
9
+ Judoscale.add_adapter :"judoscale-que",
10
+ {
11
+ adapter_version: Judoscale::Que::VERSION,
12
+ framework_version: ::Que::VERSION
13
+ },
14
+ metrics_collector: Judoscale::Que::MetricsCollector,
15
+ expose_config: Judoscale::Config::JobAdapterConfig.new(:que)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: judoscale-que
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
@@ -65,7 +65,9 @@ metadata:
65
65
  documentation_uri: https://judoscale.com/docs
66
66
  changelog_uri: https://github.com/judoscale/judoscale-ruby/blob/main/CHANGELOG.md
67
67
  source_code_uri: https://github.com/judoscale/judoscale-ruby
68
- post_install_message:
68
+ post_install_message: |
69
+ `judoscale-que` is deprecated! Please migrate to `rails-autoscale-que`.
70
+ See https://github.com/rails-autoscale/rails-autoscale-gems for the installation guide.
69
71
  rdoc_options: []
70
72
  require_paths:
71
73
  - lib
@@ -83,6 +85,6 @@ requirements: []
83
85
  rubygems_version: 3.2.32
84
86
  signing_key:
85
87
  specification_version: 4
86
- summary: This gem provides Que integration with the Judoscale autoscaling add-on for
87
- Heroku.
88
+ summary: This gem is deprecated. See https://github.com/rails-autoscale/rails-autoscale-gems
89
+ to integrate Que with the Judoscale Heroku add-on.
88
90
  test_files: []