yabeda-resque 0.1.0 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e404a650c76a0519369258b9b2ae43eb89203b52377173525bb5cbfa52e46bd
4
- data.tar.gz: 9a264a74ba519b7efc61e673e1c227c823a731e6a9f60e783cd474dfbfc35964
3
+ metadata.gz: fc64c43baf725df7a5f4691a877bf32907d1b2416bdd6835dbe1c43f002d7a01
4
+ data.tar.gz: e72afe1ba6efb66cca854f9f093a230e434450afcfa87c230eeee9aba29a046f
5
5
  SHA512:
6
- metadata.gz: 82ad97a81763f374f4d355f12e38df0f9be299a4de54af0b53ce493d1da76136b5299f5d6862eaf0acbe00e4a0003ea34b0833c0c196d7eb9d0baa182d09183e
7
- data.tar.gz: eb4fa8db9d34365b79891b8e1fdad51595a177a2235b79d0a55bf2500a5e915c8bbb3626caa236df3d044bb942ddfa9c4e42bb70f83d135c508b9b4427786da6
6
+ metadata.gz: 3acc9b46978e547bf10fbee16bdc0cd5053d9d8bbe710e0c7353ab79a0cfd577eed7547e0e05a6aee9e78040ac85c46fed4fbb4cfca8160e490de1c1d4fece9f
7
+ data.tar.gz: 85e7422c3cd1ecc4835de4ae1c5ff3438fac117ab22ad873242ee962e8ff42296aacf41ee186c4344e549c1842c4741f15c7e20b1ccb6197f66e261ca0da4423
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.1.0] - 2025-02-4
4
+ - Fix: queue_sizes metric not being exported
5
+
6
+ ## [1.0.0] - 2025-02-4
7
+ - Add queue_size metric
8
+ - Add jobs_delayed metric for resque-scheduler
9
+
3
10
  ## [0.1.0] - 2025-02-13
4
11
 
5
12
  - Add jobs_pending metric
data/README.md CHANGED
@@ -12,11 +12,11 @@ Install the gem and add to the application's Gemfile by executing:
12
12
 
13
13
  If bundler is not being used to manage dependencies, install the gem by executing:
14
14
 
15
- $ gem install yabea-resque
15
+ $ gem install yabeda-resque
16
16
 
17
17
  ## Usage
18
18
 
19
- Add the following code to your application:
19
+ Add the following code to your existing Yabeda setup:
20
20
 
