autoscale-queue-good_job 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0d5ee37ee4ee2ea6712c1b61cd63c99c9ce283a9357b3b700307933e03655e57
4
+ data.tar.gz: 9f2ba5c8e55c153a335da66f2013ad932214b7298167a654d46225ae5ad45b54
5
+ SHA512:
6
+ metadata.gz: cbdcbf4313eb21844af751712a7c43d4de15f509ee99129a38b88f18ff93ab714e8fbc07ffd2d0ca06d6ec0f23c9dc1e07a0490a7f5148ba54e5803aed6cb150
7
+ data.tar.gz: d15bab134f32e72e5ab7ef3844cbd6ebc7a5dd4c78f2f397abf69def1840b5f1ac569ee2f4d24e4df7cdda6083c05858fde52a42c29827a5d238116485b85e4b
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ## [0.1.0] - 2023-03-03
4
+
5
+ - Initial release
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2023 Michael R. van Rooijen, Autoscale.app
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # Ruby Queue Good Job (Autoscale.app)
2
+
3
+ Produces [Good Job] queue metrics for the [Autoscale.app] [Agent].
4
+
5
+ ## Installation
6
+
7
+ Add the gem to your `Gemfile`:
8
+
9
+ bundle add autoscale-queue-good_job --version "~> 0"
10
+
11
+ ## Usage
12
+
13
+ Instructions are provided during the autoscaler setup process on [Autoscale.app].
14
+
15
+ ## Development
16
+
17
+ Prepare environment:
18
+
19
+ bin/setup
20
+
21
+ See Rake for relevant tasks:
22
+
23
+ bin/rake -T
24
+
25
+ ## Contributing
26
+
27
+ Bug reports and pull requests are welcome on GitHub at https://github.com/autoscale-app/ruby-queue-good_job
28
+
29
+ [Autoscale.app]: https://autoscale.app
30
+ [Agent]: https://github.com/autoscale-app/ruby-agent
31
+ [Good Job]: https://github.com/bensheldon/good_job
@@ -0,0 +1,7 @@
1
+ module Autoscale
2
+ module Queue
3
+ module GoodJob
4
+ VERSION = "0.1.0".freeze
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,16 @@
1
+ require_relative "good_job/version"
2
+
3
+ module Autoscale
4
+ module Queue
5
+ module GoodJob
6
+ def latency(*queues)
7
+ qry = ::GoodJob::Job.select("COALESCE(scheduled_at, created_at) AS run_at")
8
+ qry = qry.where(queue_name: queues) unless queues.empty?
9
+ age = qry.queued.order(:run_at).first.try(:run_at)
10
+ age ? (Time.now - age).round : 0
11
+ end
12
+
13
+ module_function :latency
14
+ end
15
+ end
16
+ end
@@ -0,0 +1 @@
1
+ require_relative "autoscale/queue/good_job"
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: autoscale-queue-good_job
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Michael R. van Rooijen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-03-03 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - support@autoscale.app
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - CHANGELOG.md
21
+ - LICENSE
22
+ - README.md
23
+ - lib/autoscale-queue-good_job.rb
24
+ - lib/autoscale/queue/good_job.rb
25
+ - lib/autoscale/queue/good_job/version.rb
26
+ homepage: https://autoscale.app
27
+ licenses:
28
+ - MIT
29
+ metadata:
30
+ homepage_uri: https://autoscale.app
31
+ documentation_uri: https://rubydoc.info/gems/autoscale-queue-good_job
32
+ source_code_uri: https://github.com/autoscale-app/ruby-queue-good_job
33
+ changelog_uri: https://github.com/autoscale-app/ruby-queue-good_job/blob/master/CHANGELOG.md
34
+ bug_tracker_uri: https://github.com/autoscale-app/ruby-queue-good_job/issues
35
+ rubygems_mfa_required: 'true'
36
+ post_install_message:
37
+ rdoc_options: []
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: 2.7.0
45
+ required_rubygems_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ requirements: []
51
+ rubygems_version: 3.4.6
52
+ signing_key:
53
+ specification_version: 4
54
+ summary: Produces Good Job queue metrics for the Autoscale.app Agent
55
+ test_files: []