Class: Mongo::Index::View
- Inherits:
-
Object
- Object
- Mongo::Index::View
- Defined in:
- lib/traceview/inst/mongo2.rb
Instance Method Summary collapse
-
#collect_index_kvs(op, args) ⇒ Object
collect_kvs.
-
#m ⇒ Object
Here we dynamically define wrapper methods for the operations we want to instrument in mongo.
Instance Method Details
#collect_index_kvs(op, args) ⇒ Object
collect_kvs
Used to collect up information to report and build a hash with the Keys/Values to report.
183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/traceview/inst/mongo2.rb', line 183 def collect_index_kvs(op, args) kvs = { :Flavor => :mongodb, :Database => @collection.database.name } kvs[:QueryOp] = op kvs[:Collection] = @collection.name 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.}" if TraceView::Config[:verbose] ensure return kvs end |
#m ⇒ Object
Here we dynamically define wrapper methods for the operations we want to instrument in mongo
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/traceview/inst/mongo2.rb', line 200 INDEX_OPS.reject { |m| !method_defined?(m) }.each do |m| define_method("#{m}_with_traceview") do |*args| begin if !TraceView.tracing? || TraceView.tracing_layer?(:mongo) mongo_skipped = true return send("#{m}_without_traceview", *args) end kvs = collect_index_kvs(m, args) TraceView::API.log_entry(:mongo, kvs) send("#{m}_without_traceview", *args) rescue => e TraceView::API.log_exception(:mongo, e) raise e ensure TraceView::API.log_exit(:mongo) unless mongo_skipped end end ::TraceView::Util.method_alias(Mongo::Index::View, m) end |