Class: Datadog::Notifications::Plugins::Grape

Inherits:
Base
  • Object
show all
Defined in:
lib/datadog/notifications/plugins/grape.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#tags

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Grape

Options:

*:metric_name - the metric name, defaults to “grape.request” *:exception_handler - a custom exception handler proc which accepts an exception object and returns a status *:tags - additional tags



11
12
13
14
15
16
17
18
19
# File 'lib/datadog/notifications/plugins/grape.rb', line 11

def initialize(opts = {})
  super
  @metric_name = opts[:metric_name] || "grape.request"
  @exception_handler = opts[:exception_handler] || ->_ { 500 }

  Datadog::Notifications.subscribe 'endpoint_run.grape' do |reporter, event|
    record reporter, event
  end
end

Instance Attribute Details

#exception_handlerObject (readonly)

Returns the value of attribute exception_handler.



4
5
6
# File 'lib/datadog/notifications/plugins/grape.rb', line 4

def exception_handler
  @exception_handler
end

#metric_nameObject (readonly)

Returns the value of attribute metric_name.



4
5
6
# File 'lib/datadog/notifications/plugins/grape.rb', line 4

def metric_name
  @metric_name
end