class TingYun::Agent::Collector::SlowSql

Attributes

backtrace[R]
duration[R]
metric_name[R]
start_time[R]
statement[R]

Public Class Methods

new(statement, metric_name, duration, time, backtrace=nil) click to toggle source
# File lib/ting_yun/agent/collector/sql_sampler/slow_sql.rb, line 14
def initialize(statement, metric_name, duration, time,  backtrace=nil)
  @start_time = time
  @statement = statement
  @metric_name = metric_name
  @duration = duration
  @backtrace = backtrace
end

Public Instance Methods

explain() click to toggle source
# File lib/ting_yun/agent/collector/sql_sampler/slow_sql.rb, line 35
def explain
  TingYun::Agent::Database.explain_sql(statement) if statement.config && statement.explainer
end
normalize() click to toggle source
# File lib/ting_yun/agent/collector/sql_sampler/slow_sql.rb, line 31
def normalize
  TingYun::Agent::Database::Obfuscator.instance.default_sql_obfuscator(statement)
end
obfuscate() click to toggle source
# File lib/ting_yun/agent/collector/sql_sampler/slow_sql.rb, line 26
def obfuscate
  TingYun::Agent::Database.obfuscate_sql(statement)
end
prepare_to_send() click to toggle source

We can't serialize the explainer, so clear it before we transmit

# File lib/ting_yun/agent/collector/sql_sampler/slow_sql.rb, line 40
def prepare_to_send
  statement.explainer = nil
end
sql() click to toggle source
# File lib/ting_yun/agent/collector/sql_sampler/slow_sql.rb, line 22
def sql
  statement.sql
end