class Moped::Query
Public Instance Methods
count_with_oboe()
click to toggle source
# File lib/oboe/inst/moped.rb, line 191 def count_with_oboe return count_without_oboe unless Oboe.tracing? begin report_kvs = extract_trace_details(:count) report_kvs[:Query] = selector.empty? ? 'all' : selector.to_json rescue StandardError => e Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}" end Oboe::API.trace('mongo', report_kvs) do count_without_oboe end end
distinct_with_oboe(key)
click to toggle source
# File lib/oboe/inst/moped.rb, line 240 def distinct_with_oboe(key) return distinct_without_oboe(key) unless Oboe.tracing? begin report_kvs = extract_trace_details(:distinct) report_kvs[:Query] = selector.empty? ? 'all' : selector.to_json report_kvs[:Key] = key.to_s rescue StandardError => e Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}" end Oboe::API.trace('mongo', report_kvs) do distinct_without_oboe(key) end end
explain_with_oboe()
click to toggle source
# File lib/oboe/inst/moped.rb, line 305 def explain_with_oboe return explain_without_oboe unless Oboe.tracing? begin report_kvs = extract_trace_details(:explain) report_kvs[:Query] = selector.empty? ? 'all' : selector.to_json rescue StandardError => e Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}" end Oboe::API.trace('mongo', report_kvs, :explain) do explain_without_oboe end end
extract_trace_details(op)
click to toggle source
# File lib/oboe/inst/moped.rb, line 170 def extract_trace_details(op) report_kvs = {} begin report_kvs[:Flavor] = Oboe::Inst::Moped::FLAVOR # FIXME: We're only grabbing the first of potentially multiple servers here if ::Moped::VERSION < '2.0.0' report_kvs[:RemoteHost], report_kvs[:RemotePort] = collection.database.session.cluster.seeds.first.split(':') else report_kvs[:RemoteHost] = collection.database.session.cluster.seeds.first.address.host report_kvs[:RemotePort] = collection.database.session.cluster.seeds.first.address.port end report_kvs[:Database] = collection.database.name report_kvs[:Collection] = collection.name report_kvs[:QueryOp] = op.to_s report_kvs[:Backtrace] = Oboe::API.backtrace if Oboe::Config[:moped][:collect_backtraces] rescue StandardError => e Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}" end report_kvs end
limit_with_oboe(limit)
click to toggle source
# File lib/oboe/inst/moped.rb, line 222 def limit_with_oboe(limit) if Oboe.tracing? && !Oboe.tracing_layer_op?(:explain) begin report_kvs = extract_trace_details(:limit) report_kvs[:Query] = selector.empty? ? 'all' : selector.to_json report_kvs[:Limit] = limit.to_s rescue StandardError => e Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}" end Oboe::API.trace('mongo', report_kvs) do limit_without_oboe(limit) end else limit_without_oboe(limit) end end
modify_with_oboe(change, options = {})
click to toggle source
# File lib/oboe/inst/moped.rb, line 320 def modify_with_oboe(change, options = {}) return modify_without_oboe(change, options) unless Oboe.tracing? begin report_kvs = extract_trace_details(:modify) report_kvs[:Update_Document] = selector.empty? ? 'all' : selector.to_json report_kvs[:Change] = change.to_json report_kvs[:Options] = options.to_json rescue StandardError => e Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}" end Oboe::API.trace('mongo', report_kvs) do modify_without_oboe(change, options) end end
remove_all_with_oboe()
click to toggle source
# File lib/oboe/inst/moped.rb, line 352 def remove_all_with_oboe return remove_all_without_oboe unless Oboe.tracing? begin report_kvs = extract_trace_details(:remove_all) report_kvs[:Query] = selector.to_json rescue StandardError => e Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}" end Oboe::API.trace('mongo', report_kvs) do remove_all_without_oboe end end
remove_with_oboe()
click to toggle source
# File lib/oboe/inst/moped.rb, line 337 def remove_with_oboe return remove_without_oboe unless Oboe.tracing? begin report_kvs = extract_trace_details(:remove) report_kvs[:Query] = selector.to_json rescue StandardError => e Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}" end Oboe::API.trace('mongo', report_kvs) do remove_without_oboe end end
sort_with_oboe(sort)
click to toggle source
# File lib/oboe/inst/moped.rb, line 206 def sort_with_oboe(sort) return sort_without_oboe(sort) unless Oboe.tracing? begin report_kvs = extract_trace_details(:sort) report_kvs[:Query] = selector.empty? ? 'all' : selector.to_json report_kvs[:Order] = sort.to_s rescue StandardError => e Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}" end Oboe::API.trace('mongo', report_kvs) do sort_without_oboe(sort) end end
update_all_with_oboe(change)
click to toggle source
# File lib/oboe/inst/moped.rb, line 274 def update_all_with_oboe(change) return update_all_without_oboe(change) unless Oboe.tracing? begin report_kvs = extract_trace_details(:update_all) report_kvs[:Update_Document] = change.to_json rescue StandardError => e Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}" end Oboe::API.trace('mongo', report_kvs, :update_all) do update_all_without_oboe(change) end end
update_with_oboe(change, flags = nil)
click to toggle source
# File lib/oboe/inst/moped.rb, line 256 def update_with_oboe(change, flags = nil) if Oboe.tracing? && !Oboe.tracing_layer_op?([:update_all, :upsert]) begin report_kvs = extract_trace_details(:update) report_kvs[:Flags] = flags.to_s if flags report_kvs[:Update_Document] = change.to_json rescue StandardError => e Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}" end Oboe::API.trace('mongo', report_kvs) do update_without_oboe(change, flags = nil) end else update_without_oboe(change, flags = nil) end end
upsert_with_oboe(change)
click to toggle source
# File lib/oboe/inst/moped.rb, line 289 def upsert_with_oboe(change) return upsert_without_oboe(change) unless Oboe.tracing? begin report_kvs = extract_trace_details(:upsert) report_kvs[:Query] = selector.to_json report_kvs[:Update_Document] = change.to_json rescue StandardError => e Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}" end Oboe::API.trace('mongo', report_kvs, :upsert) do upsert_without_oboe(change) end end