Class: Sapience::Extensions::Grape::Notifications

Inherits:
Notifications
  • Object
show all
Defined in:
lib/sapience/extensions/grape/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 “grape.request” *:tags - additional tags



9
10
11
12
13
14
15
16
# File 'lib/sapience/extensions/grape/notifications.rb', line 9

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

  Sapience::Extensions::Notifications.subscribe "endpoint_run.grape" do |event|
    record event
  end
end