module TraceView::Inst::MopedDatabase
Public Class Methods
included(klass)
click to toggle source
# File lib/traceview/inst/moped.rb, line 48 def self.included(klass) TraceView::Inst::Moped::DB_OPS.each do |m| ::TraceView::Util.method_alias(klass, m) end end
Public Instance Methods
command_with_traceview(command)
click to toggle source
# File lib/traceview/inst/moped.rb, line 68 def command_with_traceview(command) if TraceView.tracing? && !TraceView.layer_op && command.key?(:mapreduce) begin report_kvs = extract_trace_details(:map_reduce) report_kvs[:Map_Function] = command[:map] report_kvs[:Reduce_Function] = command[:reduce] rescue => e TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" end TraceView::API.trace(:mongo, report_kvs) do command_without_traceview(command) end else command_without_traceview(command) end end
drop_with_traceview()
click to toggle source
# File lib/traceview/inst/moped.rb, line 86 def drop_with_traceview return drop_without_traceview unless TraceView.tracing? report_kvs = extract_trace_details(:drop_database) TraceView::API.trace(:mongo, report_kvs) do drop_without_traceview end end
extract_trace_details(op)
click to toggle source
# File lib/traceview/inst/moped.rb, line 54 def extract_trace_details(op) report_kvs = {} report_kvs[:Flavor] = TraceView::Inst::Moped::FLAVOR # FIXME: We're only grabbing the first of potentially multiple servers here report_kvs[:RemoteHost] = remote_host(session.cluster.seeds.first) report_kvs[:Database] = name report_kvs[:QueryOp] = op.to_s report_kvs[:Backtrace] = TraceView::API.backtrace if TraceView::Config[:moped][:collect_backtraces] rescue StandardError => e TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" ensure return report_kvs end