traceview 3.7.0-java → 3.7.1-java

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: 552de0d2129dc5b8bf9ab4444fa86f1a5330b16b
4
- data.tar.gz: 93f8062358917531a2d86c5133400517cab44c76
3
+ metadata.gz: 2764ec8660cc08edd31bca1a668aac0d715a154d
4
+ data.tar.gz: 21ab2ecfac3fed66c9bf4676f64fa604428095ff
5
5
  SHA512:
6
- metadata.gz: 9e4bb7f59286be06b5ecb7d08767642ac840392b49697ade510f0d365a54f943b7473dbbd1a461e577126558110f9c88437feeca84f85922a84f1d0465a31706
7
- data.tar.gz: ca841ea2247b7c1d5b8bc40fe12b3e89191d3a11cf3d4a33892b17e9ae2a751af22e87f9ec1a52ee48f348c46ae2bf8cd6df02f6156ad741b4bca561f06eef85
6
+ metadata.gz: f9bae84566bf7c44ce85898db7acf37551822723f8b1a6db70a4dd2cb15867e8d763d68d818017ef473b318cfc35656bd26718ce7ba55d4e137a8d08a500c88e
7
+ data.tar.gz: 426cb37b7a29178ccad0464aa8460a3b9215ba8ba3e22f3c7e0e2ad114115ff088a70a92a827c6eec08077faaa80e7466390dd518e86aff361e6efcbcf70a999
data/CHANGELOG.md CHANGED
@@ -4,6 +4,17 @@ https://github.com/appneta/oboe-ruby/releases
4
4
 
5
5
  Dates in this file are in the format MM/DD/YYYY.
6
6
 
7
+ # traceview 3.7.1
8
+
9
+ This patch release includes the following fixes:
10
+
11
+ * Updated Mongo instrumentation to support v2+: #164
12
+
13
+ Pushed to Rubygems:
14
+
15
+ https://rubygems.org/gems/traceview/versions/3.7.1
16
+ https://rubygems.org/gems/traceview/versions/3.7.1-java
17
+
7
18
  # traceview 3.7.0
8
19
 
9
20
  This minor release includes the following new feature:
@@ -10,6 +10,11 @@ group :development, :test do
10
10
  gem 'bson', '< 4.0'
11
11
  end
12
12
 
13
+ # New mime-types/mime-types-data requires ruby 2.0
14
+ if RUBY_VERSION < '2.0'
15
+ gem 'mime-types', '< 3.0'
16
+ end
17
+
13
18
  if defined?(JRUBY_VERSION)
14
19
  gem 'sinatra', :require => false
15
20
  gem 'activerecord-jdbc-adapter'
@@ -14,6 +14,11 @@ group :development, :test do
14
14
  end
15
15
  end
16
16
 
17
+ # New mime-types/mime-types-data requires ruby 2.0
18
+ if RUBY_VERSION < '2.0'
19
+ gem 'mime-types', '< 3.0'
20
+ end
21
+
17
22
  if defined?(JRUBY_VERSION)
18
23
  gem 'sinatra', :require => false
19
24
  else
@@ -17,11 +17,11 @@ group :development, :test do
17
17
  gem 'rack-test'
18
18
  if RUBY_VERSION < '1.9.3'
19
19
  gem 'rake', '< 11.0'
20
- gem 'bson', '<= 1.12.3'
20
+ gem 'bson', '<= 1.12.5'
21
21
  gem 'puma', '< 3.0'
22
22
  else
23
23
  gem 'rake'
24
- gem 'bson', '< 4.0'
24
+ gem 'bson', '~> 3.0'
25
25
  gem 'puma', '< 3.1.0'
26
26
  end
27
27
  end
@@ -38,6 +38,12 @@ else
38
38
  gem 'bunny'
39
39
  end
40
40
 
41
+ if RUBY_VERSION < '1.9.3'
42
+ gem 'mongo', '1.12.5'
43
+ else
44
+ gem 'mongo', '2.0.6'
45
+ end
46
+
41
47
  gem 'cassandra'
42
48
  gem 'curb' unless defined?(JRUBY_VERSION)
43
49
  gem 'dalli' if RUBY_VERSION > '1.8.7'
@@ -45,14 +51,12 @@ gem 'excon'
45
51
  gem 'faraday'
46
52
  gem 'httpclient'
47
53
  gem 'memcache-client'
