oboe 2.6.5.5 → 2.6.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de480d62f58bc7fc1264f2200e2a6b9e2bd795dc
4
- data.tar.gz: 674039622538fafb9f96b2c757d272e87502e261
3
+ metadata.gz: 88b047a073e88c218371312a035decc488059eaa
4
+ data.tar.gz: c4893000d6fc960a84ac93f84e5b4b26ffef9713
5
5
  SHA512:
6
- metadata.gz: 857f1e991c9ce93e6fafdc945869c9fb55444b088a07c43887b2570d16c14a7fde1a671f6960177ec0a82aab4b9bcce5297421146d457907c1cf2e27b003392f
7
- data.tar.gz: 4e26b5b965178772d41e7304245d9ff8f62d6034e7afbebfee97bdf21f012cad8bbb4d367aa2710f93dde5ae0eab322cee9200d4a275afbbf1bd05f9ccdeb120
6
+ metadata.gz: 3e59b0470032680bf931922fce2ea4e402a75bc430aacc14739e7d02cd44a08f3c3634e7f82009ce457dbb3df691c503cba444b15b52fa58f94e8a4314599a87
7
+ data.tar.gz: c52b420be49fc23794252e0f68aa9b6d6834e76173f8ca485f02bdf27dd70e80bad07116c206d4cb2b70520c65cd10249f9a23ca0e08bb44a9d3e774d8aa20f7
data/Gemfile CHANGED
@@ -9,10 +9,10 @@ group :development, :test do
9
9
  end
10
10
 
11
11
  group :development do
12
- gem 'ruby-debug', :platform => :mri_18
13
- gem 'ruby-debug19', :platform => :mri_19, :require => 'ruby-debug'
14
- gem 'byebug', :platform => :mri_20
15
- gem 'perftools.rb', :platform => :mri, :require => 'perftools'
12
+ gem 'ruby-debug', :platform => :mri_18
13
+ gem 'debugger', :platform => :mri_19
14
+ gem 'byebug', :platforms => [ :mri_20, :mri_21 ]
15
+ gem 'perftools.rb', :platforms => [ :mri_20, :mri_21 ], :require => 'perftools'
16
16
  gem 'pry'
17
17
  end
18
18
 
@@ -31,7 +31,8 @@ gem 'redis'
31
31
  gem 'sinatra'
32
32
 
33
33
  if RUBY_VERSION >= '1.9.3'
34
- gem 'padrino', '0.12.0'
34
+ gem 'padrino', '0.12.0'
35
+ gem 'grape'
35
36
  end
36
37
 
37
38
  # Import dependencies from oboe.gemspec
data/Gemfile.lock CHANGED
@@ -18,7 +18,10 @@ GEM
18
18
  bundler
19
19
  rake
20
20
  thor (>= 0.14.0)
21
- archive-tar-minitar (0.5.2)
21
+ axiom-types (0.1.1)
22
+ descendants_tracker (~> 0.0.4)
23
+ ice_nine (~> 0.11.0)
24
+ thread_safe (~> 0.3, >= 0.3.1)
22
25
  bson (1.10.1)
23
26
  bson_ext (1.10.1)
24
27
  bson (~> 1.10.1)
@@ -32,22 +35,43 @@ GEM
32
35
  simple_uuid (~> 0.3)
33
36
  thrift_client (~> 0.7, < 0.9)
34
37
  coderay (1.1.0)
38
+ coercible (1.0.0)
39
+ descendants_tracker (~> 0.0.1)
35
40
  columnize (0.8.9)
36
41
  dalli (2.7.2)
42
+ debugger (1.6.8)
43
+ columnize (>= 0.3.1)
44
+ debugger-linecache (~> 1.2.0)
45
+ debugger-ruby_core_source (~> 1.3.5)
37
46
  debugger-linecache (1.2.0)
47
+ debugger-ruby_core_source (1.3.5)
48
+ descendants_tracker (0.0.4)
49
+ thread_safe (~> 0.3, >= 0.3.1)
50
+ equalizer (0.0.9)
51
+ grape (0.7.0)
52
+ activesupport
53
+ builder
54
+ hashie (>= 1.2.0)
55
+ multi_json (>= 1.3.2)
56
+ multi_xml (>= 0.5.2)
57
+ rack (>= 1.3.0)
58
+ rack-accept
59
+ rack-mount
60
+ virtus (>= 1.0.0)
61
+ hashie (3.0.0)
38
62
  http_router (0.11.1)
