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.
191 192 193 194 195 196 197 |
# File 'lib/new_relic/agent/sql_sampler.rb', line 191 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.
189 190 191 |
# File 'lib/new_relic/agent/sql_sampler.rb', line 189 def backtrace @backtrace end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
188 189 190 |
# File 'lib/new_relic/agent/sql_sampler.rb', line 188 def duration @duration end |
#metric_name ⇒ Object (readonly)
Returns the value of attribute metric_name.
187 188 189 |
# File 'lib/new_relic/agent/sql_sampler.rb', line 187 def metric_name @metric_name end |
#sql ⇒ Object (readonly)
Returns the value of attribute sql.
186 187 188 |
# File 'lib/new_relic/agent/sql_sampler.rb', line 186 def sql @sql end |
Instance Method Details
#explain ⇒ Object
208 209 210 |
# File 'lib/new_relic/agent/sql_sampler.rb', line 208 def explain NewRelic::Agent::Database.explain_sql(@sql, @config) end |
#normalize ⇒ Object
203 204 205 206 |
# File 'lib/new_relic/agent/sql_sampler.rb', line 203 def normalize NewRelic::Agent::Database::Obfuscator.instance \ .default_sql_obfuscator(@sql).gsub(/\?\s*\,\s*/, '').gsub(/\s/, '') end |
#obfuscate ⇒ Object
199 200 201 |
# File 'lib/new_relic/agent/sql_sampler.rb', line 199 def obfuscate NewRelic::Agent::Database.obfuscate_sql(@sql) end |