yabeda-activejob 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/yabeda/activejob/version.rb +1 -1
- data/lib/yabeda/activejob.rb +15 -4
- 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: '08158815f9482115a22e494dd4f3b65fd296adb566f1b641f3fa39b15d232bcd'
|
4
|
+
data.tar.gz: 5d57d4ee2d12c75453f852422d044728cff9d7631928f04a76886d321b425bd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea6312266b05349917950bae645a413a257e3ed970ec4b9a5b82d0a177487a6dea3529a144849e489bd37c4aff4ea21a53058d4857226b3f154816c7e551f069
|
7
|
+
data.tar.gz: 7e60c91f4613c747e8572ddbebbad53c7c42613845e3dadb7d3df3b89486ebd332fa9f90bf993d2da4a72b87f917f4ffa4ca98397cdb03f3dac0eb65e4eb8ea2
|
data/lib/yabeda/activejob.rb
CHANGED
@@ -18,6 +18,8 @@ module Yabeda
|
|
18
18
|
|
19
19
|
counter :executed_total, tags: %i[queue activejob executions],
|
20
20
|
comment: "A counter of the total number of activejobs executed."
|
21
|
+
counter :enqueued_total, tags: %i[queue activejob executions],
|
22
|
+
comment: "A counter of the total number of activejobs enqueued."
|
21
23
|
counter :success_total, tags: %i[queue activejob executions],
|
22
24
|
comment: "A counter of the total number of activejobs successfully processed."
|
23
25
|
counter :failed_total, tags: %i[queue activejob executions failure_reason],
|
@@ -35,8 +37,6 @@ module Yabeda
|
|
35
37
|
|
36
38
|
# job complete event
|
37
39
|
ActiveSupport::Notifications.subscribe "perform.active_job" do |*args|
|
38
|
-
::Rails.logger.debug("JOB COMPLETE")
|
39
|
-
|
40
40
|
event = ActiveSupport::Notifications::Event.new(*args)
|
41
41
|
labels = {
|
42
42
|
activejob: event.payload[:job].class.to_s,
|
@@ -58,18 +58,29 @@ module Yabeda
|
|
58
58
|
# start job event
|
59
59
|
ActiveSupport::Notifications.subscribe "perform_start.active_job" do |*args|
|
60
60
|
event = ActiveSupport::Notifications::Event.new(*args)
|
61
|
-
::Rails.logger.debug("JOB START")
|
62
61
|
|
63
62
|
labels = {
|
64
63
|
activejob: event.payload[:job].class.to_s,
|
65
64
|
queue: event.payload[:job].instance_variable_get(:@queue_name),
|
66
65
|
executions: event.payload[:job].instance_variable_get(:@executions).to_s,
|
67
66
|
}
|
68
|
-
::Rails.logger.info(labels.inspect)
|
69
67
|
|
70
68
|
labels.merge!(event.payload.slice(*Yabeda.default_tags.keys - labels.keys))
|
71
69
|
activejob_latency.measure(labels, Yabeda::ActiveJob.job_latency(event))
|
72
70
|
end
|
71
|
+
|
72
|
+
ActiveSupport::Notifications.subscribe "enqueue.active_job" do |*args|
|
73
|
+
event = ActiveSupport::Notifications::Event.new(*args)
|
74
|
+
|
75
|
+
labels = {
|
76
|
+
activejob: event.payload[:job].class.to_s,
|
77
|
+
queue: event.payload[:job].instance_variable_get(:@queue_name),
|
78
|
+
executions: event.payload[:job].instance_variable_get(:@executions).to_s,
|
79
|
+
}
|
80
|
+
|
81
|
+
labels.merge!(event.payload.slice(*Yabeda.default_tags.keys - labels.keys))
|
82
|
+
activejob_enqueued_total.increment(labels)
|
83
|
+
end
|
73
84
|
end
|
74
85
|
end
|
75
86
|
# rubocop: enable Metrics/MethodLength, Metrics/BlockLength, Metrics/AbcSize
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yabeda-activejob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fullscript
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|