oboe 2.7.0.3-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/.travis.yml +51 -0
  4. data/Appraisals +10 -0
  5. data/CHANGELOG.md +223 -0
  6. data/Gemfile +49 -0
  7. data/LICENSE +199 -0
  8. data/README.md +380 -0
  9. data/Rakefile +106 -0
  10. data/ext/oboe_metal/extconf.rb +61 -0
  11. data/ext/oboe_metal/noop/noop.c +7 -0
  12. data/ext/oboe_metal/src/bson/bson.h +221 -0
  13. data/ext/oboe_metal/src/bson/platform_hacks.h +91 -0
  14. data/ext/oboe_metal/src/oboe.h +275 -0
  15. data/ext/oboe_metal/src/oboe.hpp +352 -0
  16. data/ext/oboe_metal/src/oboe_wrap.cxx +3886 -0
  17. data/ext/oboe_metal/tests/test.rb +11 -0
  18. data/gemfiles/mongo.gemfile +33 -0
  19. data/gemfiles/moped.gemfile +33 -0
  20. data/get_version.rb +5 -0
  21. data/init.rb +4 -0
  22. data/lib/base.rb +99 -0
  23. data/lib/joboe_metal.rb +185 -0
  24. data/lib/method_profiling.rb +70 -0
  25. data/lib/oboe.rb +50 -0
  26. data/lib/oboe/api.rb +14 -0
  27. data/lib/oboe/api/layerinit.rb +99 -0
  28. data/lib/oboe/api/logging.rb +129 -0
  29. data/lib/oboe/api/memcache.rb +29 -0
  30. data/lib/oboe/api/profiling.rb +50 -0
  31. data/lib/oboe/api/tracing.rb +134 -0
  32. data/lib/oboe/api/util.rb +117 -0
  33. data/lib/oboe/config.rb +140 -0
  34. data/lib/oboe/frameworks/grape.rb +74 -0
  35. data/lib/oboe/frameworks/padrino.rb +66 -0
  36. data/lib/oboe/frameworks/padrino/templates.rb +59 -0
  37. data/lib/oboe/frameworks/rails.rb +139 -0
  38. data/lib/oboe/frameworks/rails/helpers/rum/rum_ajax_header.js.erb +5 -0
  39. data/lib/oboe/frameworks/rails/helpers/rum/rum_footer.js.erb +1 -0
  40. data/lib/oboe/frameworks/rails/helpers/rum/rum_header.js.erb +3 -0
  41. data/lib/oboe/frameworks/rails/inst/action_controller.rb +123 -0
  42. data/lib/oboe/frameworks/rails/inst/action_view.rb +56 -0
  43. data/lib/oboe/frameworks/rails/inst/action_view_2x.rb +54 -0
  44. data/lib/oboe/frameworks/rails/inst/action_view_30.rb +48 -0
  45. data/lib/oboe/frameworks/rails/inst/active_record.rb +24 -0
  46. data/lib/oboe/frameworks/rails/inst/connection_adapters/mysql.rb +43 -0
  47. data/lib/oboe/frameworks/rails/inst/connection_adapters/mysql2.rb +28 -0
  48. data/lib/oboe/frameworks/rails/inst/connection_adapters/oracle.rb +18 -0
  49. data/lib/oboe/frameworks/rails/inst/connection_adapters/postgresql.rb +30 -0
  50. data/lib/oboe/frameworks/rails/inst/connection_adapters/utils.rb +118 -0
  51. data/lib/oboe/frameworks/sinatra.rb +96 -0
  52. data/lib/oboe/frameworks/sinatra/templates.rb +56 -0
  53. data/lib/oboe/inst/cassandra.rb +281 -0
  54. data/lib/oboe/inst/dalli.rb +75 -0
  55. data/lib/oboe/inst/http.rb +72 -0
  56. data/lib/oboe/inst/memcache.rb +105 -0
  57. data/lib/oboe/inst/memcached.rb +96 -0
  58. data/lib/oboe/inst/mongo.rb +240 -0
  59. data/lib/oboe/inst/moped.rb +474 -0
  60. data/lib/oboe/inst/rack.rb +81 -0
  61. data/lib/oboe/inst/redis.rb +273 -0
  62. data/lib/oboe/inst/resque.rb +193 -0
  63. data/lib/oboe/instrumentation.rb +18 -0
  64. data/lib/oboe/loading.rb +98 -0
  65. data/lib/oboe/logger.rb +41 -0
  66. data/lib/oboe/ruby.rb +11 -0
  67. data/lib/oboe/util.rb +129 -0
  68. data/lib/oboe/version.rb +13 -0
  69. data/lib/oboe/xtrace.rb +52 -0
  70. data/lib/oboe_metal.rb +140 -0
  71. data/lib/rails/generators/oboe/install_generator.rb +76 -0
  72. data/lib/rails/generators/oboe/templates/oboe_initializer.rb +94 -0
  73. data/oboe.gemspec +29 -0
  74. data/release.sh +65 -0
  75. data/test/frameworks/apps/grape_simple.rb +10 -0
  76. data/test/frameworks/apps/padrino_simple.rb +41 -0
  77. data/test/frameworks/apps/sinatra_simple.rb +20 -0
  78. data/test/frameworks/grape_test.rb +27 -0
  79. data/test/frameworks/padrino_test.rb +25 -0
  80. data/test/frameworks/sinatra_test.rb +25 -0
  81. data/test/instrumentation/cassandra_test.rb +381 -0
  82. data/test/instrumentation/dalli_test.rb +164 -0
  83. data/test/instrumentation/http_test.rb +97 -0
  84. data/test/instrumentation/memcache_test.rb +251 -0
  85. data/test/instrumentation/memcached_test.rb +226 -0
  86. data/test/instrumentation/mongo_test.rb +462 -0
  87. data/test/instrumentation/moped_test.rb +473 -0
  88. data/test/instrumentation/rack_test.rb +73 -0
  89. data/test/instrumentation/redis_hashes_test.rb +265 -0
  90. data/test/instrumentation/redis_keys_test.rb +318 -0
  91. data/test/instrumentation/redis_lists_test.rb +310 -0
  92. data/test/instrumentation/redis_misc_test.rb +160 -0
  93. data/test/instrumentation/redis_sets_test.rb +293 -0
  94. data/test/instrumentation/redis_sortedsets_test.rb +325 -0
  95. data/test/instrumentation/redis_strings_test.rb +333 -0
  96. data/test/instrumentation/resque_test.rb +62 -0
  97. data/test/minitest_helper.rb +148 -0
  98. data/test/profiling/method_test.rb +198 -0
  99. data/test/support/config_test.rb +39 -0
  100. data/test/support/liboboe_settings_test.rb +46 -0
  101. data/test/support/xtrace_test.rb +35 -0
  102. metadata +200 -0