48
- gem 'mongo'
49
54
  gem 'redis'
50
55
  gem 'resque' unless defined?(JRUBY_VERSION) && RUBY_VERSION > '1.9.3'
51
56
  gem 'sequel'
52
57
  gem "sidekiq" if RUBY_VERSION >= '2.0'
53
58
  gem 'typhoeus'
54
59
 
55
-
56
60
  # Database adapter gems needed by sequel
57
61
  if defined?(JRUBY_VERSION)
58
62
  gem 'jdbc-postgresql'
@@ -69,7 +73,6 @@ end
69
73
 
70
74
  unless defined?(JRUBY_VERSION)
71
75
  gem 'memcached', '1.7.2' if RUBY_VERSION < '2.0.0'
72
- gem 'bson_ext' # For Mongo, Yours Truly
73
76
  end
74
77
 
75
78
  gemspec :path => File.expand_path(File.dirname(__FILE__) + '/../')
@@ -20,7 +20,7 @@ group :development, :test do
20
20
  gem 'rack-test'
21
21
  if RUBY_VERSION < '1.9.3'
22
22
  gem 'rake', '< 11.0'
23
- gem 'bson', '<= 1.12.3'
23
+ gem 'bson', '<= 1.12.5'
24
24
  gem 'puma', '< 3.0'
25
25
  else
26
26
  gem 'rake'
@@ -10,6 +10,11 @@ group :development, :test do
10
10
  gem 'bson', '< 4.0'
11
11
  end
12
12
 
13
+ # New mime-types/mime-types-data requires ruby 2.0
14
+ if RUBY_VERSION < '2.0'
15
+ gem 'mime-types', '< 3.0'
16
+ end
17
+
13
18
  if defined?(JRUBY_VERSION)
14
19
  gem 'sinatra', :require => false
15
20
  gem 'activerecord-jdbc-adapter'
data/lib/oboe_metal.rb CHANGED
@@ -72,15 +72,28 @@ module TraceView
72
72
 
73
73
  return contents if contents.empty?
74
74
 
75
- s = StringIO.new(contents[0])
76
-
77
75
  traces = []
78
76
 
79
- until s.eof?
80
- if ::BSON.respond_to? :read_bson_document
81
- traces << BSON.read_bson_document(s)
82
- else
83
- traces << BSON::Document.from_bson(s)
77
+ #
78
+ # We use Gem.loaded_spec because older versions of the bson
79
+ # gem didn't even have a version embedded in the gem. If the
80
+ # gem isn't in the bundle, it should rightfully error out
81
+ # anyways.
82
+ #
83
+ if Gem.loaded_specs['bson'].version.to_s < '4.0'
84
+ s = StringIO.new(contents[0])
85
+
86
+ until s.eof?
87
+ if ::BSON.respond_to? :read_bson_document
88
+ traces << BSON.read_bson_document(s)
89
+ else
90
+ traces << BSON::Document.from_bson(s)
91
+ end
92
+ end
93
+ else
94
+ bbb = BSON::ByteBuffer.new(contents[0])
95
+ until bbb.length == 0
96
+ traces << Hash.from_bson(bbb)
84
97
  end
85
98
  end
86
99
 
@@ -22,7 +22,7 @@ module TraceView
22
22
  end
23
23
  end
24
24
 
25
- if defined?(::Mongo) && TraceView::Config[:mongo][:enabled]
25
+ if defined?(::Mongo) && (Gem.loaded_specs['mongo'].version.to_s < '2.0.0') && TraceView::Config[:mongo][:enabled]
26
26
  TraceView.logger.info '[traceview/loading] Instrumenting mongo' if TraceView::Config[:verbose]
27
27
 
28
28
  if defined?(::Mongo::DB)
