Sha256: 34ef70b8bfe708c34a7e85a6c6fb632857b24174e3d50c8d6b33f4605129ca2a
Contents?: true
Size: 1.42 KB
Versions: 24
Compression:
Stored size: 1.42 KB
Contents
module ScoutApm module Instruments class Moped attr_reader :logger def initalize(logger=ScoutApm::Agent.instance.logger) @logger = logger @installed = false end def installed? @installed end def install @installed = true if defined?(::Moped) ScoutApm::Agent.instance.logger.info "Instrumenting Moped" ::Moped::Node.class_eval do include ScoutApm::Tracer def process_with_scout_instruments(operation, &callback) if operation.respond_to?(:collection) collection = operation.collection self.class.instrument("MongoDB/Process/#{collection}/#{operation.class.to_s.split('::').last}", :desc => scout_sanitize_log(operation.log_inspect)) do process_without_scout_instruments(operation, &callback) end end end alias_method :process_without_scout_instruments, :process alias_method :process, :process_with_scout_instruments # replaces values w/ ? def scout_sanitize_log(log) return nil if log.length > 1000 # safeguard - don't sanitize large SQL statements log.gsub(/(=>")((?:[^"]|"")*)"/) do $1 + '?' + '"' end end end end end end end end
Version data entries
24 entries across 24 versions & 1 rubygems