lib/datadog/notifications/plugins/action_controller.rb in datadog-notifications-0.6.2 vs lib/datadog/notifications/plugins/action_controller.rb in datadog-notifications-0.6.3
- old
+ new
@@ -1,18 +1,17 @@
module Datadog::Notifications::Plugins
class ActionController < Base
-
attr_reader :metric_name
# Options:
#
# *<tt>:metric_name</tt> - the metric name, defaults to "rails.request"
# *<tt>:tags</tt> - additional tags
- def initialize(opts={})
+ def initialize(metric_name: 'rails.request', **opts)
super
- @metric_name = opts[:metric_name] || 'rails.request'
+ @metric_name = metric_name
Datadog::Notifications.subscribe 'process_action.action_controller' do |reporter, event|
record reporter, event
end
end
@@ -32,8 +31,7 @@
reporter.timing "#{metric_name}.time", event.duration, tags: tags
reporter.timing "#{metric_name}.time.db", payload[:db_runtime], tags: tags
reporter.timing "#{metric_name}.time.view", payload[:view_runtime], tags: tags
end
end
-
end
end