@@ -109,34 +109,6 @@ def call(_, started, finished, _, payload) # (name, started, finished, unique_id
109109 begin
110110 sql = payload [ :sql ] . strip
111111
112- # Detect whether a function call within a specified filename is present in the call stack.
113- find_in_backtrace = lambda do |file_name , function_name = nil |
114- Thread . current . backtrace . find do |line |
115- tokens = line . split ( ':' )
116- matches_file = tokens . find { |t | t . rindex ( file_name ) == ( t . length - file_name . length ) }
117- matches_function = function_name . nil? || tokens . find { |t | t == "in `#{ function_name } '" }
118- matches_file && matches_function
119- end
120- end
121-
122- # Ignore SQL calls which are made while establishing a new connection.
123- #
124- # Example:
125- # /path/to/ruby/2.6.0/gems/sequel-5.20.0/lib/sequel/connection_pool.rb:122:in `make_new'
126- return if find_in_backtrace . call ( 'lib/sequel/connection_pool.rb' , 'make_new' )
127- # lib/active_record/connection_adapters/abstract/connection_pool.rb:811:in `new_connection'
128- return if find_in_backtrace . call ( 'lib/active_record/connection_adapters/abstract/connection_pool.rb' , 'new_connection' )
129-
130- # Ignore SQL calls which are made while inspecting the DB schema.
131- #
132- # Example:
133- # /path/to/ruby/2.6.0/gems/sequel-5.20.0/lib/sequel/model/base.rb:812:in `get_db_schema'
134- return if find_in_backtrace . call ( 'lib/sequel/model/base.rb' , 'get_db_schema' )
135- # /usr/local/bundle/gems/activerecord-5.2.3/lib/active_record/model_schema.rb:466:in `load_schema!'
136- return if find_in_backtrace . call ( 'lib/active_record/model_schema.rb' , 'load_schema!' )
137- return if find_in_backtrace . call ( 'lib/active_model/attribute_methods.rb' , 'define_attribute_methods' )
138- return if find_in_backtrace . call ( 'lib/active_record/connection_adapters/schema_cache.rb' )
139-
140112 SQLExaminer . examine payload , sql : sql
141113
142114 call = SQLCall . new ( payload )
0 commit comments