21
21
  ```ruby
22
22
  Yabeda::Resque.install!
@@ -24,13 +24,23 @@ Yabeda::Resque.install!
24
24
 
25
25
  ## Provided metrics
26
26
 
27
- | Metric name | Type | Description |
28
- |-------------|------|--------------------------|
29
- | `jobs_pending` | gauge | Number of jobs in all queues |
30
- | `jobs_processed` | gauge | Number of jobs processed |
31
- | `jobs_failed` | gauge | Number of jobs currently failed |
32
- | `workers_total` | gauge | Number of workers |
33
- | `workers_working` | gauge | Number of workers currently working |
27
+ | Metric name | Type | Tags | Description |
28
+ |-------------------|-------|--------------|-------------------------------------|
29
+ | `jobs_pending` | gauge | none | Number of jobs in all queues |
30
+ | `jobs_processed` | gauge | none | Number of jobs processed |
31
+ | `jobs_failed` | gauge | none | Number of jobs currently failed |
32
+ | `workers_total` | gauge | none | Number of workers |
33
+ | `workers_working` | gauge | none | Number of workers currently working |
34
+ | `queue_sizes` | gauge | queue (name) | Number of jobs in a specific queue |
35
+
36
+ Yabeda::Resque detects if [resque-scheduler](https://github.com/resque/resque-scheduler) is being used and adds the following metrics:
37
+
38
+ | Metric name | Type | Tags | Description |
39
+ |----------------|-------|--------------|------------------------|
40
+ | `jobs_delayed` | gauge | none | Number of delayed jobs |
41
+
42
+ Please note that due to the design of the resque-scheduler the delayed jobs are not
43
+ included in the `queue_sizes` metric. Gathering this information can be quite expensive when there are a lot of delayed jobs.
34
44
 
35
45
  ## Development
36
46
 
@@ -40,7 +50,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
40
50
 
41
51
  ## Contributing
42
52
 
43
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/yabeda-resque. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/yabeda-resque/blob/main/CODE_OF_CONDUCT.md).
53
+ Bug reports and pull requests are welcome on GitHub at https://github.com/jbockler/yabeda-resque. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/jbockler/yabeda-resque/blob/main/CODE_OF_CONDUCT.md).
44
54
 
45
55
  ## License
46
56
 
@@ -48,4 +58,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
48
58
 
49
59
  ## Code of Conduct
50
60
 
51
- Everyone interacting in the Yabeda::Resque project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/yabeda-resque/blob/main/CODE_OF_CONDUCT.md).
61
+ Everyone interacting in the Yabeda::Resque project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/jbockler/yabeda-resque/blob/main/CODE_OF_CONDUCT.md).
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Yabeda
4
4
  module Resque
5
- VERSION = "0.1.0"
5
+ VERSION = "1.1.0"
6
6
  end
7
7
  end
data/lib/yabeda/resque.rb CHANGED
@@ -8,15 +8,27 @@ require "resque"
8
8
  module Yabeda
9
9
  module Resque
10
10
  class << self
11
+ def monitor_delayed?
12
+ defined?(::Resque::Scheduler)
13
+ end
14
+
11
15
  def install!
12
16
  Yabeda.configure do
13
17
  group :resque do
14
- gauge :jobs_pending, aggregation: :most_recent, comment: "Number of pending jobs"
15
- gauge :jobs_processed, aggregation: :most_recent, comment: "Number of processed jobs"
16
- gauge :jobs_failed, aggregation: :most_recent, comment: "Number of failed jobs"
18
+ default_options = {aggregation: :most_recent}
19
+ gauge :jobs_pending, **default_options, comment: "Number of pending jobs"
20
+ gauge :jobs_processed, **default_options, comment: "Number of processed jobs"
21
+ gauge :jobs_failed, **default_options, comment: "Number of failed jobs"
22
+
23
+ gauge :queue_sizes, tags: %i[queue], **default_options, comment: "Number of jobs in a specific queue"
17
24
 
18
- gauge :workers_total, aggregation: :most_recent, comment: "Number of workers"
19
- gauge :workers_working, aggregation: :most_recent, comment: "Number of workers busy"
25
+ gauge :workers_total, **default_options, comment: "Number of workers"
26
+ gauge :workers_working, **default_options, comment: "Number of workers busy"
27
+
28
+ # Plugin for delayed jobs
29
+ if ::Yabeda::Resque.monitor_delayed?
30
+ gauge :jobs_delayed, **default_options, comment: "Number of delayed jobs"
31
+ end
20
32
  end
21
33
 
22
34
  collect do
@@ -25,6 +37,14 @@ module Yabeda
25
37
  resque.jobs_pending.set({}, resque_info[:pending])
26
38
  resque.jobs_processed.set({}, resque_info[:processed])
27
39
 
40
+ if ::Yabeda::Resque.monitor_delayed?
41
+ resque.jobs_delayed.set({}, ::Resque.count_all_scheduled_jobs)
42
+ end
43
+
44
+ ::Resque.queue_sizes.each do |queue, size|
45
+ resque.queue_sizes.set({queue: queue}, size)
46
+ end
47
+
28
48
  resque.workers_total.set({}, resque_info[:workers])
29
49
  resque.workers_working.set({}, resque_info[:working])
30
50
  end
@@ -4,5 +4,7 @@ module Yabeda
4
4
  VERSION: String
5
5
 
6
6
  def self.install!: () -> void
7
+
8
+ def self.monitor_delayed?: () -> bool
7
9
  end
8
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yabeda-resque
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josch Bockler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-13 00:00:00.000000000 Z
11
+ date: 2025-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: resque