@@ -0,0 +1,226 @@
1
+ # Copyright (c) 2013 AppNeta, Inc.
2
+ # All rights reserved.
3
+
4
+ require 'json'
5
+
6
+ if RUBY_VERSION >= '1.9' && TraceView::Config[:mongo][:enabled]
7
+ if defined?(::Mongo) && (Gem.loaded_specs['mongo'].version.to_s >= '2.0.0')
8
+ ::TraceView.logger.info '[traceview/loading] Instrumenting mongo' if TraceView::Config[:verbose]
9
+
10
+
11
+ # Collection Related Operations
12
+ COLL_OTHER_OPS = [:create, :drop, :insert_one, :insert_many, :bulk_write, :map_reduce]
13
+
14
+ # Mongo 2.2 only ops
15
+ if Mongo::VERSION >= '2.1'
16
+ COLL_QUERY_OPS = [ :find, :find_one_and_delete, :find_one_and_update, :find_one_and_replace, :update_one, :update_many, :delete_one, :delete_many, :replace_one ]
17
+ else
18
+ COLL_QUERY_OPS = [ :find, :update_many, :delete_one ]
19
+ end
20
+
21
+ COLL_OPS = COLL_QUERY_OPS + COLL_OTHER_OPS
22
+
23
+ module Mongo
24
+ class Collection
25
+ ##
26
+ # collect_kvs
27
+ #
28
+ # Used to collect up information to report and build a hash
29
+ # with the Keys/Values to report.
30
+ #
31
+ def collect_kvs(op, args)
32
+ kvs = { :Flavor => :mongodb, :Database => @database.name }
33
+
34
+ kvs[:QueryOp] = op
35
+
36
+ if op == :create
37
+ kvs[:New_Collection_Name] = @name
38
+ else
39
+ kvs[:Collection] = @name
40
+ end
41
+
42
+ if op == :map_reduce
43
+ kvs[:Map_Function] = args[0]
44
+ kvs[:Reduce_Function] = args[1]
45
+ kvs[:Limit] = args[2][:limit] if args[2].is_a?(Hash) && args[2].key?(:limit)
46
+ end
47
+
48
+ if TraceView::Config[:mongo][:log_args]
49
+ if COLL_QUERY_OPS.include?(op)
50
+ kvs[:Query] = args.first.to_json
51
+ end
52
+ end
53
+
54
+ kvs[:RemoteHost] = @database.client.cluster.addresses.first.to_s
55
+ kvs[:Backtrace] = TraceView::API.backtrace if TraceView::Config[:mongo][:collect_backtraces]
56
+ rescue => e
57
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
58
+ ensure
59
+ return kvs
60
+ end
61
+
62
+ ##
63
+ # Here we dynamically define wrapper methods for the operations
64
+ # we want to instrument in mongo
65
+ #
66
+ COLL_OPS.reject { |m| !method_defined?(m) }.each do |m|
67
+ define_method("#{m}_with_traceview") do |*args|
68
+ begin
69
+ if !TraceView.tracing? || TraceView.tracing_layer?(:mongo)
70
+ mongo_skipped = true
71
+ return send("#{m}_without_traceview", *args)
72
+ end
73
+
74
+ kvs = collect_kvs(m, args)
75
+ TraceView::API.log_entry(:mongo, kvs)
76
+
77
+ send("#{m}_without_traceview", *args)
78
+ rescue => e
79
+ TraceView::API.log_exception(:mongo, e)
80
+ raise e
81
+ ensure
82
+ TraceView::API.log_exit(:mongo) unless mongo_skipped
83
+ end
84
+ end
85
+ ::TraceView::Util.method_alias(Mongo::Collection, m)
86
+ end
87
+ end
88
+ end
89
+
90
+ ##
91
+ # Mongo Collection View Instrumentation
92
+ #
93
+
94
+ # Collection View Related Operations
95
+ VIEW_QUERY_OPS = [ :delete_one, :delete_many, :count, :distinct, :find_one_and_delete, :find_one_and_update,
96
+ :replace_one, :update_one, :update_many ]
97
+ VIEW_OTHER_OPS = [ :aggregate, :map_reduce ]
98
+ VIEW_OPS = VIEW_QUERY_OPS + VIEW_OTHER_OPS
99
+
100
+ module Mongo
101
+ class Collection
102
+ class View
103
+ ##
104
+ # collect_kvs
105
+ #
106
+ # Used to collect up information to report and build a hash
107
+ # with the Keys/Values to report.
108
+ #
109
+ def collect_kvs(op, args)
110
+ kvs = { :Flavor => :mongodb, :Database => @collection.database.name }
111
+
112
+ kvs[:QueryOp] = op
113
+ kvs[:Collection] = @collection.name
114
+
115
+ if op == :map_reduce
116
+ kvs[:Map_Function] = args[0]
117
+ kvs[:Reduce_Function] = args[1]
118
+ kvs[:Limit] = args[2][:limit] if args[2].is_a?(Hash) && args[2].key?(:limit)
119
+ end
120
+
121
+ if TraceView::Config[:mongo][:log_args]
122
+ if VIEW_QUERY_OPS.include?(op)
123
+ if defined?(filter)
124
+ kvs[:Query] = filter.to_json
125
+ elsif defined?(selector)
126
+ kvs[:Query] = selector.to_json
127
+ end
128
+ end
129
+ end
130
+
131
+ kvs[:RemoteHost] = @collection.database.client.cluster.addresses.first.to_s
132
+ kvs[:Backtrace] = TraceView::API.backtrace if TraceView::Config[:mongo][:collect_backtraces]
133
+ rescue => e
134
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
135
+ ensure
136
+ return kvs
137
+ end
138
+
139
+ ##
140
+ # Here we dynamically define wrapper methods for the operations
141
+ # we want to instrument in mongo
142
+ #
143
+ VIEW_OPS.reject { |m| !method_defined?(m) }.each do |m|
144
+ define_method("#{m}_with_traceview") do |*args|
145
+ begin
146
+ if !TraceView.tracing? || TraceView.tracing_layer?(:mongo)
147
+ mongo_skipped = true
148
+ return send("#{m}_without_traceview", *args)
149
+ end
150
+
151
+ kvs = collect_kvs(m, args)
152
+ TraceView::API.log_entry(:mongo, kvs)
153
+
154
+ send("#{m}_without_traceview", *args)
155
+ rescue => e
156
+ TraceView::API.log_exception(:mongo, e)
157
+ raise e
158
+ ensure
159
+ TraceView::API.log_exit(:mongo) unless mongo_skipped
160
+ end
161
+ end
162
+ ::TraceView::Util.method_alias(Mongo::Collection::View, m)
163
+ end
164
+ end
165
+ end
166
+ end
167
+
168
+ ##
169
+ # Mongo Collection Index View Instrumentation
170
+ #
171
+
172
+ # Collection Index View Related Operations
173
+ INDEX_OPS = [ :create_one, :create_many, :drop_one, :drop_all ]
174
+
175
+ module Mongo
176
+ module Index
177
+ class View
178
+ ##
179
+ # collect_kvs
180
+ #
181
+ # Used to collect up information to report and build a hash
182
+ # with the Keys/Values to report.
183
+ #
184
+ def collect_index_kvs(op, args)
185
+ kvs = { :Flavor => :mongodb, :Database => @collection.database.name }
186
+
187
+ kvs[:QueryOp] = op
188
+ kvs[:Collection] = @collection.name
189
+ kvs[:RemoteHost] = @collection.database.client.cluster.addresses.first.to_s
190
+ kvs[:Backtrace] = TraceView::API.backtrace if TraceView::Config[:mongo][:collect_backtraces]
191
+ rescue => e
192
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
193
+ ensure
194
+ return kvs
195
+ end
196
+
197
+ ##
198
+ # Here we dynamically define wrapper methods for the operations
199
+ # we want to instrument in mongo
200
+ #
201
+ INDEX_OPS.reject { |m| !method_defined?(m) }.each do |m|
202
+ define_method("#{m}_with_traceview") do |*args|
203
+ begin
204
+ if !TraceView.tracing? || TraceView.tracing_layer?(:mongo)
205
+ mongo_skipped = true
206
+ return send("#{m}_without_traceview", *args)
207
+ end
208
+
209
+ kvs = collect_index_kvs(m, args)
210
+ TraceView::API.log_entry(:mongo, kvs)
211
+
212
+ send("#{m}_without_traceview", *args)
213
+ rescue => e
214
+ TraceView::API.log_exception(:mongo, e)
215
+ raise e
216
+ ensure
217
+ TraceView::API.log_exit(:mongo) unless mongo_skipped
218
+ end
219
+ end
220
+ ::TraceView::Util.method_alias(Mongo::Index::View, m)
221
+ end
222
+ end
223
+ end
224
+ end
225
+ end
226
+ end
@@ -37,17 +37,17 @@ if defined?(::Moped) && TraceView::Config[:moped][:enabled]
37
37
  begin