39
63
  rack (>= 1.0.0)
40
64
  url_mount (~> 0.2.1)
41
65
  i18n (0.6.9)
66
+ ice_nine (0.11.0)
42
67
  json (1.8.1)
43
68
  linecache (0.46)
44
69
  rbx-require-relative (> 0.0.4)
45
- linecache19 (0.5.12)
46
- ruby_core_source (>= 0.1.4)
47
70
  mail (2.5.4)
48
71
  mime-types (~> 1.16)
49
72
  treetop (~> 1.4.8)
50
73
  memcache-client (1.8.5)
74
+ memcached (1.7.2)
51
75
  method_source (0.8.2)
52
76
  mime-types (1.25.1)
53
77
  minitest (5.3.4)
@@ -62,6 +86,7 @@ GEM
62
86
  mono_logger (1.1.0)
63
87
  moped (1.5.2)
64
88
  multi_json (1.10.1)
89
+ multi_xml (0.5.5)
65
90
  padrino (0.12.0)
66
91
  padrino-admin (= 0.12.0)
67
92
  padrino-cache (= 0.12.0)
@@ -99,6 +124,10 @@ GEM
99
124
  method_source (~> 0.8)
100
125
  slop (~> 3.4)
101
126
  rack (1.5.2)
127
+ rack-accept (0.4.5)
128
+ rack (>= 0.4)
129
+ rack-mount (0.8.3)
130
+ rack (>= 1.0.0)
102
131
  rack-protection (1.5.3)
103
132
  rack
104
133
  rack-test (0.6.2)
@@ -119,17 +148,7 @@ GEM
119
148
  ruby-debug-base (~> 0.10.4.0)
120
149
  ruby-debug-base (0.10.4)
121
150
  linecache (>= 0.3)
122
- ruby-debug-base19 (0.11.25)
123
- columnize (>= 0.3.1)
124
- linecache19 (>= 0.5.11)
125
- ruby_core_source (>= 0.1.4)
126
- ruby-debug19 (0.11.6)
127
- columnize (>= 0.3.1)
128
- linecache19 (>= 0.5.11)
129
- ruby-debug-base19 (>= 0.11.19)
130
151
  ruby-progressbar (1.5.1)
131
- ruby_core_source (0.1.5)
132
- archive-tar-minitar (>= 0.5.2)
133
152
  simple_uuid (0.4.0)
134
153
  sinatra (1.4.5)
135
154
  rack (~> 1.4)
@@ -151,6 +170,11 @@ GEM
151
170
  rack
152
171
  vegas (0.1.11)
153
172
  rack (>= 1.0.0)
173
+ virtus (1.0.2)
174
+ axiom-types (~> 0.1)
175
+ coercible (~> 1.0)
176
+ descendants_tracker (~> 0.0.3)
177
+ equalizer (~> 0.0.9)
154
178
 
155
179
  PLATFORMS
156
180
  ruby
@@ -162,7 +186,10 @@ DEPENDENCIES
162
186
  byebug
163
187
  cassandra
164
188
  dalli
189
+ debugger
190
+ grape
165
191
  memcache-client
192
+ memcached (= 1.7.2)
166
193
  minitest
167
194
  minitest-reporters
168
195
  mongo
@@ -176,5 +203,4 @@ DEPENDENCIES
176
203
  redis
177
204
  resque
178
205
  ruby-debug
179
- ruby-debug19
180
206
  sinatra
