Class: Mongo::Collection

Inherits:
Object
  • Object
show all
Includes:
TraceView::Inst::Mongo
Defined in:
lib/traceview/inst/mongo.rb

Constant Summary

Constants included from TraceView::Inst::Mongo

TraceView::Inst::Mongo::COLL_INDEX_OPS, TraceView::Inst::Mongo::COLL_QUERY_OPS, TraceView::Inst::Mongo::COLL_WRITE_OPS, TraceView::Inst::Mongo::CURSOR_OPS, TraceView::Inst::Mongo::DB_OPS, TraceView::Inst::Mongo::FLAVOR

Instance Method Summary collapse

Instance Method Details

#traceview_collect(m, args) ⇒ Object



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/traceview/inst/mongo.rb', line 120

def traceview_collect(m, args)
  begin
    report_kvs = {}
    report_kvs[:Flavor] = TraceView::Inst::Mongo::FLAVOR

    report_kvs[:Database] = @db.name
    report_kvs[:RemoteHost] = @db.connection.host
    report_kvs[:RemotePort] = @db.connection.port
    report_kvs[:Collection] = @name

    report_kvs[:Backtrace] = TraceView::API.backtrace if TraceView::Config[:mongo][:collect_backtraces]

    report_kvs[:QueryOp] = m
    report_kvs[:Query] = args[0].to_json if args && !args.empty? && args[0].class == Hash
  rescue StandardError => e
    TraceView.logger.debug "[traceview/debug] Exception in traceview_collect KV collection: #{e.inspect}"
  end
  report_kvs
end