Module: ScoutApm::Instruments::MopedInstrumentationPrepend
- Defined in:
- lib/scout_apm/instruments/moped.rb
Instance Method Summary collapse
- #process(operation, &callback) ⇒ Object
-
#scout_sanitize_log(log) ⇒ Object
replaces values w/ ?.
Instance Method Details
#process(operation, &callback) ⇒ Object
59 60 61 62 63 64 65 66 67 |
# File 'lib/scout_apm/instruments/moped.rb', line 59 def process(operation, &callback) if operation.respond_to?(:collection) collection = operation.collection name = "Process/#{collection}/#{operation.class.to_s.split('::').last}" self.class.instrument("MongoDB", name, :annotate_layer => { :query => scout_sanitize_log(operation.log_inspect) }) do super(operation, &callback) end end end |
#scout_sanitize_log(log) ⇒ Object
replaces values w/ ?
70 71 72 73 74 75 |
# File 'lib/scout_apm/instruments/moped.rb', line 70 def scout_sanitize_log(log) return nil if log.length > 1000 # safeguard - don't sanitize large SQL statements log.gsub(/(=>")((?:[^"]|"")*)"/) do $1 + '?' + '"' end end |