Class: Datadog::Notifications::Plugins::Grape
- Defined in:
- lib/datadog/notifications/plugins/grape.rb
Instance Attribute Summary collapse
-
#exception_handler ⇒ Object
readonly
Returns the value of attribute exception_handler.
-
#metric_name ⇒ Object
readonly
Returns the value of attribute metric_name.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Grape
constructor
Options:.
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_handler ⇒ Object (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_name ⇒ Object (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 |