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 +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +21 -11
- data/lib/yabeda/resque/version.rb +1 -1
- data/lib/yabeda/resque.rb +25 -5
- data/sig/yabeda/resque.rbs +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc64c43baf725df7a5f4691a877bf32907d1b2416bdd6835dbe1c43f002d7a01
|
4
|
+
data.tar.gz: e72afe1ba6efb66cca854f9f093a230e434450afcfa87c230eeee9aba29a046f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3acc9b46978e547bf10fbee16bdc0cd5053d9d8bbe710e0c7353ab79a0cfd577eed7547e0e05a6aee9e78040ac85c46fed4fbb4cfca8160e490de1c1d4fece9f
|
7
|
+
data.tar.gz: 85e7422c3cd1ecc4835de4ae1c5ff3438fac117ab22ad873242ee962e8ff42296aacf41ee186c4344e549c1842c4741f15c7e20b1ccb6197f66e261ca0da4423
|
data/CHANGELOG.md
CHANGED
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
|
15
|
+
$ gem install yabeda-resque
|
16
16
|
|
17
17
|
## Usage
|
18
18
|
|
19
|
-
Add the following code to your
|
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
|
28
|
-
|
29
|
-
| `jobs_pending`
|
30
|
-
| `jobs_processed`
|
31
|
-
| `jobs_failed`
|
32
|
-
| `workers_total`
|
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/
|
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/
|
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).
|
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
|
-
|
15
|
-
gauge :
|
16
|
-
gauge :
|
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,
|
19
|
-
gauge :workers_working,
|
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
|
data/sig/yabeda/resque.rbs
CHANGED
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:
|
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-
|
11
|
+
date: 2025-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: resque
|