class ElasticAPM::Instrumenter
def start_span(
rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity
rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity
def start_span( name, type = nil, subtype: nil, action: nil, backtrace: nil, context: nil, trace_context: nil ) return unless (transaction = current_transaction) return unless transaction.sampled? transaction.inc_started_spans! if transaction.max_spans_reached? transaction.inc_dropped_spans! return end parent = current_span || transaction span = Span.new( name: name, subtype: subtype, action: action, transaction: transaction, parent: parent, trace_context: trace_context, type: type, context: context, stacktrace_builder: stacktrace_builder ) if backtrace && transaction.config.span_frames_min_duration? span.original_backtrace = backtrace end current_spans.push span span.start end