autoscale-queue-delayed-job 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1841faf66485964c79a667e497bef85a393e8d1c6126daabda21a3723ef1bf45
4
+ data.tar.gz: 6f1ee2948505c253c7de59b17bb0a9238a63f5a88e331204d61fe6a785f50107
5
+ SHA512:
6
+ metadata.gz: 9205241bb1523b6b348f7e80c1691920ef5f440552f48e1028ecfc2768d2ca3671d4893e6d107e9c70e75aff34a9bfdccb6164c1cb5b24d471cbe78473e5cead
7
+ data.tar.gz: a0c42590fa685ddf7153fa94f9e0cbe725c41d06eeeafe852a4bf9dbd1738b4da0dff91652f6f086c379d0a8c766aecb9e19c31e49a162626e455f6fdc8a3016
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 Delayed Job (Autoscale.app)
2
+
3
+ Produces [Delayed 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-delayed-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-delayed-job
28
+
29
+ [Autoscale.app]: https://autoscale.app
30
+ [Agent]: https://github.com/autoscale-app/ruby-agent
31
+ [Delayed Job]: https://github.com/collectiveidea/delayed_job
@@ -0,0 +1,9 @@
1
+ module Autoscale
2
+ module Queue
3
+ module Delayed
4
+ module Job
5
+ VERSION = "0.1.0".freeze
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,20 @@
1
+ require_relative "job/version"
2
+
3
+ module Autoscale
4
+ module Queue
5
+ module Delayed
6
+ module Job
7
+ def latency(*queues)
8
+ qry = ::Delayed::Job.select(:run_at)
9
+ qry = qry.where("run_at <= ?", Time.now)
10
+ qry = qry.where(failed_at: nil, locked_at: nil)
11
+ qry = qry.where(queue: queues) unless queues.empty?
12
+ age = qry.order(:run_at).first.try(:run_at)
13
+ age ? (Time.now - age).round : 0
14
+ end
15
+
16
+ module_function :latency
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1 @@
1
+ require_relative "autoscale/queue/delayed/job"
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: autoscale-queue-delayed-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-delayed-job.rb
24
+ - lib/autoscale/queue/delayed/job.rb
25
+ - lib/autoscale/queue/delayed/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-delayed-job
32
+ source_code_uri: https://github.com/autoscale-app/ruby-queue-delayed-job
33
+ changelog_uri: https://github.com/autoscale-app/ruby-queue-delayed-job/blob/master/CHANGELOG.md
34
+ bug_tracker_uri: https://github.com/autoscale-app/ruby-queue-delayed-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 Delayed Job queue metrics for the Autoscale.app Agent
55
+ test_files: []