Class: NewRelic::Agent::SlowSql
- Inherits:
-
Object
- Object
- NewRelic::Agent::SlowSql
- Defined in:
- lib/new_relic/agent/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.
-
#sql ⇒ Object
readonly
Returns the value of attribute sql.
Instance Method Summary collapse
- #explain ⇒ Object
-
#initialize(sql, metric_name, config, duration, backtrace = nil) ⇒ SlowSql
constructor
A new instance of SlowSql.
- #normalize ⇒ Object
- #obfuscate ⇒ Object
Constructor Details
#initialize(sql, metric_name, config, duration, backtrace = nil) ⇒ SlowSql
Returns a new instance of SlowSql.
152 153 154 155 156 157 158 |
# File 'lib/new_relic/agent/sql_sampler.rb', line 152 def initialize(sql, metric_name, config, duration, backtrace = nil) @sql = sql @metric_name = metric_name @config = config @duration = duration @backtrace = backtrace end |
Instance Attribute Details
#backtrace ⇒ Object (readonly)
Returns the value of attribute backtrace.
150 151 152 |
# File 'lib/new_relic/agent/sql_sampler.rb', line 150 def backtrace @backtrace end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
149 150 151 |
# File 'lib/new_relic/agent/sql_sampler.rb', line 149 def duration @duration end |
#metric_name ⇒ Object (readonly)
Returns the value of attribute metric_name.
148 149 150 |
# File 'lib/new_relic/agent/sql_sampler.rb', line 148 def metric_name @metric_name end |
#sql ⇒ Object (readonly)
Returns the value of attribute sql.
147 148 149 |
# File 'lib/new_relic/agent/sql_sampler.rb', line 147 def sql @sql end |
Instance Method Details
#explain ⇒ Object
169 170 171 |
# File 'lib/new_relic/agent/sql_sampler.rb', line 169 def explain NewRelic::Agent::Database.explain_sql(@sql, @config) end |
#normalize ⇒ Object
164 165 166 167 |
# File 'lib/new_relic/agent/sql_sampler.rb', line 164 def normalize NewRelic::Agent::Database::Obfuscator.instance \ .default_sql_obfuscator(@sql).gsub(/\?\s*\,\s*/, '').gsub(/\s/, '') end |
#obfuscate ⇒ Object
160 161 162 |
# File 'lib/new_relic/agent/sql_sampler.rb', line 160 def obfuscate NewRelic::Agent::Database.obfuscate_sql(@sql) end |