Skip to content

Instantly share code, notes, and snippets.

@tramfjord
tramfjord / controller_metrics.rb
Created February 27, 2021 00:08
ActiveSupport::Notifications transaction left open
ActiveSupport::Notifications.subscribe "process_action.action_controller" do |*args|
event = ActiveSupport::Notifications::Event.new(*args)
controller = Statsd.sanitized_class(event.payload[:controller].constantize)
action = event.payload[:action]
tags = {
route: "#{controller}:#{action}"
}