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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b5abdf29dc1f2bea57820def73dbfe9ecb2eabdcff95a863e13c463fa332794
4
- data.tar.gz: d2341ad286ddd4a66f29eafadfacf0d30bb83c844b685f1bd09a7fe302eb33e9
3
+ metadata.gz: '08158815f9482115a22e494dd4f3b65fd296adb566f1b641f3fa39b15d232bcd'
4
+ data.tar.gz: 5d57d4ee2d12c75453f852422d044728cff9d7631928f04a76886d321b425bd0
5
5
  SHA512:
6
- metadata.gz: 485073cf7a4925fc68cfce465507ec6890ed2b15edf69ca919ac0044b6013b4e872380252d83dfbdb0c1f743d71f60a8ce81c84811676c03709316759023f8af
7
- data.tar.gz: ab25a166ad4c2474e704554f1dbec5d8b8e90a325d99b751a118c6041f876ee60139d75e80c8a797b3022aa46963978d34e9caa5376d9ef42cf228c267a35ff4
6
+ metadata.gz: ea6312266b05349917950bae645a413a257e3ed970ec4b9a5b82d0a177487a6dea3529a144849e489bd37c4aff4ea21a53058d4857226b3f154816c7e551f069
7
+ data.tar.gz: 7e60c91f4613c747e8572ddbebbad53c7c42613845e3dadb7d3df3b89486ebd332fa9f90bf993d2da4a72b87f917f4ffa4ca98397cdb03f3dac0eb65e4eb8ea2
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Yabeda
4
4
  module ActiveJob
5
- VERSION = "0.2.0"
5
+ VERSION = "0.3.0"
6
6
  end
7
7
  end
@@ -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.2.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-22 00:00:00.000000000 Z
11
+ date: 2022-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails