Class: NewRelic::Agent::Instrumentation::ControllerInstrumentation::TransactionNamer
- Inherits:
-
Object
- Object
- NewRelic::Agent::Instrumentation::ControllerInstrumentation::TransactionNamer
- Defined in:
- lib/new_relic/agent/instrumentation/controller_instrumentation.rb
Class Method Summary collapse
- .class_name(traced_obj, options = {}) ⇒ Object
- .name_for(txn, traced_obj, category, options = {}) ⇒ Object
- .path_name(traced_obj, options = {}) ⇒ Object
- .prefix_for_category(txn, category = nil) ⇒ Object
Class Method Details
.class_name(traced_obj, options = {}) ⇒ Object
274 275 276 277 278 279 280 281 282 |
# File 'lib/new_relic/agent/instrumentation/controller_instrumentation.rb', line 274 def self.class_name(traced_obj, = {}) return [:class_name] if [: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 = {}) ⇒ Object
230 231 232 233 234 |
# File 'lib/new_relic/agent/instrumentation/controller_instrumentation.rb', line 230 def self.name_for(txn, traced_obj, category, = {}) return [:transaction_name] if [:transaction_name] "#{prefix_for_category(txn, category)}#{path_name(traced_obj, )}" end |
.path_name(traced_obj, options = {}) ⇒ Object
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/new_relic/agent/instrumentation/controller_instrumentation.rb', line 257 def self.path_name(traced_obj, = {}) return [:path] if [:path] class_name = class_name(traced_obj, ) if [:name] if class_name "#{class_name}/#{[:name]}" else [:name] end elsif traced_obj.respond_to?(:newrelic_metric_path) traced_obj.newrelic_metric_path else class_name end end |
.prefix_for_category(txn, category = nil) ⇒ Object
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/new_relic/agent/instrumentation/controller_instrumentation.rb', line 236 def self.prefix_for_category(txn, category = nil) # the following line needs else branch coverage category ||= (txn && txn.category) # rubocop:disable Style/SafeNavigation case category when :controller then ::NewRelic::Agent::Transaction::CONTROLLER_PREFIX when :web then ::NewRelic::Agent::Transaction::CONTROLLER_PREFIX when :task then ::NewRelic::Agent::Transaction::TASK_PREFIX when :background then ::NewRelic::Agent::Transaction::TASK_PREFIX when :rack then ::NewRelic::Agent::Transaction::RACK_PREFIX when :uri then ::NewRelic::Agent::Transaction::CONTROLLER_PREFIX when :roda then ::NewRelic::Agent::Transaction::RODA_PREFIX when :sinatra then ::NewRelic::Agent::Transaction::SINATRA_PREFIX when :middleware then ::NewRelic::Agent::Transaction::MIDDLEWARE_PREFIX when :grape then ::NewRelic::Agent::Transaction::GRAPE_PREFIX when :rake then ::NewRelic::Agent::Transaction::RAKE_PREFIX when :action_cable then ::NewRelic::Agent::Transaction::ACTION_CABLE_PREFIX when :message then ::NewRelic::Agent::Transaction::MESSAGE_PREFIX else "#{category.to_s}/" # for internal use only end end |