class NewRelic::Agent::Database::Obfuscator
Constants
- ELLIPSIS
- QUERY_TOO_LARGE_MESSAGE
Attributes
Public Class Methods
Public Instance Methods
Source
# File lib/new_relic/agent/database/obfuscator.rb, line 51 def default_sql_obfuscator(sql) stmt = sql.kind_of?(Statement) ? sql : Statement.new(sql) if stmt.sql.end_with?(ELLIPSIS) return QUERY_TOO_LARGE_MESSAGE end obfuscate(stmt.sql, stmt.adapter).to_s end
Source
# File lib/new_relic/agent/database/obfuscator.rb, line 24 def reset @obfuscator = method(:default_sql_obfuscator) end
Source
# File lib/new_relic/agent/database/obfuscator.rb, line 39 def set_sql_obfuscator(type, &block) if type == :before @obfuscator = NewRelic::ChainedCall.new(block, @obfuscator) elsif type == :after @obfuscator = NewRelic::ChainedCall.new(@obfuscator, block) elsif type == :replace @obfuscator = block else fail "unknown sql_obfuscator type #{type}" end end
Sets the sql obfuscator used to clean up sql when sending it to the server. Possible types are:
:before => sets the block to run before the existing obfuscators
:after => sets the block to run after the existing obfuscator(s)
:replace => removes the current obfuscator and replaces it with the provided block