38
38
  report_kvs[:Flavor] = TraceView::Inst::Moped::FLAVOR
39
39
  # FIXME: We're only grabbing the first of potentially multiple servers here
40
+ first = session.cluster.seeds.first
40
41
  if ::Moped::VERSION < '2.0.0'
41
- report_kvs[:RemoteHost], report_kvs[:RemotePort] = session.cluster.seeds.first.split(':')
42
+ report_kvs[:RemoteHost] = first
42
43
  else
43
- report_kvs[:RemoteHost] = session.cluster.seeds.first.address.host
44
- report_kvs[:RemotePort] = session.cluster.seeds.first.address.port
44
+ report_kvs[:RemoteHost] = "#{first.address.host}:#{first.address.port}"
45
45
  end
46
46
  report_kvs[:Database] = name
47
47
  report_kvs[:QueryOp] = op.to_s
48
48
  report_kvs[:Backtrace] = TraceView::API.backtrace if TraceView::Config[:moped][:collect_backtraces]
49
49
  rescue StandardError => e
50
- TraceView.logger.debug "[traceview/debug] Moped KV collection error: #{e.inspect}"
50
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
51
51
  end
52
52
  report_kvs
53
53
  end
@@ -59,7 +59,7 @@ if defined?(::Moped) && TraceView::Config[:moped][:enabled]
59
59
  report_kvs[:Map_Function] = command[:map]
