class Mmtrix::Agent::Instrumentation::ControllerInstrumentation::TransactionNamer
@!parse extend ClassMethods
Public Class Methods
class_name(traced_obj, options={})
click to toggle source
# File lib/mmtrix/agent/instrumentation/controller_instrumentation.rb, line 259 def self.class_name(traced_obj, options={}) return options[:class_name] if options[:class_name] if (traced_obj.is_a?(Class) || traced_obj.is_a?(Module)) traced_obj.name else traced_obj.class.name end end
name_for(txn, traced_obj, category, options={})
click to toggle source
# File lib/mmtrix/agent/instrumentation/controller_instrumentation.rb, line 224 def self.name_for(txn, traced_obj, category, options={}) "#{prefix_for_category(txn, category)}#{path_name(traced_obj, options)}" end
path_name(traced_obj, options={})
click to toggle source
# File lib/mmtrix/agent/instrumentation/controller_instrumentation.rb, line 242 def self.path_name(traced_obj, options={}) return options[:path] if options[:path] class_name = class_name(traced_obj, options) if options[:name] if class_name "#{class_name}/#{options[:name]}" else options[:name] end elsif traced_obj.respond_to?(:mmtrix_metric_path) traced_obj.mmtrix_metric_path else class_name end end
prefix_for_category(txn, category = nil)
click to toggle source
# File lib/mmtrix/agent/instrumentation/controller_instrumentation.rb, line 228 def self.prefix_for_category(txn, category = nil) category ||= (txn && txn.category) case category when :controller then ::Mmtrix::Agent::Transaction::CONTROLLER_PREFIX when :task then ::Mmtrix::Agent::Transaction::TASK_PREFIX when :rack then ::Mmtrix::Agent::Transaction::RACK_PREFIX when :uri then ::Mmtrix::Agent::Transaction::CONTROLLER_PREFIX when :sinatra then ::Mmtrix::Agent::Transaction::SINATRA_PREFIX when :middleware then ::Mmtrix::Agent::Transaction::MIDDLEWARE_PREFIX when :grape then ::Mmtrix::Agent::Transaction::GRAPE_PREFIX else "#{category.to_s}/" # for internal use only end end