data/README.md CHANGED
@@ -5,7 +5,7 @@ The oboe gem provides AppNeta [TraceView](http://www.appneta.com/application-per
5
5
 
6
6
  ![Ruby TraceView](https://s3.amazonaws.com/pglombardo/oboe-ruby-header.png)
7
7
 
8
- It has the ability to report performance metrics on an array of libraries, databases and frameworks such as Rails, Mongo, Memcache, ActiveRecord, Cassandra, Rack, Resque [and more](https://support.tv.appneta.com/support/solutions/articles/86388-ruby-instrumentation-support-matrix).
8
+ It has the ability to report performance metrics on an array of libraries, databases and frameworks such as Rails, Mongo, Memcache, ActiveRecord, Cassandra, Rack, Resque [and more](https://support.appneta.com/cloud/ruby-instrumentation-release-notes)
9
9
 
10
10
  It requires a [TraceView](http://www.appneta.com/products/traceview/) account to view metrics. Get yours, [it's free](http://www.appneta.com/products/traceview-free-account/).
11
11
 
@@ -37,7 +37,7 @@ No special steps are needed to instrument Ruby on Rails. Once part of the bundl
37
37
 
38
38
  ### The Install Generator
39
39
 
40
- The oboe gem provides a Rails generator used to seed an oboe initializer where you can configure and control `tracing_mode`, `sample_rate` and [other options](https://support.tv.appneta.com/support/solutions/articles/86392-configuring-the-ruby-instrumentation).
40
+ The oboe gem provides a Rails generator used to seed an oboe initializer where you can configure and control `tracing_mode`, `sample_rate` and [other options](https://support.appneta.com/cloud/configuring-ruby-instrumentation)
41
41
 
42
42
  To run the install generator run:
43
43
 
@@ -99,6 +99,38 @@ end
99
99
 
100
100
  Note: If you're on Heroku, you don't need to set `tracing_mode` or `sample_rate` - they will be automatically configured.
101
101
 
102
+ ## Grape
103
+
104
+ You can instrument your Grape application by adding the following code to your `config.ru` Rackup file:
105
+
106
+ ```ruby
107
+ # If you're not using Bundler.require. Make sure this is done
108
+ # after the Grape require directive.
109
+ require 'oboe'
110
+
111
+ # When traces should be initiated for incoming requests. Valid options are
112
+ # "always", "through" (when the request is initiated with a tracing header
113
+ # from upstream) and "never". You must set this directive to "always" in
114
+ # order to initiate tracing.
115
+ Oboe::Config[:tracing_mode] = 'through'
116
+
117
+ # You can remove the following line in production to allow for
118
+ # auto sampling or managing the sample rate through the TraceView portal.
119
+ # Oboe::Config[:sample_rate] = 1000000
120
+
121
+ ...
122
+
123
+ class App < Grape::API
124
+ use Oboe::Rack
125
+ end
126
+ ```
127
+
128
+ Note: If you're on Heroku, you don't need to set `tracing_mode` or `sample_rate` - they will be automatically configured.
129
+
130
+ Make sure that the oboe gem is loaded _after_ Grape either by listing `gem 'oboe'` after Grape in your Gemfile or calling the `require 'oboe'` directive after Grape is loaded.
131
+
132
+ You must explicitly tell your Grape application to use Oboe::Rack for tracing to occur.
133
+
102
134
  ## Custom Ruby Scripts & Applications
103
135
 
104
136
  The oboe gem has the ability to instrument any arbitrary Ruby application or script as long as the gem is initialized with the manual methods:
@@ -124,7 +156,7 @@ From here, you can use the Tracing API to instrument areas of code using `Oboe::
124
156
 
125
157
  ## Other
126
158
 
127
- You can send deploy notifications to TraceView and have the events show up on your dashboard. See: [Capistrano Deploy Notifications with tlog](https://support.tv.appneta.com/support/solutions/articles/86389-capistrano-deploy-notifications-with-tlog).
159
+ You can send deploy notifications to TraceView and have the events show up on your dashboard. See: [Capistrano Deploy Notifications with tlog](https://support.appneta.com/cloud/capistrano-deploy-notifications-tlog)
128
160
 
129
161
  # Custom Tracing
130
162
 
@@ -179,11 +211,11 @@ class Engine
179
211
  end
180
212
  ```
181
213
 
182
- This example demonstrates method profiling of instance methods. Class methods are profiled slightly differently. See the TraceView [documentation portal](https://support.tv.appneta.com/support/solutions/articles/86395-ruby-instrumentation-public-api) for full details.
214
+ This example demonstrates method profiling of instance methods. Class methods are profiled slightly differently. See the TraceView [documentation portal](https://support.appneta.com/cloud/ruby-custom) for full details.
183
215
 
184
216
  # Support
185
217
 
186
- If you find a bug or would like to request an enhancement, feel free to file an issue. For all other support requests, see our [support portal](https://support.tv.appneta.com/) or on IRC @ #appneta on [Freenode](http://freenode.net/).
218
+ If you find a bug or would like to request an enhancement, feel free to file an issue. For all other support requests, see our [support portal](https://support.appneta.com/cloud) or on IRC @ #appneta on [Freenode](http://freenode.net/).
187
219
 
188
220
  # Contributing
189
221
 
@@ -325,7 +357,7 @@ ii liboboe-dev 1.1.1-precise1 Tracelytics common library -- development f
325
357
  ii liboboe0 1.1.1-precise1 Tracelytics common library
326
358
  ```
327
359
 
328
- See [Installing Base Packages on Debian and Ubuntu](https://support.tv.appneta.com/support/solutions/articles/86359-installing-base-packages-on-debian-and-ubuntu) in the Knowledge Base for details. Our hacker extraordinaire [Rob Salmond](https://github.com/rsalmond) from the support team has even gotten these packages to [run on Gentoo](http://www.appneta.com/blog/unsupported-doesnt-work/)!
360
+ See [Installing Base Packages on Debian and Ubuntu](https://support.appneta.com/cloud/installing-traceview) in the Knowledge Base for details. Our hacker extraordinaire [Rob Salmond](https://github.com/rsalmond) from the support team has even gotten these packages to [run on Gentoo](http://www.appneta.com/blog/unsupported-doesnt-work/)!
329
361
 
330
362
  To see the code related to the C extension, take a look at `ext/oboe_metal/extconf.rb` for details.
331
363
 
data/Rakefile CHANGED
@@ -36,7 +36,7 @@ task :compile do
36
36
  else
37
37
  Dir.chdir pwd
38
38
  puts "!! Extension failed to build (see above). Are the base TraceView packages installed?"
39
- puts "!! See https://support.tv.appneta.com/support/solutions/articles/86359"
39
+ puts "!! See https://support.appneta.com/cloud/installing-traceview"
40
40
  end
41
41
  end
42
42
 
@@ -47,10 +47,10 @@ task :clean do
47
47
  lib_dir = File.expand_path('lib')
48
48
  symlink = File.expand_path('lib/oboe_metal.so')
49
49
  so_file = File.expand_path('ext/oboe_metal/oboe_metal.so')
50
-
50
+
51
51
  Dir.chdir ext_dir
52
52
  sh '/usr/bin/env make clean'
53
-
53
+
54
54
  Dir.chdir pwd
55
55
  end
56
56
 
@@ -62,7 +62,7 @@ task :distclean do
62
62
  symlink = File.expand_path('lib/oboe_metal.so')
63
63
  so_file = File.expand_path('ext/oboe_metal/oboe_metal.so')
64
64
  mkmf_log = File.expand_path('ext/oboe_metal/mkmf.log')
65
-
65
+
66
66
  if File.exists? mkmf_log
67
67
  Dir.chdir ext_dir
68
68
  File.delete symlink if File.exist? symlink
data/lib/joboe_metal.rb CHANGED
@@ -85,7 +85,7 @@ module Oboe_metal
85
85
 
86
86
  # Only report __Init from here if we are not instrumenting a framework.
87
87
  # Otherwise, frameworks will handle reporting __Init after full initialization
88
- unless defined?(::Rails) or defined?(::Sinatra) or defined?(::Padrino)
88
+ unless defined?(::Rails) or defined?(::Sinatra) or defined?(::Padrino) or defined?(::Grape)
89
89
  Oboe::API.report_init
90
90
  end
91
91
 
data/lib/oboe.rb CHANGED
@@ -6,7 +6,7 @@ begin
6
6
  require 'oboe/logger'
7
7
  require 'oboe/util'
8
8
  require 'oboe/xtrace'
9
-
9
+
10
10
  # If Oboe_metal is already defined then we are in a PaaS environment
11
11
  # with an alternate metal (such as Heroku: see the oboe-heroku gem)
12
12
  unless defined?(Oboe_metal)
@@ -24,12 +24,12 @@ begin
24
24
  unless ENV['RAILS_GROUP'] == 'assets'
25
25
  $stderr.puts "=============================================================="
26
26
  $stderr.puts "Missing TraceView libraries. Tracing disabled."
27
- $stderr.puts "See: https://support.tv.appneta.com/solution/articles/137973"
27
+ $stderr.puts "See: https://support.tv.appneta.com/solution/articles/137973"
28
28
  $stderr.puts "=============================================================="
29
29
  end
30
30
  end
31
31
  end
32
-
32
+
33
33
  require 'oboe/config'
34
34
  require 'oboe/loading'
35
35
  require 'method_profiling'
@@ -41,6 +41,7 @@ begin
41
41
  require 'oboe/frameworks/rails' if defined?(::Rails)
42
42
  require 'oboe/frameworks/sinatra' if defined?(::Sinatra)
43
43
  require 'oboe/frameworks/padrino' if defined?(::Padrino)
44
+ require 'oboe/frameworks/grape' if defined?(::Grape)
44
45
  end
45
46
  rescue Exception => e
46
47
  $stderr.puts "[oboe/error] Problem loading: #{e.inspect}"
@@ -0,0 +1,74 @@
1
+ # Copyright (c) 2013 AppNeta, Inc.
2
+ # All rights reserved.
3
+
4
+ module Oboe
5
+ module Grape
6
+ module API
7
+ def self.extended(klass)
8
+ ::Oboe::Util.class_method_alias(klass, :inherited, ::Grape::API)
9
+ end
10
+
11
+ def inherited_with_oboe(subclass)
12
+ inherited_without_oboe(subclass)
13
+
14
+ subclass.use ::Oboe::Rack
15
+ end
16
+ end
17
+
18
+ module Endpoint
19
+ def self.included(klass)
20
+ ::Oboe::Util.method_alias(klass, :run, ::Grape::Endpoint)
21
+ end
22
+
23
+ def run_with_oboe(env)
24
+ if Oboe.tracing?
25
+ report_kvs = {}
26
+
27
+ report_kvs[:Controller] = self.class
28
+ report_kvs[:Action] = env['PATH_INFO']
29
+
30
+ # Fall back to the raw tracing API so we can pass KVs
31
+ # back on exit (a limitation of the Oboe::API.trace
32
+ # block method) This removes the need for an info
33
+ # event to send additonal KVs
34
+ ::Oboe::API.log_entry('grape', {})
35
+
36
+ begin
37
+ run_without_oboe(env)
38
+ ensure
39
+ ::Oboe::API.log_exit('grape', report_kvs)
40
+ end
41
+ else
42
+ run_without_oboe(env)
43
+ end
44
+ end
45
+ end
46
+
47
+ module Middleware
48
+ module Error
49
+ def self.included(klass)
50
+ ::Oboe::Util.method_alias(klass, :call, ::Grape::Middleware::Error)
51
+ end
52
+
53
+ def call_with_oboe(boom)
54
+ Oboe::API.log_exception(nil, boom) if Oboe.tracing?
55
+ call_without_oboe(boom)
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+
62
+ if defined?(::Grape)
63
+ require 'oboe/inst/rack'
64
+
65
+ Oboe.logger.info "[oboe/loading] Instrumenting Grape" if Oboe::Config[:verbose]
66
+
67
+ Oboe::Loading.load_access_key
68
+ Oboe::Inst.load_instrumentation
69
+
70
+ ::Oboe::Util.send_extend(::Grape::API, ::Oboe::Grape::API)
71
+ ::Oboe::Util.send_include(::Grape::Endpoint, ::Oboe::Grape::Endpoint)
72
+ ::Oboe::Util.send_include(::Grape::Middleware::Error, ::Oboe::Grape::Middleware::Error)
73
+ end
74
+
@@ -9,7 +9,9 @@ module Oboe
9
9
  end
10
10
 
11
11
  def render_with_oboe(engine, data=nil, options={}, locals={}, &block)
12
- if Oboe.tracing?
12
+ unless Oboe.tracing?
13
+ render_without_oboe(engine, data, options, locals, &block)
14
+ else
13
15
  report_kvs = {}
14
16
 
15
17
  if data
@@ -13,7 +13,7 @@ module Oboe
13
13
 
14
14
  # Operations for Mongo::Cursor
15
15
  CURSOR_OPS = [ :count ]
16
-
16
+
17
17
  # Operations for Mongo::Collection
18
18
  COLL_WRITE_OPS = [ :find_and_modify, :insert, :map_reduce, :remove, :rename, :update ]
19
19
  COLL_QUERY_OPS = [ :distinct, :find, :group ]
@@ -29,7 +29,7 @@ if defined?(::Mongo) and Oboe::Config[:mongo][:enabled]
29
29
  module ::Mongo
30
30
  class DB
31
31
  include Oboe::Inst::Mongo
32
-
32
+
33
33
  # Instrument DB operations
34
34
  Oboe::Inst::Mongo::DB_OPS.reject { |m| not method_defined?(m) }.each do |m|
35
35
  define_method("#{m}_with_oboe") do |*args|
@@ -50,7 +50,7 @@ if defined?(::Mongo) and Oboe::Config[:mongo][:enabled]
50
50
  report_kvs[:RemotePort] = @client.port
51
51
  end
52
52
 
53
- report_kvs[:QueryOp] = m
53
+ report_kvs[:QueryOp] = m
54
54
 
55
55
  report_kvs[:New_Collection_Name] = args[0] if m == :create_collection
56
56
  report_kvs[:Collection] = args[0] if m == :drop_collection
@@ -63,7 +63,7 @@ if defined?(::Mongo) and Oboe::Config[:mongo][:enabled]
63
63
  send("#{m}_without_oboe", *args)
64
64
  end
65
65
  end
66
-
66
+
67
67
  class_eval "alias #{m}_without_oboe #{m}"
68
68
  class_eval "alias #{m} #{m}_with_oboe"
69
69
  end
@@ -75,12 +75,12 @@ if defined?(::Mongo) and Oboe::Config[:mongo][:enabled]
75
75
  module ::Mongo
76
76
  class Cursor
77
77
  include Oboe::Inst::Mongo
78
-
78
+
79
79
  # Instrument DB cursor operations
80
80
  Oboe::Inst::Mongo::CURSOR_OPS.reject { |m| not method_defined?(m) }.each do |m|
81
81
  define_method("#{m}_with_oboe") do |*args|
82
82
  report_kvs = {}
83
-
83
+
84
84
  begin
85
85
  report_kvs[:Flavor] = Oboe::Inst::Mongo::FLAVOR
86
86
 
@@ -88,7 +88,7 @@ if defined?(::Mongo) and Oboe::Config[:mongo][:enabled]
88
88
  report_kvs[:RemoteHost] = @connection.host
89
89
  report_kvs[:RemotePort] = @connection.port
90
90
 
91
- report_kvs[:QueryOp] = m
91
+ report_kvs[:QueryOp] = m
92
92
  if m == :count
93
93
  unless @selector.empty?
94
94
  report_kvs[:Query] = @selector.to_json
@@ -99,12 +99,12 @@ if defined?(::Mongo) and Oboe::Config[:mongo][:enabled]
99
99
  end
100
100
  rescue
101
101
  end
102
-
102
+
103
103
  Oboe::API.trace('mongo', report_kvs) do
104
104
  send("#{m}_without_oboe", *args)
105
105
  end
106
106
  end
107
-
107
+
108
108
  class_eval "alias #{m}_without_oboe #{m}"
109
109
  class_eval "alias #{m} #{m}_with_oboe"
110
110
  end
@@ -126,30 +126,30 @@ if defined?(::Mongo) and Oboe::Config[:mongo][:enabled]
126
126
  report_kvs[:RemoteHost] = @db.connection.host
127
127
  report_kvs[:RemotePort] = @db.connection.port
128
128
  report_kvs[:Collection] = @name
129
-
129
+
130
130
  report_kvs[:Backtrace] = Oboe::API.backtrace if Oboe::Config[:mongo][:collect_backtraces]
131
131
 
132
- report_kvs[:QueryOp] = m
132
+ report_kvs[:QueryOp] = m
133
133
  report_kvs[:Query] = args[0].to_json if args and not args.empty? and args[0].class == Hash
134
134
  rescue
135
135
  Oboe.logger.debug "[oboe/debug] Exception in oboe_collect KV collection."
136
136
  end
137
137
  report_kvs
138
138
  end
139
-
139
+
140
140
  # Instrument Collection write operations
141
141
  Oboe::Inst::Mongo::COLL_WRITE_OPS.reject { |m| not method_defined?(m) }.each do |m|
142
142
  define_method("#{m}_with_oboe") do |*args|
143
143
  report_kvs = oboe_collect(m, args)
144
144
  args_length = args.length
145
-
145
+
146
146
  begin
147
147
  if m == :find_and_modify and args[0] and args[0].has_key?(:update)
148
148
  report_kvs[:Update_Document] = args[0][:update].inspect
149
149
  end
150
150
 
151
151
  if m == :map_reduce
152
- report_kvs[:Map_Function] = args[0]
152
+ report_kvs[:Map_Function] = args[0]
153
153
  report_kvs[:Reduce_Function] = args[1]
154
154
  report_kvs[:Limit] = args[2][:limit] if args[2] and args[2].has_key?(:limit)
155
155
  end
@@ -164,7 +164,7 @@ if defined?(::Mongo) and Oboe::Config[:mongo][:enabled]
164
164
  end
165
165
  rescue
166
166
  end
167
-
167
+
168
168
  Oboe::API.trace('mongo', report_kvs) do
169
169
  send("#{m}_without_oboe", *args)
170
170
  end
@@ -173,10 +173,10 @@ if defined?(::Mongo) and Oboe::Config[:mongo][:enabled]
173
173
  class_eval "alias #{m}_without_oboe #{m}"
174
174
  class_eval "alias #{m} #{m}_with_oboe"
175
175
  end
176
-
176
+
177
177
  # Instrument Collection query operations
178
178
  Oboe::Inst::Mongo::COLL_QUERY_OPS.reject { |m| not method_defined?(m) }.each do |m|
179
- define_method("#{m}_with_oboe") do |*args|
179
+ define_method("#{m}_with_oboe") do |*args, &blk|
180
180
  begin
181
181
  report_kvs = oboe_collect(m, args)
182
182
  args_length = args.length
@@ -192,11 +192,11 @@ if defined?(::Mongo) and Oboe::Config[:mongo][:enabled]
192
192
 
193
193
  if m == :group
194
194
  unless args.empty?
195
- if args[0].is_a?(Hash)
195
+ if args[0].is_a?(Hash)
196
196
  report_kvs[:Group_Key] = args[0][:key].to_json if args[0].has_key?(:key)
197
- report_kvs[:Group_Condition] = args[0][:cond].to_json if args[0].has_key?(:cond)
197
+ report_kvs[:Group_Condition] = args[0][:cond].to_json if args[0].has_key?(:cond)
198
198
  report_kvs[:Group_Initial] = args[0][:initial].to_json if args[0].has_key?(:initial)
199
- report_kvs[:Group_Reduce] = args[0][:reduce] if args[0].has_key?(:reduce)
199
+ report_kvs[:Group_Reduce] = args[0][:reduce] if args[0].has_key?(:reduce)
200
200
  end
201
201
  end
202
202
  end
@@ -204,20 +204,20 @@ if defined?(::Mongo) and Oboe::Config[:mongo][:enabled]
204
204
  end
205
205
 
206
206
  Oboe::API.trace('mongo', report_kvs) do
207
- send("#{m}_without_oboe", *args)
207
+ send("#{m}_without_oboe", *args, &blk)
208
208
  end
209
209
  end
210
210
 
211
211
  class_eval "alias #{m}_without_oboe #{m}"
212
212
  class_eval "alias #{m} #{m}_with_oboe"
213
213
  end
214
-
214
+
215
215
  # Instrument Collection index operations
216
216
  Oboe::Inst::Mongo::COLL_INDEX_OPS.reject { |m| not method_defined?(m) }.each do |m|
217
217
  define_method("#{m}_with_oboe") do |*args|
218
218
  report_kvs = oboe_collect(m, args)
219
219
  _args = args || []
220
-
220
+
221
221
  begin
222
222
  if [:create_index, :ensure_index, :drop_index].include? m and not _args.empty?
223
223
  report_kvs[:Index] = _args[0].to_json