Class: TingYun::Agent::Collector::SlowSql
- Inherits:
-
Object
- Object
- TingYun::Agent::Collector::SlowSql
- Defined in:
- lib/ting_yun/agent/collector/sql_sampler/slow_sql.rb
Instance Attribute Summary collapse
-
#backtrace ⇒ Object
readonly
Returns the value of attribute backtrace.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#metric_name ⇒ Object
readonly
Returns the value of attribute metric_name.
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
-
#statement ⇒ Object
readonly
Returns the value of attribute statement.
Instance Method Summary collapse
- #explain ⇒ Object
-
#initialize(statement, metric_name, duration, time, backtrace = nil) ⇒ SlowSql
constructor
A new instance of SlowSql.
- #normalize ⇒ Object
- #obfuscate ⇒ Object
-
#prepare_to_send ⇒ Object
We can’t serialize the explainer, so clear it before we transmit.
- #sql ⇒ Object
Constructor Details
#initialize(statement, metric_name, duration, time, backtrace = nil) ⇒ SlowSql
Returns a new instance of SlowSql.
14 15 16 17 18 19 20 |
# 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 |
Instance Attribute Details
#backtrace ⇒ Object (readonly)
Returns the value of attribute backtrace.
10 11 12 |
# File 'lib/ting_yun/agent/collector/sql_sampler/slow_sql.rb', line 10 def backtrace @backtrace end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
9 10 11 |
# File 'lib/ting_yun/agent/collector/sql_sampler/slow_sql.rb', line 9 def duration @duration end |
#metric_name ⇒ Object (readonly)
Returns the value of attribute metric_name.
8 9 10 |
# File 'lib/ting_yun/agent/collector/sql_sampler/slow_sql.rb', line 8 def metric_name @metric_name end |
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
11 12 13 |
# File 'lib/ting_yun/agent/collector/sql_sampler/slow_sql.rb', line 11 def start_time @start_time end |
#statement ⇒ Object (readonly)
Returns the value of attribute statement.
7 8 9 |
# File 'lib/ting_yun/agent/collector/sql_sampler/slow_sql.rb', line 7 def statement @statement end |
Instance Method Details
#explain ⇒ Object
35 36 37 |
# 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 ⇒ Object
31 32 33 |
# 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 ⇒ Object
26 27 28 |
# 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 ⇒ Object
We can’t serialize the explainer, so clear it before we transmit
40 41 42 |
# File 'lib/ting_yun/agent/collector/sql_sampler/slow_sql.rb', line 40 def prepare_to_send statement.explainer = nil end |
#sql ⇒ Object
22 23 24 |
# File 'lib/ting_yun/agent/collector/sql_sampler/slow_sql.rb', line 22 def sql statement.sql end |