Class: TingYun::Agent::Collector::SlowSql
- Inherits:
-
Object
- Object
- TingYun::Agent::Collector::SlowSql
- Defined in:
- lib/ting_yun/agent/collector/sql_sampler.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, t0, 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, t0, backtrace = nil) ⇒ SlowSql
Returns a new instance of SlowSql.
199 200 201 202 203 204 205 |
# File 'lib/ting_yun/agent/collector/sql_sampler.rb', line 199 def initialize(statement, metric_name, duration, t0, backtrace=nil) @start_time = t0 @statement = statement @metric_name = metric_name @duration = duration @backtrace = backtrace end |
Instance Attribute Details
#backtrace ⇒ Object (readonly)
Returns the value of attribute backtrace.
195 196 197 |
# File 'lib/ting_yun/agent/collector/sql_sampler.rb', line 195 def backtrace @backtrace end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
194 195 196 |
# File 'lib/ting_yun/agent/collector/sql_sampler.rb', line 194 def duration @duration end |
#metric_name ⇒ Object (readonly)
Returns the value of attribute metric_name.
193 194 195 |
# File 'lib/ting_yun/agent/collector/sql_sampler.rb', line 193 def metric_name @metric_name end |
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
196 197 198 |
# File 'lib/ting_yun/agent/collector/sql_sampler.rb', line 196 def start_time @start_time end |
#statement ⇒ Object (readonly)
Returns the value of attribute statement.
192 193 194 |
# File 'lib/ting_yun/agent/collector/sql_sampler.rb', line 192 def statement @statement end |
Instance Method Details
#explain ⇒ Object
220 221 222 223 224 |
# File 'lib/ting_yun/agent/collector/sql_sampler.rb', line 220 def explain if statement.config && statement.explainer TingYun::Agent::Database.explain_sql(statement.sql, statement.config, statement.explainer) end end |
#normalize ⇒ Object
216 217 218 |
# File 'lib/ting_yun/agent/collector/sql_sampler.rb', line 216 def normalize TingYun::Agent::Database::Obfuscator.instance.default_sql_obfuscator(statement) end |
#obfuscate ⇒ Object
211 212 213 |
# File 'lib/ting_yun/agent/collector/sql_sampler.rb', line 211 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
227 228 229 |
# File 'lib/ting_yun/agent/collector/sql_sampler.rb', line 227 def prepare_to_send statement.explainer = nil end |
#sql ⇒ Object
207 208 209 |
# File 'lib/ting_yun/agent/collector/sql_sampler.rb', line 207 def sql statement.sql end |