Class: Sapience::Extensions::ActiveJob::Notifications

Inherits:
Notifications
  • Object
show all
Defined in:
lib/sapience/extensions/active_job/notifications.rb

Instance Attribute Summary

Attributes inherited from Notifications

#metric_name, #tags

Instance Method Summary collapse

Methods inherited from Notifications

#metrics, #record?, subscribe, use

Constructor Details

#initialize(opts = {}) ⇒ Notifications

Options:

*:metric_name - the metric name, defaults to “activejob.perform” *:tags - additional tags



11
12
13
14
15
16
17
18
# File 'lib/sapience/extensions/active_job/notifications.rb', line 11

def initialize(opts = {})
  super
  @metric_name = opts[:metric_name] || "activejob.perform"

  Sapience::Extensions::Notifications.subscribe "perform.active_job" do |event|
    record event
  end
end