60
60
  report_kvs[:Reduce_Function] = command[:reduce]
61
61
  rescue => e
62
- TraceView.logger.debug "[traceview/debug] Moped KV collection error: #{e.inspect}"
62
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
63
63
  end
64
64
 
65
65
  TraceView::API.trace('mongo', report_kvs) do
@@ -100,18 +100,19 @@ if defined?(::Moped) && TraceView::Config[:moped][:enabled]
100
100
  report_kvs = {}
101
101
  begin
102
102
  report_kvs[:Flavor] = TraceView::Inst::Moped::FLAVOR
103
+
103
104
  # FIXME: We're only grabbing the first of potentially multiple servers here
105
+ first = database.session.cluster.seeds.first
104
106
  if ::Moped::VERSION < '2.0.0'
105
- report_kvs[:RemoteHost], report_kvs[:RemotePort] = database.session.cluster.seeds.first.split(':')
107
+ report_kvs[:RemoteHost] = first
106
108
  else
107
- report_kvs[:RemoteHost] = database.session.cluster.seeds.first.address.host
108
- report_kvs[:RemotePort] = database.session.cluster.seeds.first.address.port
109
+ report_kvs[:RemoteHost] = "#{first.address.host}:#{first.address.port}"
109
110
  end
110
111
  report_kvs[:Database] = database.name
111
112
  report_kvs[:QueryOp] = op.to_s
112
113
  report_kvs[:Backtrace] = TraceView::API.backtrace if TraceView::Config[:moped][:collect_backtraces]
113
114
  rescue StandardError => e
114
- TraceView.logger.debug "[traceview/debug] Moped KV collection error: #{e.inspect}"
115
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
115
116
  end
116
117
  report_kvs
117
118
  end
@@ -126,7 +127,7 @@ if defined?(::Moped) && TraceView::Config[:moped][:enabled]
126
127
  report_kvs[:Key] = key.to_json
127
128
  report_kvs[:Options] = options.to_json
128
129
  rescue StandardError => e
129
- TraceView.logger.debug "[traceview/debug] Moped KV collection error: #{e.inspect}"
130
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
130
131
  end
131
132
 
132
133
  TraceView::API.trace('mongo', report_kvs, :create_index) do
@@ -143,7 +144,7 @@ if defined?(::Moped) && TraceView::Config[:moped][:enabled]
143
144
  report_kvs = extract_trace_details(:drop_indexes)
144
145
  report_kvs[:Key] = key.nil? ? 'all' : key.to_json
145
146
  rescue StandardError => e
146
- TraceView.logger.debug "[traceview/debug] Moped KV collection error: #{e.inspect}"
147
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
147
148
  end
148
149
 
149
150
  TraceView::API.trace('mongo', report_kvs) do
@@ -172,18 +173,18 @@ if defined?(::Moped) && TraceView::Config[:moped][:enabled]
172
173
  begin
173
174
  report_kvs[:Flavor] = TraceView::Inst::Moped::FLAVOR
174
175
  # FIXME: We're only grabbing the first of potentially multiple servers here
176
+ first = collection.database.session.cluster.seeds.first
175
177
  if ::Moped::VERSION < '2.0.0'
176
- report_kvs[:RemoteHost], report_kvs[:RemotePort] = collection.database.session.cluster.seeds.first.split(':')
178
+ report_kvs[:RemoteHost] = first
177
179
  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
