# encoding: utf-8 LibraryDetection.defer do @name = :rabbitmq depends_on do defined?(::Bunny::VERSION) && !OneApm::Manager.config[:disable_rabbitmq] end executes do OneApm::Manager.logger.info 'Installing RabbitMQ instrumentation' end executes do ::Bunny::Session.class_eval do include OneApm::Agent::Instrumentation::TransactionBase def trace_args(frame) class_name = frame.respond_to?(:method_class) ? frame.method_class.name : frame.class.name.downcase { :name => 'perform', :class_name => class_name, :category => 'OtherTransaction/RabbitMQ' } end def send_frame_with_oneapm(frame, signal_activity = true) perform_action_with_oneapm_trace(trace_args(frame)) do send_frame_without_oneapm(frame, signal_activity) end end alias :send_frame_without_oneapm :send_frame alias :send_frame :send_frame_with_oneapm def send_frameset_with_oneapm(frames, channel) perform_action_with_oneapm_trace(trace_args(frames[0])) do send_frameset_without_oneapm(frames, channel) end end alias :send_frameset_without_oneapm :send_frameset alias :send_frameset :send_frameset_with_oneapm def send_frame_without_timeout_with_oneapm(frame, signal_activity = true) perform_action_with_oneapm_trace(trace_args(frame)) do send_frame_without_timeout_wihout_oneapm(frame, signal_activity) end end alias :send_frame_without_timeout_wihout_oneapm :send_frame_without_timeout alias :send_frame_without_timeout :send_frame_without_timeout_with_oneapm end end end