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

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

Instance Attribute Summary

Attributes inherited from Notifications

#metric_name, #tags

Instance Method Summary collapse

Methods included from RequestFormatHelper

#request_format

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



13
14
15
16
17
18
19
20
# File 'lib/sapience/extensions/grape/notifications.rb', line 13

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

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