class ElasticAPM::Instrumenter

def start_transaction(

rubocop:disable Metrics/MethodLength
def start_transaction(
  name = nil,
  type = nil,
  context: nil,
  trace_context: nil
)
  return nil unless config.instrument?
  if (transaction = current_transaction)
    raise ExistingTransactionError,
      "Transactions may not be nested.\nAlready inside #{transaction}"
  end
  sampled = trace_context ? trace_context.recorded? : random_sample?
  transaction =
    Transaction.new(
      name,
      type,
      context: context,
      trace_context: trace_context,
      sampled: sampled
    )
  transaction.start
  self.current_transaction = transaction
end