+ report_kvs[:RemoteHost] = "#{first.address.host}:#{first.address.port}"
180
181
  end
181
182
  report_kvs[:Database] = collection.database.name
182
183
  report_kvs[:Collection] = collection.name
183
184
  report_kvs[:QueryOp] = op.to_s
184
185
  report_kvs[:Backtrace] = TraceView::API.backtrace if TraceView::Config[:moped][:collect_backtraces]
185
186
  rescue StandardError => e
186
- TraceView.logger.debug "[traceview/debug] Moped KV collection error: #{e.inspect}"
187
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
187
188
  end
188
189
  report_kvs
189
190
  end
@@ -195,7 +196,7 @@ if defined?(::Moped) && TraceView::Config[:moped][:enabled]
195
196
  report_kvs = extract_trace_details(:count)
196
197
  report_kvs[:Query] = selector.empty? ? 'all' : selector.to_json
197
198
  rescue StandardError => e
198
- TraceView.logger.debug "[traceview/debug] Moped KV collection error: #{e.inspect}"
199
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
199
200
  end
200
201
 
201
202
  TraceView::API.trace('mongo', report_kvs) do
@@ -211,7 +212,7 @@ if defined?(::Moped) && TraceView::Config[:moped][:enabled]
211
212
  report_kvs[:Query] = selector.empty? ? 'all' : selector.to_json
212
213
  report_kvs[:Order] = sort.to_s
213
214
  rescue StandardError => e
214
- TraceView.logger.debug "[traceview/debug] Moped KV collection error: #{e.inspect}"
215
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
215
216
  end
216
217
 
217
218
  TraceView::API.trace('mongo', report_kvs) do
@@ -226,7 +227,7 @@ if defined?(::Moped) && TraceView::Config[:moped][:enabled]
226
227
  report_kvs[:Query] = selector.empty? ? 'all' : selector.to_json
227
228
  report_kvs[:Limit] = limit.to_s
228
229
  rescue StandardError => e
229
- TraceView.logger.debug "[traceview/debug] Moped KV collection error: #{e.inspect}"
230
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
230
231
  end
231
232
 
232
233
  TraceView::API.trace('mongo', report_kvs) do
@@ -245,7 +246,7 @@ if defined?(::Moped) && TraceView::Config[:moped][:enabled]
245
246
  report_kvs[:Query] = selector.empty? ? 'all' : selector.to_json
246
247
  report_kvs[:Key] = key.to_s
247
248
  rescue StandardError => e
248
- TraceView.logger.debug "[traceview/debug] Moped KV collection error: #{e.inspect}"
249
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
249
250
  end
250
251
 
251
252
  TraceView::API.trace('mongo', report_kvs) do
@@ -260,7 +261,7 @@ if defined?(::Moped) && TraceView::Config[:moped][:enabled]
260
261
  report_kvs[:Flags] = flags.to_s if flags
261
262
  report_kvs[:Update_Document] = change.to_json
262
263
  rescue StandardError => e
263
- TraceView.logger.debug "[traceview/debug] Moped KV collection error: #{e.inspect}"
264
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
264
265
  end
265
266
 
266
267
  TraceView::API.trace('mongo', report_kvs) do
@@ -278,7 +279,7 @@ if defined?(::Moped) && TraceView::Config[:moped][:enabled]
278
279
  report_kvs = extract_trace_details(:update_all)
279
280
  report_kvs[:Update_Document] = change.to_json
280
281
  rescue StandardError => e
281
- TraceView.logger.debug "[traceview/debug] Moped KV collection error: #{e.inspect}"
282
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
282
283
  end
283
284
 
284
285
  TraceView::API.trace('mongo', report_kvs, :update_all) do
@@ -294,7 +295,7 @@ if defined?(::Moped) && TraceView::Config[:moped][:enabled]
294
295
  report_kvs[:Query] = selector.to_json
295
296
  report_kvs[:Update_Document] = change.to_json
296
297
  rescue StandardError => e
297
- TraceView.logger.debug "[traceview/debug] Moped KV collection error: #{e.inspect}"
298
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
298
299
  end
299
300
 
300
301
  TraceView::API.trace('mongo', report_kvs, :upsert) do
@@ -309,7 +310,7 @@ if defined?(::Moped) && TraceView::Config[:moped][:enabled]
309
310
  report_kvs = extract_trace_details(:explain)
310
311
  report_kvs[:Query] = selector.empty? ? 'all' : selector.to_json
