class Mongo::Collection::View
Public Instance Methods
collect_kvs(op, args)
click to toggle source
Used to collect up information to report and build a hash with the Keys/Values to report.
# File lib/traceview/inst/mongo2.rb, line 108 def collect_kvs(op, args) kvs = { :Flavor => :mongodb, :Database => @collection.database.name } kvs[:QueryOp] = op kvs[:Collection] = @collection.name if op == :map_reduce kvs[:Map_Function] = args[0] kvs[:Reduce_Function] = args[1] kvs[:Limit] = args[2][:limit] if args[2].is_a?(Hash) && args[2].key?(:limit) end if TraceView::Config[:mongo][:log_args] if VIEW_QUERY_OPS.include?(op) if defined?(filter) kvs[:Query] = filter.to_json elsif defined?(selector) kvs[:Query] = selector.to_json end end end kvs[:RemoteHost] = @collection.database.client.cluster.addresses.first.to_s kvs[:Backtrace] = TraceView::API.backtrace if TraceView::Config[:mongo][:collect_backtraces] rescue => e TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose] ensure return kvs end