Method: NewRelic::Agent::Transaction#create_segment

Defined in:
lib/new_relic/agent/transaction.rb

#create_segment(name, options = {}) ⇒ Object

[View source]

452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
# File 'lib/new_relic/agent/transaction.rb', line 452

def create_segment(name, options = {})
  summary_metrics = nil

  if name.start_with?(MIDDLEWARE_PREFIX)
    summary_metrics = MIDDLEWARE_SUMMARY_METRICS
  end

  @nesting_max_depth += 1

  segment = Tracer.start_segment(
    name: name,
    unscoped_metrics: summary_metrics
  )

  # #code_information will glean the code info out of the options hash
  # if it exists or noop otherwise
  segment.code_information = options

  segment
end