311
312
  rescue StandardError => e
312
- TraceView.logger.debug "[traceview/debug] Moped KV collection error: #{e.inspect}"
313
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
313
314
  end
314
315
 
315
316
  TraceView::API.trace('mongo', report_kvs, :explain) do
@@ -326,7 +327,7 @@ if defined?(::Moped) && TraceView::Config[:moped][:enabled]
326
327
  report_kvs[:Change] = change.to_json
327
328
  report_kvs[:Options] = options.to_json
328
329
  rescue StandardError => e
329
- TraceView.logger.debug "[traceview/debug] Moped KV collection error: #{e.inspect}"
330
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
330
331
  end
331
332
 
332
333
  TraceView::API.trace('mongo', report_kvs) do
@@ -341,7 +342,7 @@ if defined?(::Moped) && TraceView::Config[:moped][:enabled]
341
342
  report_kvs = extract_trace_details(:remove)
342
343
  report_kvs[:Query] = selector.to_json
343
344
  rescue StandardError => e
344
- TraceView.logger.debug "[traceview/debug] Moped KV collection error: #{e.inspect}"
345
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
345
346
  end
346
347
 
347
348
  TraceView::API.trace('mongo', report_kvs) do
@@ -356,7 +357,7 @@ if defined?(::Moped) && TraceView::Config[:moped][:enabled]
356
357
  report_kvs = extract_trace_details(:remove_all)
357
358
  report_kvs[:Query] = selector.to_json
358
359
  rescue StandardError => e
359
- TraceView.logger.debug "[traceview/debug] Moped KV collection error: #{e.inspect}"
360
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
360
361
  end
361
362
 
362
363
  TraceView::API.trace('mongo', report_kvs) do
@@ -385,18 +386,18 @@ if defined?(::Moped) && TraceView::Config[:moped][:enabled]
385
386
  begin
386
387
  report_kvs[:Flavor] = TraceView::Inst::Moped::FLAVOR
387
388
  # FIXME: We're only grabbing the first of potentially multiple servers here
389
+ first = database.session.cluster.seeds.first
388
390
  if ::Moped::VERSION < '2.0.0'
389
- report_kvs[:RemoteHost], report_kvs[:RemotePort] = database.session.cluster.seeds.first.split(':')
391
+ report_kvs[:RemoteHost] = first
390
392
  else
391
- report_kvs[:RemoteHost] = database.session.cluster.seeds.first.address.host
392
- report_kvs[:RemotePort] = database.session.cluster.seeds.first.address.port
393
+ report_kvs[:RemoteHost] = "#{first.address.host}:#{first.address.port}"
393
394
  end
394
395
  report_kvs[:Database] = database.name
395
396
  report_kvs[:Collection] = name
396
397
  report_kvs[:QueryOp] = op.to_s
397
398
  report_kvs[:Backtrace] = TraceView::API.backtrace if TraceView::Config[:moped][:collect_backtraces]
398
399
  rescue StandardError => e
399
- TraceView.logger.debug "[traceview/debug] Moped KV collection error: #{e.inspect}"
400
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
400
401
  end
401
402
  report_kvs
402
403
  end
@@ -420,7 +421,7 @@ if defined?(::Moped) && TraceView::Config[:moped][:enabled]
420
421
  report_kvs = extract_trace_details(:find)
421
422
  report_kvs[:Query] = selector.empty? ? 'all' : selector.to_json
422
423
  rescue StandardError => e
423
- TraceView.logger.debug "[traceview/debug] Moped KV collection error: #{e.inspect}"
424
+ TraceView.logger.debug "[traceview/debug] #{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}" if TraceView::Config[:verbose]
424
425
  end
425
426
 
426
427
  TraceView::API.trace('mongo', report_kvs) do
@@ -8,7 +8,7 @@ module TraceView
8
8
  module Version
9
9
  MAJOR = 3
10
10
  MINOR = 7
11
- PATCH = 0
11
+ PATCH = 1
12
12
  BUILD = nil
13
13
 
14
14
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
@@ -8,6 +8,7 @@ if defined?(::Rails)
8
8
  describe "Rails3x" do
9
9
  before do
10
10
  clear_all_traces
11
+ ENV['DBTYPE'] = "postgresql" unless ENV['DBTYPE']
11
12
  end
12
13
 
13
14
  it "should trace a request to a rails stack" do