class ElasticAPM::SqlSummarizer

@api private

Constants

DEFAULT
FORMAT
REGEXES
TABLE_REGEX

Public Class Methods

cache() click to toggle source
# File lib/elastic_apm/sql_summarizer.rb, line 22
def self.cache
  @cache ||= Util::LruCache.new
end

Public Instance Methods

summarize(sql) click to toggle source
# File lib/elastic_apm/sql_summarizer.rb, line 26
def summarize(sql)
  self.class.cache[sql] ||=
    REGEXES.find do |regex, sig|
      if (match = sql[0...1000].match(regex))
        break format(FORMAT, sig, match[1] && match[1].gsub(/["']/, ''))
      end
    end || DEFAULT
end