Class: Moped::Query
Constant Summary
Oboe::Inst::Moped::COLLECTION_OPS, Oboe::Inst::Moped::DB_OPS, Oboe::Inst::Moped::FLAVOR, Oboe::Inst::Moped::INDEX_OPS, Oboe::Inst::Moped::QUERY_OPS
Instance Method Summary
collapse
Instance Method Details
#count_with_oboe ⇒ Object
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
# File 'lib/oboe/inst/moped.rb', line 182
def count_with_oboe
if Oboe.tracing?
begin
report_kvs = (:count)
report_kvs[:Query] = selector.empty? ? "all" : selector.to_json
rescue Exception => e
Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}"
end
Oboe::API.trace('mongo', report_kvs) do
count_without_oboe
end
else
count_without_oboe
end
end
|
#distinct_with_oboe(key) ⇒ Object
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
|
# File 'lib/oboe/inst/moped.rb', line 235
def distinct_with_oboe(key)
if Oboe.tracing?
begin
report_kvs = (:distinct)
report_kvs[:Query] = selector.empty? ? "all" : selector.to_json
report_kvs[:Key] = key.to_s
rescue Exception => 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
else
distinct_without_oboe(key)
end
end
|
#explain_with_oboe ⇒ Object
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
|
# File 'lib/oboe/inst/moped.rb', line 306
def explain_with_oboe
if Oboe.tracing?
begin
report_kvs = (:explain)
report_kvs[:Query] = selector.empty? ? "all" : selector.to_json
rescue Exception => 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
else
explain_without_oboe
end
end
|
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
# File 'lib/oboe/inst/moped.rb', line 166
def (op)
report_kvs = {}
begin
report_kvs[:Flavor] = Oboe::Inst::Moped::FLAVOR
report_kvs[:RemoteHost], report_kvs[:RemotePort] = collection.database.session.cluster.seeds.first.split(':')
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 Exception => e
Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}"
end
report_kvs
end
|
#limit_with_oboe(limit) ⇒ Object
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
# File 'lib/oboe/inst/moped.rb', line 217
def limit_with_oboe(limit)
if Oboe.tracing? and not Oboe::Context.tracing_layer_op?(:explain)
begin
report_kvs = (:limit)
report_kvs[:Query] = selector.empty? ? "all" : selector.to_json
report_kvs[:Limit] = limit.to_s
rescue Exception => 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 = {}) ⇒ Object
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
|
# File 'lib/oboe/inst/moped.rb', line 323
def modify_with_oboe(change, options = {})
if Oboe.tracing?
begin
report_kvs = (:modify)
report_kvs[:Update_Document] = selector.empty? ? "all" : selector.to_json
report_kvs[:Change] = change.to_json
report_kvs[:Options] = options.to_json
rescue Exception => 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
else
modify_without_oboe(change, options)
end
end
|
#remove_all_with_oboe ⇒ Object
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
|
# File 'lib/oboe/inst/moped.rb', line 359
def remove_all_with_oboe
if Oboe.tracing?
begin
report_kvs = (:remove_all)
report_kvs[:Query] = selector.to_json
rescue Exception => 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
else
remove_all_without_oboe
end
end
|
#remove_with_oboe ⇒ Object
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
|
# File 'lib/oboe/inst/moped.rb', line 342
def remove_with_oboe
if Oboe.tracing?
begin
report_kvs = (:remove)
report_kvs[:Query] = selector.to_json
rescue Exception => e
Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}"
end
Oboe::API.trace('mongo', report_kvs) do
remove_without_oboe
end
else
remove_without_oboe
end
end
|
#sort_with_oboe(sort) ⇒ Object
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
# File 'lib/oboe/inst/moped.rb', line 199
def sort_with_oboe(sort)
if Oboe.tracing?
begin
report_kvs = (:sort)
report_kvs[:Query] = selector.empty? ? "all" : selector.to_json
report_kvs[:Order] = sort.to_s
rescue Exception => 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
else
sort_without_oboe(sort)
end
end
|
#update_all_with_oboe(change) ⇒ Object
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
|
# File 'lib/oboe/inst/moped.rb', line 271
def update_all_with_oboe(change)
if Oboe.tracing?
begin
report_kvs = (:update_all)
report_kvs[:Update_Document] = change.to_json
rescue Exception => 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
else
update_all_without_oboe(change)
end
end
|
#update_with_oboe(change, flags = nil) ⇒ Object
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
|
# File 'lib/oboe/inst/moped.rb', line 253
def update_with_oboe(change, flags = nil)
if Oboe.tracing? and not Oboe::Context.tracing_layer_op?([:update_all, :upsert])
begin
report_kvs = (:update)
report_kvs[:Flags] = flags.to_s if flags
report_kvs[:Update_Document] = change.to_json
rescue Exception => 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) ⇒ Object
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
|
# File 'lib/oboe/inst/moped.rb', line 288
def upsert_with_oboe(change)
if Oboe.tracing?
begin
report_kvs = (:upsert)
report_kvs[:Query] = selector.to_json
report_kvs[:Update_Document] = change.to_json
rescue Exception => 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
else
upsert_without_oboe(change)
end
end
|