@@ -0,0 +1,474 @@
1
+ # Copyright (c) 2013 AppNeta, Inc.
2
+ # All rights reserved.
3
+
4
+ require 'json'
5
+
6
+ module Oboe
7
+ module Inst
8
+ module Moped
9
+ FLAVOR = 'mongodb'
10
+
11
+ # Moped::Database
12
+ DB_OPS = [ :command, :drop ]
13
+
14
+ # Moped::Indexes
15
+ INDEX_OPS = [ :create, :drop ]
16
+
17
+ # Moped::Query
18
+ QUERY_OPS = [ :count, :sort, :limit, :distinct, :update, :update_all, :upsert,
19
+ :explain, :modify, :remove, :remove_all ]
20
+
21
+ # Moped::Collection
22
+ COLLECTION_OPS = [ :drop, :find, :indexes, :insert, :aggregate ]
23
+ end
24
+ end
25
+ end
26
+
27
+ if defined?(::Moped) and Oboe::Config[:moped][:enabled]
28
+ Oboe.logger.info "[oboe/loading] Instrumenting moped" if Oboe::Config[:verbose]
29
+
30
+ if defined?(::Moped::Database)
31
+ module ::Moped
32
+ class Database
33
+ include Oboe::Inst::Moped
34
+
35
+ def extract_trace_details(op)
36
+ report_kvs = {}
37
+ begin
38
+ report_kvs[:Flavor] = Oboe::Inst::Moped::FLAVOR
39
+ # FIXME: We're only grabbing the first of potentially multiple servers here
40
+ if ::Moped::VERSION < "2.0.0"
41
+ report_kvs[:RemoteHost], report_kvs[:RemotePort] = session.cluster.seeds.first.split(':')
42
+ else
43
+ report_kvs[:RemoteHost] = session.cluster.seeds.first.address.host
44
+ report_kvs[:RemotePort] = session.cluster.seeds.first.address.port
45
+ end
46
+ report_kvs[:Database] = name
47
+ report_kvs[:QueryOp] = op.to_s
48
+ report_kvs[:Backtrace] = Oboe::API.backtrace if Oboe::Config[:moped][:collect_backtraces]
49
+ rescue StandardError => e
50
+ Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}"
51
+ end
52
+ report_kvs
53
+ end
54
+
55
+ def command_with_oboe(command)
56
+ if Oboe.tracing? and not Oboe.layer_op and command.has_key?(:mapreduce)
57
+ begin
58
+ report_kvs = extract_trace_details(:map_reduce)
59
+ report_kvs[:Map_Function] = command[:map]
60
+ report_kvs[:Reduce_Function] = command[:reduce]
61
+ rescue StandardError => e
62
+ Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}"
63
+ end
64
+
65
+ Oboe::API.trace('mongo', report_kvs) do
66
+ command_without_oboe(command)
67
+ end
68
+ else
69
+ command_without_oboe(command)
70
+ end
71
+ end
72
+
73
+ def drop_with_oboe
74
+ return drop_without_oboe unless Oboe.tracing?
75
+
76
+ report_kvs = extract_trace_details(:drop_database)
77
+
78
+ Oboe::API.trace('mongo', report_kvs) do
79
+ drop_without_oboe
80
+ end
81
+ end
82
+
83
+ Oboe::Inst::Moped::DB_OPS.each do |m|
84
+ if method_defined?(m)
85
+ class_eval "alias #{m}_without_oboe #{m}"
86
+ class_eval "alias #{m} #{m}_with_oboe"
87
+ else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument moped (#{m}). Partial traces may occur."
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
93
+
94
+ if defined?(::Moped::Indexes)
95
+ module ::Moped
96
+ class Indexes
97
+ include Oboe::Inst::Moped
98
+
99
+ def extract_trace_details(op)
100
+ report_kvs = {}
101
+ begin
102
+ report_kvs[:Flavor] = Oboe::Inst::Moped::FLAVOR
103
+ # FIXME: We're only grabbing the first of potentially multiple servers here
104
+ if ::Moped::VERSION < "2.0.0"
105
+ report_kvs[:RemoteHost], report_kvs[:RemotePort] = database.session.cluster.seeds.first.split(':')
106
+ else
107
+ report_kvs[:RemoteHost] = database.session.cluster.seeds.first.address.host
108
+ report_kvs[:RemotePort] = database.session.cluster.seeds.first.address.port
109
+ end
110
+ report_kvs[:Database] = database.name
111
+ report_kvs[:QueryOp] = op.to_s
112
+ report_kvs[:Backtrace] = Oboe::API.backtrace if Oboe::Config[:moped][:collect_backtraces]
113
+ rescue StandardError => e
114
+ Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}"
115
+ end
116
+ report_kvs
117
+ end
118
+
119
+ def create_with_oboe(key, options = {})
120
+ return create_without_oboe(key, options = {}) unless Oboe.tracing?
121
+
122
+ begin
123
+ # We report :create_index here to be consistent
124
+ # with other mongo implementations
125
+ report_kvs = extract_trace_details(:create_index)
126
+ report_kvs[:Key] = key.to_json
127
+ report_kvs[:Options] = options.to_json
128
+ rescue StandardError => e
129
+ Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}"
130
+ end
131
+
132
+ Oboe::API.trace('mongo', report_kvs, :create_index) do
133
+ create_without_oboe(key, options = {})
134
+ end
135
+ end
136
+
137
+ def drop_with_oboe(key = nil)
138
+ return drop_without_oboe(key = nil) unless Oboe.tracing?
139
+
140
+ begin
141
+ # We report :drop_indexes here to be consistent
142
+ # with other mongo implementations
143
+ report_kvs = extract_trace_details(:drop_indexes)
144
+ report_kvs[:Key] = key.nil? ? "all" : key.to_json
145
+ rescue StandardError => e
146
+ Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}"
147
+ end
148
+
149
+ Oboe::API.trace('mongo', report_kvs) do
150
+ drop_without_oboe(key = nil)
151
+ end
152
+ end
153
+
154
+ Oboe::Inst::Moped::INDEX_OPS.each do |m|
155
+ if method_defined?(m)
156
+ class_eval "alias #{m}_without_oboe #{m}"
157
+ class_eval "alias #{m} #{m}_with_oboe"
158
+ else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument moped (#{m}). Partial traces may occur."
159
+ end
160
+ end
161
+ end
162
+ end
163
+ end
164
+
165
+ if defined?(::Moped::Query)
166
+ module ::Moped
167
+ class Query
168
+ include Oboe::Inst::Moped
169
+
170
+ def extract_trace_details(op)
171
+ report_kvs = {}
172
+ begin
173
+ report_kvs[:Flavor] = Oboe::Inst::Moped::FLAVOR
174
+ # FIXME: We're only grabbing the first of potentially multiple servers here
175
+ if ::Moped::VERSION < "2.0.0"
176
+ report_kvs[:RemoteHost], report_kvs[:RemotePort] = collection.database.session.cluster.seeds.first.split(':')
177
+ else
178
+ report_kvs[:RemoteHost] = collection.database.session.cluster.seeds.first.address.host
179
+ report_kvs[:RemotePort] = collection.database.session.cluster.seeds.first.address.port
180
+ end
181
+ report_kvs[:Database] = collection.database.name
182
+ report_kvs[:Collection] = collection.name
183
+ report_kvs[:QueryOp] = op.to_s
184
+ report_kvs[:Backtrace] = Oboe::API.backtrace if Oboe::Config[:moped][:collect_backtraces]
185
+ rescue StandardError => e
186
+ Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}"
187
+ end
188
+ report_kvs
189
+ end
190
+
191
+ def count_with_oboe
192
+ return count_without_oboe unless Oboe.tracing?
193
+
194
+ begin
195
+ report_kvs = extract_trace_details(:count)
196
+ report_kvs[:Query] = selector.empty? ? "all" : selector.to_json
197
+ rescue StandardError => e
198
+ Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}"
199
+ end
200
+
201
+ Oboe::API.trace('mongo', report_kvs) do
202
+ count_without_oboe
203
+ end
204
+ end
205
+
206
+ def sort_with_oboe(sort)
207
+ return sort_without_oboe(sort) unless Oboe.tracing?
208
+
209
+ begin
210
+ report_kvs = extract_trace_details(:sort)
211
+ report_kvs[:Query] = selector.empty? ? "all" : selector.to_json
212
+ report_kvs[:Order] = sort.to_s
213
+ rescue StandardError => e
214
+ Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}"
215
+ end
216
+
217
+ Oboe::API.trace('mongo', report_kvs) do
218
+ sort_without_oboe(sort)
219
+ end
220
+ end
221
+
222
+ def limit_with_oboe(limit)
223
+ if Oboe.tracing? and not Oboe.tracing_layer_op?(:explain)
224
+ begin
225
+ report_kvs = extract_trace_details(:limit)
226
+ report_kvs[:Query] = selector.empty? ? "all" : selector.to_json
227
+ report_kvs[:Limit] = limit.to_s
228
+ rescue StandardError => e
229
+ Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}"
230
+ end
231
+
232
+ Oboe::API.trace('mongo', report_kvs) do
233
+ limit_without_oboe(limit)
234
+ end
235
+ else
236
+ limit_without_oboe(limit)
237
+ end
238
+ end
239
+
240
+ def distinct_with_oboe(key)
241
+ return distinct_without_oboe(key) unless Oboe.tracing?
242
+
243
+ begin
244
+ report_kvs = extract_trace_details(:distinct)
245
+ report_kvs[:Query] = selector.empty? ? "all" : selector.to_json
246
+ report_kvs[:Key] = key.to_s
247
+ rescue StandardError => e
248
+ Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}"
249
+ end
250
+
251
+ Oboe::API.trace('mongo', report_kvs) do
252
+ distinct_without_oboe(key)
253
+ end
254
+ end
255
+
256
+ def update_with_oboe(change, flags = nil)
257
+ if Oboe.tracing? and not Oboe.tracing_layer_op?([:update_all, :upsert])
258
+ begin
259
+ report_kvs = extract_trace_details(:update)
260
+ report_kvs[:Flags] = flags.to_s if flags
261
+ report_kvs[:Update_Document] = change.to_json
262
+ rescue StandardError => e
263
+ Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}"
264
+ end
265
+
266
+ Oboe::API.trace('mongo', report_kvs) do
267
+ update_without_oboe(change, flags = nil)
268
+ end
269
+ else
270
+ update_without_oboe(change, flags = nil)
271
+ end
272
+ end
273
+
274
+ def update_all_with_oboe(change)
275
+ return update_all_without_oboe(change) unless Oboe.tracing?
276
+
277
+ begin
278
+ report_kvs = extract_trace_details(:update_all)
279
+ report_kvs[:Update_Document] = change.to_json
280
+ rescue StandardError => e
281
+ Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}"
282
+ end
283
+
284
+ Oboe::API.trace('mongo', report_kvs, :update_all) do
285
+ update_all_without_oboe(change)
286
+ end
287
+ end
288
+
289
+ def upsert_with_oboe(change)
290
+ return upsert_without_oboe(change) unless Oboe.tracing?
291
+
292
+ begin
293
+ report_kvs = extract_trace_details(:upsert)
294
+ report_kvs[:Query] = selector.to_json
295
+ report_kvs[:Update_Document] = change.to_json
296
+ rescue StandardError => e
297
+ Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}"
298
+ end
299
+
300
+ Oboe::API.trace('mongo', report_kvs, :upsert) do
301
+ upsert_without_oboe(change)
302
+ end
303
+ end
304
+
305
+ def explain_with_oboe
306
+ return explain_without_oboe unless Oboe.tracing?
307
+
308
+ begin
309
+ report_kvs = extract_trace_details(:explain)
310
+ report_kvs[:Query] = selector.empty? ? "all" : selector.to_json
311
+ rescue StandardError => e
312
+ Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}"
313
+ end
314
+
315
+ Oboe::API.trace('mongo', report_kvs, :explain) do
316
+ explain_without_oboe
317
+ end
318
+ end
319
+
320
+ def modify_with_oboe(change, options = {})
321
+ return modify_without_oboe(change, options) unless Oboe.tracing?
322
+
323
+ begin
324
+ report_kvs = extract_trace_details(:modify)
325
+ report_kvs[:Update_Document] = selector.empty? ? "all" : selector.to_json
326
+ report_kvs[:Change] = change.to_json
327
+ report_kvs[:Options] = options.to_json
328
+ rescue StandardError => e
329
+ Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}"
330
+ end
331
+
332
+ Oboe::API.trace('mongo', report_kvs) do
333
+ modify_without_oboe(change, options)
334
+ end
335
+ end
336
+
337
+ def remove_with_oboe
338
+ return remove_without_oboe unless Oboe.tracing?
339
+
340
+ begin
341
+ report_kvs = extract_trace_details(:remove)
342
+ report_kvs[:Query] = selector.to_json
343
+ rescue StandardError => e
344
+ Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}"
345
+ end
346
+
347
+ Oboe::API.trace('mongo', report_kvs) do
348
+ remove_without_oboe
349
+ end
350
+ end
351
+
352
+ def remove_all_with_oboe
353
+ return remove_all_without_oboe unless Oboe.tracing?
354
+
355
+ begin
356
+ report_kvs = extract_trace_details(:remove_all)
357
+ report_kvs[:Query] = selector.to_json
358
+ rescue StandardError => e
359
+ Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}"
360
+ end
361
+
362
+ Oboe::API.trace('mongo', report_kvs) do
363
+ remove_all_without_oboe
364
+ end
365
+ end
366
+
367
+ Oboe::Inst::Moped::QUERY_OPS.each do |m|
368
+ if method_defined?(m)
369
+ class_eval "alias #{m}_without_oboe #{m}"
370
+ class_eval "alias #{m} #{m}_with_oboe"
371
+ else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument moped (#{m}). Partial traces may occur."
372
+ end
373
+ end
374
+ end
375
+ end
376
+ end # ::Moped::Query
377
+
378
+
379
+ if defined?(::Moped::Collection)
380
+ module ::Moped
381
+ class Collection
382
+ include Oboe::Inst::Moped
383
+
384
+ def extract_trace_details(op)
385
+ report_kvs = {}
386
+ begin
387
+ report_kvs[:Flavor] = Oboe::Inst::Moped::FLAVOR
388
+ # FIXME: We're only grabbing the first of potentially multiple servers here
389
+ if ::Moped::VERSION < "2.0.0"
390
+ report_kvs[:RemoteHost], report_kvs[:RemotePort] = database.session.cluster.seeds.first.split(':')
391
+ else
392
+ report_kvs[:RemoteHost] = database.session.cluster.seeds.first.address.host
393
+ report_kvs[:RemotePort] = database.session.cluster.seeds.first.address.port
394
+ end
395
+ report_kvs[:Database] = database.name
396
+ report_kvs[:Collection] = name
397
+ report_kvs[:QueryOp] = op.to_s
398
+ report_kvs[:Backtrace] = Oboe::API.backtrace if Oboe::Config[:moped][:collect_backtraces]
399
+ rescue StandardError => e
400
+ Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}"
401
+ end
402
+ report_kvs
403
+ end
404
+
405
+ def drop_with_oboe
406
+ return drop_without_oboe unless Oboe.tracing?
407
+
408
+ # We report :drop_collection here to be consistent
409
+ # with other mongo implementations
410
+ report_kvs = extract_trace_details(:drop_collection)
411
+
412
+ Oboe::API.trace('mongo', report_kvs) do
413
+ drop_without_oboe
414
+ end
415
+ end
416
+
417
+ def find_with_oboe(selector = {})
418
+ return find_without_oboe(selector) unless Oboe.tracing?
419
+
420
+ begin
421
+ report_kvs = extract_trace_details(:find)
422
+ report_kvs[:Query] = selector.empty? ? "all" : selector.to_json
423
+ rescue StandardError => e
424
+ Oboe.logger.debug "[oboe/debug] Moped KV collection error: #{e.inspect}"
425
+ end
426
+
427
+ Oboe::API.trace('mongo', report_kvs) do
428
+ find_without_oboe(selector)
429
+ end
430
+ end
431
+
432
+ def indexes_with_oboe
433
+ return indexes_without_oboe unless Oboe.tracing?
434
+
435
+ report_kvs = extract_trace_details(:indexes)
436
+
437
+ Oboe::API.trace('mongo', report_kvs) do
438
+ indexes_without_oboe
439
+ end
440
+ end
441
+
442
+ def insert_with_oboe(documents, flags = nil)
443
+ if Oboe.tracing? and not Oboe.tracing_layer_op?(:create_index)
444
+ report_kvs = extract_trace_details(:insert)
445
+
446
+ Oboe::API.trace('mongo', report_kvs) do
447
+ insert_without_oboe(documents, flags)
448
+ end
449
+ else
450
+ insert_without_oboe(documents, flags)
451
+ end
452
+ end
453
+
454
+ def aggregate_with_oboe(pipeline)
455
+ return aggregate_without_oboe(pipeline) unless Oboe.tracing?
456
+
457
+ report_kvs = extract_trace_details(:aggregate)
458
+
459
+ Oboe::API.trace('mongo', report_kvs) do
460
+ aggregate_without_oboe(pipeline)
461
+ end
462
+ end
463
+
464
+ Oboe::Inst::Moped::COLLECTION_OPS.each do |m|
465
+ if method_defined?(m)
466
+ class_eval "alias #{m}_without_oboe #{m}"
467
+ class_eval "alias #{m} #{m}_with_oboe"
468
+ else Oboe.logger.warn "[oboe/loading] Couldn't properly instrument moped (#{m}). Partial traces may occur."
469
+ end
470
+ end
471
+ end
472
+ end
473
+ end # ::Moped::Collection
474
+ end