Sha256: 5bfa9e2c2c172237fc484b9aa08759b38ea0d10d78f956c31a04c63d2e247528
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
module HeimdallApm module ActionController class Subscriber def start(name, id, payload) txn = ::HeimdallApm::TransactionManager.current scope = -"#{payload[:controller]}##{payload[:action]}" segment = ::HeimdallApm::Segment.new('Controller'.freeze, scope) # Don't override scope if already set. Should never happen in practice # unless a controller calls another action. txn.scope = scope unless txn.scope # Rails gives us Request#fullpath txn.annotate({ uri: extract_path(payload[:path]) }) txn.start_segment(segment) end def finish(name, id, payload) txn = ::HeimdallApm::TransactionManager.current txn.stop_segment end private def extract_path(fullpath) i = fullpath.index('?'.freeze) i ? fullpath.slice(0, i) : fullpath end end end end ActiveSupport::Notifications.subscribe( 'process_action.action_controller', ::HeimdallApm::ActionController::Subscriber.new )
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
heimdall_apm-0.1.3 | lib/heimdall_apm/instruments/action_controller.rb |