oboe 2.3.2 → 2.3.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +26 -0
- data/CHANGELOG +28 -2
- data/Gemfile +2 -2
- data/README.md +4 -4
- data/Rakefile +18 -7
- data/lib/base.rb +58 -0
- data/lib/joboe_metal.rb +45 -62
- data/lib/method_profiling.rb +50 -57
- data/lib/oboe.rb +17 -12
- data/lib/oboe/api/util.rb +46 -0
- data/lib/oboe/config.rb +3 -14
- data/lib/oboe/inst/cassandra.rb +1 -1
- data/lib/oboe/inst/mongo.rb +1 -1
- data/lib/oboe/inst/rack.rb +16 -11
- data/lib/oboe/inst/resque.rb +5 -5
- data/lib/oboe/version.rb +2 -2
- data/lib/oboe_metal.rb +43 -36
- data/test/instrumentation/cassandra_test.rb +79 -33
- data/test/instrumentation/mongo_test.rb +10 -2
- data/test/instrumentation/moped_test.rb +429 -424
- data/test/minitest_helper.rb +5 -5
- data/test/profiling/method_test.rb +198 -0
- metadata +70 -84
@@ -6,6 +6,9 @@ describe Oboe::Inst::Mongo do
|
|
6
6
|
@connection = Mongo::Connection.new("localhost", 27017, :slave_ok => true)
|
7
7
|
@db = @connection.db("test-#{ENV['RACK_ENV']}")
|
8
8
|
|
9
|
+
@collections = @db.collection_names
|
10
|
+
@db.create_collection("testCollection") unless @collections.include? "testCollection"
|
11
|
+
|
9
12
|
# These are standard entry/exit KVs that are passed up with all mongo operations
|
10
13
|
@entry_kvs = {
|
11
14
|
'Layer' => 'mongo',
|
@@ -67,6 +70,9 @@ describe Oboe::Inst::Mongo do
|
|
67
70
|
end
|
68
71
|
|
69
72
|
it "should trace drop_collection" do
|
73
|
+
# Create a collection so we have one to drop
|
74
|
+
@db.create_collection("create_and_drop_collection_test")
|
75
|
+
|
70
76
|
Oboe::API.start_trace('mongo_test', '', {}) do
|
71
77
|
@db.drop_collection("create_and_drop_collection_test")
|
72
78
|
end
|
@@ -138,7 +144,8 @@ describe Oboe::Inst::Mongo do
|
|
138
144
|
traces[1]['Collection'].must_equal "testCollection"
|
139
145
|
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:mongo][:collect_backtraces]
|
140
146
|
traces[1]['QueryOp'].must_equal "insert"
|
141
|
-
|
147
|
+
# Don't test exact hash value since to_json hash ordering varies between 1.8.7 and 1.9+
|
148
|
+
traces[1].has_key?('Query').must_equal true
|
142
149
|
end
|
143
150
|
|
144
151
|
it "should trace map_reduce" do
|
@@ -300,7 +307,8 @@ describe Oboe::Inst::Mongo do
|
|
300
307
|
traces[1]['Collection'].must_equal "testCollection"
|
301
308
|
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:mongo][:collect_backtraces]
|
302
309
|
traces[1]['QueryOp'].must_equal "group"
|
303
|
-
|
310
|
+
# Don't test exact hash value since to_json hash ordering varies between 1.8.7 and 1.9+
|
311
|
+
traces[1].has_key?('Query').must_equal true
|
304
312
|
end
|
305
313
|
|
306
314
|
it "should trace create, ensure and drop index" do
|
@@ -1,468 +1,473 @@
|
|
1
1
|
require 'minitest_helper'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
Oboe::Config[:moped][:collect_backtraces] = @collect_backtraces
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'Stock Moped should be loaded, defined and ready' do
|
29
|
-
defined?(::Moped).wont_match nil
|
30
|
-
defined?(::Moped::Database).wont_match nil
|
31
|
-
defined?(::Moped::Indexes).wont_match nil
|
32
|
-
defined?(::Moped::Query).wont_match nil
|
33
|
-
defined?(::Moped::Collection).wont_match nil
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'Moped should have oboe methods defined' do
|
37
|
-
#::Moped::Database
|
38
|
-
Oboe::Inst::Moped::DB_OPS.each do |m|
|
39
|
-
::Moped::Database.method_defined?("#{m}_with_oboe").must_equal true
|
3
|
+
if (RUBY_VERSION =~ /(^1.9.3|^2)/) == 0
|
4
|
+
# Moped is tested against MRI 1.9.3, 2.0.0, and JRuby (1.9).
|
5
|
+
|
6
|
+
describe Oboe::Inst::Moped do
|
7
|
+
before do
|
8
|
+
clear_all_traces
|
9
|
+
@session = Moped::Session.new([ "127.0.0.1:27017" ])
|
10
|
+
@session.use :moped_test
|
11
|
+
@users = @session[:users]
|
12
|
+
@users.insert({ :name => "Syd", :city => "Boston" })
|
13
|
+
|
14
|
+
# These are standard entry/exit KVs that are passed up with all moped operations
|
15
|
+
@entry_kvs = {
|
16
|
+
'Layer' => 'mongo',
|
17
|
+
'Label' => 'entry',
|
18
|
+
'Flavor' => 'mongodb',
|
19
|
+
'Database' => 'moped_test',
|
20
|
+
'RemoteHost' => '127.0.0.1',
|
21
|
+
'RemotePort' => '27017' }
|
22
|
+
|
23
|
+
@exit_kvs = { 'Layer' => 'mongo', 'Label' => 'exit' }
|
24
|
+
@collect_backtraces = Oboe::Config[:moped][:collect_backtraces]
|
40
25
|
end
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
#::Moped::Indexes
|
46
|
-
Oboe::Inst::Moped::INDEX_OPS.each do |m|
|
47
|
-
::Moped::Indexes.method_defined?("#{m}_with_oboe").must_equal true
|
26
|
+
|
27
|
+
after do
|
28
|
+
Oboe::Config[:moped][:collect_backtraces] = @collect_backtraces
|
48
29
|
end
|
49
|
-
::Moped::Indexes.method_defined?(:extract_trace_details).must_equal true
|
50
|
-
::Moped::Indexes.method_defined?(:create_with_oboe).must_equal true
|
51
|
-
::Moped::Indexes.method_defined?(:drop_with_oboe).must_equal true
|
52
30
|
|
53
|
-
|
54
|
-
|
55
|
-
::Moped::
|
31
|
+
it 'Stock Moped should be loaded, defined and ready' do
|
32
|
+
defined?(::Moped).wont_match nil
|
33
|
+
defined?(::Moped::Database).wont_match nil
|
34
|
+
defined?(::Moped::Indexes).wont_match nil
|
35
|
+
defined?(::Moped::Query).wont_match nil
|
36
|
+
defined?(::Moped::Collection).wont_match nil
|
56
37
|
end
|
57
|
-
::Moped::Query.method_defined?(:extract_trace_details).must_equal true
|
58
38
|
|
59
|
-
|
60
|
-
|
61
|
-
::Moped::
|
39
|
+
it 'Moped should have oboe methods defined' do
|
40
|
+
#::Moped::Database
|
41
|
+
Oboe::Inst::Moped::DB_OPS.each do |m|
|
42
|
+
::Moped::Database.method_defined?("#{m}_with_oboe").must_equal true
|
43
|
+
end
|
44
|
+
::Moped::Database.method_defined?(:extract_trace_details).must_equal true
|
45
|
+
::Moped::Database.method_defined?(:command_with_oboe).must_equal true
|
46
|
+
::Moped::Database.method_defined?(:drop_with_oboe).must_equal true
|
47
|
+
|
48
|
+
#::Moped::Indexes
|
49
|
+
Oboe::Inst::Moped::INDEX_OPS.each do |m|
|
50
|
+
::Moped::Indexes.method_defined?("#{m}_with_oboe").must_equal true
|
51
|
+
end
|
52
|
+
::Moped::Indexes.method_defined?(:extract_trace_details).must_equal true
|
53
|
+
::Moped::Indexes.method_defined?(:create_with_oboe).must_equal true
|
54
|
+
::Moped::Indexes.method_defined?(:drop_with_oboe).must_equal true
|
55
|
+
|
56
|
+
#::Moped::Query
|
57
|
+
Oboe::Inst::Moped::QUERY_OPS.each do |m|
|
58
|
+
::Moped::Query.method_defined?("#{m}_with_oboe").must_equal true
|
59
|
+
end
|
60
|
+
::Moped::Query.method_defined?(:extract_trace_details).must_equal true
|
61
|
+
|
62
|
+
#::Moped::Collection
|
63
|
+
Oboe::Inst::Moped::COLLECTION_OPS.each do |m|
|
64
|
+
::Moped::Collection.method_defined?("#{m}_with_oboe").must_equal true
|
65
|
+
end
|
66
|
+
::Moped::Collection.method_defined?(:extract_trace_details).must_equal true
|
62
67
|
end
|
63
|
-
::Moped::Collection.method_defined?(:extract_trace_details).must_equal true
|
64
|
-
end
|
65
68
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
69
|
+
it 'should trace command' do
|
70
|
+
Oboe::API.start_trace('moped_test', '', {}) do
|
71
|
+
command = {}
|
72
|
+
command[:mapreduce] = "users"
|
73
|
+
command[:map] = "function() { emit(this.name, 1); }"
|
74
|
+
command[:reduce] = "function(k, vals) { var sum = 0;" +
|
75
|
+
" for(var i in vals) sum += vals[i]; return sum; }"
|
76
|
+
command[:out] = "inline: 1"
|
77
|
+
@session.command(command)
|
78
|
+
end
|
79
|
+
|
80
|
+
traces = get_all_traces
|
81
|
+
|
82
|
+
traces.count.must_equal 4
|
83
|
+
validate_outer_layers(traces, 'moped_test')
|
84
|
+
|
85
|
+
validate_event_keys(traces[1], @entry_kvs)
|
86
|
+
traces[1]['QueryOp'].must_equal "map_reduce"
|
87
|
+
traces[1]['Map_Function'].must_equal "function() { emit(this.name, 1); }"
|
88
|
+
traces[1]['Reduce_Function'].must_equal "function(k, vals) { var sum = 0;" +
|
72
89
|
" for(var i in vals) sum += vals[i]; return sum; }"
|
73
|
-
|
74
|
-
@
|
90
|
+
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
91
|
+
validate_event_keys(traces[2], @exit_kvs)
|
75
92
|
end
|
76
|
-
|
77
|
-
traces = get_all_traces
|
78
|
-
|
79
|
-
traces.count.must_equal 4
|
80
|
-
validate_outer_layers(traces, 'moped_test')
|
81
|
-
|
82
|
-
validate_event_keys(traces[1], @entry_kvs)
|
83
|
-
traces[1]['QueryOp'].must_equal "map_reduce"
|
84
|
-
traces[1]['Map_Function'].must_equal "function() { emit(this.name, 1); }"
|
85
|
-
traces[1]['Reduce_Function'].must_equal "function(k, vals) { var sum = 0;" +
|
86
|
-
" for(var i in vals) sum += vals[i]; return sum; }"
|
87
|
-
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
88
|
-
validate_event_keys(traces[2], @exit_kvs)
|
89
|
-
end
|
90
93
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
94
|
+
it 'should trace drop_collection' do
|
95
|
+
Oboe::API.start_trace('moped_test', '', {}) do
|
96
|
+
@users.drop
|
97
|
+
@session.drop
|
98
|
+
end
|
99
|
+
|
100
|
+
traces = get_all_traces
|
101
|
+
|
102
|
+
traces.count.must_equal 6
|
103
|
+
validate_outer_layers(traces, 'moped_test')
|
104
|
+
|
105
|
+
validate_event_keys(traces[1], @entry_kvs)
|
106
|
+
traces[1]['QueryOp'].must_equal "drop_collection"
|
107
|
+
traces[1]['Collection'].must_equal "users"
|
108
|
+
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
109
|
+
validate_event_keys(traces[2], @exit_kvs)
|
110
|
+
|
111
|
+
validate_event_keys(traces[3], @entry_kvs)
|
112
|
+
traces[3]['QueryOp'].must_equal "drop_database"
|
113
|
+
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
114
|
+
validate_event_keys(traces[4], @exit_kvs)
|
95
115
|
end
|
96
|
-
|
97
|
-
traces = get_all_traces
|
98
|
-
|
99
|
-
traces.count.must_equal 6
|
100
|
-
validate_outer_layers(traces, 'moped_test')
|
101
|
-
|
102
|
-
validate_event_keys(traces[1], @entry_kvs)
|
103
|
-
traces[1]['QueryOp'].must_equal "drop_collection"
|
104
|
-
traces[1]['Collection'].must_equal "users"
|
105
|
-
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
106
|
-
validate_event_keys(traces[2], @exit_kvs)
|
107
|
-
|
108
|
-
validate_event_keys(traces[3], @entry_kvs)
|
109
|
-
traces[3]['QueryOp'].must_equal "drop_database"
|
110
|
-
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
111
|
-
validate_event_keys(traces[4], @exit_kvs)
|
112
|
-
end
|
113
116
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
117
|
+
it 'should trace create_index, indexes and drop_indexes' do
|
118
|
+
Oboe::API.start_trace('moped_test', '', {}) do
|
119
|
+
@users.indexes.create({:name => 1}, {:unique => true})
|
120
|
+
@users.indexes.drop
|
121
|
+
end
|
122
|
+
|
123
|
+
traces = get_all_traces
|
124
|
+
|
125
|
+
traces.count.must_equal 10
|
126
|
+
validate_outer_layers(traces, 'moped_test')
|
127
|
+
|
128
|
+
validate_event_keys(traces[1], @entry_kvs)
|
129
|
+
traces[1]['QueryOp'].must_equal "indexes"
|
130
|
+
traces[1]['Collection'].must_equal "users"
|
131
|
+
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
132
|
+
validate_event_keys(traces[2], @exit_kvs)
|
133
|
+
|
134
|
+
validate_event_keys(traces[3], @entry_kvs)
|
135
|
+
traces[3]['QueryOp'].must_equal "create_index"
|
136
|
+
traces[3]['Key'].must_equal "{\"name\":1}"
|
137
|
+
traces[3]['Options'].must_equal "{\"unique\":true}"
|
138
|
+
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
139
|
+
validate_event_keys(traces[4], @exit_kvs)
|
140
|
+
|
141
|
+
validate_event_keys(traces[5], @entry_kvs)
|
142
|
+
traces[5]['QueryOp'].must_equal "indexes"
|
143
|
+
traces[5]['Collection'].must_equal "users"
|
144
|
+
traces[5].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
145
|
+
validate_event_keys(traces[6], @exit_kvs)
|
146
|
+
|
147
|
+
validate_event_keys(traces[7], @entry_kvs)
|
148
|
+
traces[7]['QueryOp'].must_equal "drop_indexes"
|
149
|
+
traces[7]['Key'].must_equal "all"
|
150
|
+
traces[7].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
151
|
+
validate_event_keys(traces[8], @exit_kvs)
|
118
152
|
end
|
119
|
-
|
120
|
-
traces = get_all_traces
|
121
|
-
|
122
|
-
traces.count.must_equal 10
|
123
|
-
validate_outer_layers(traces, 'moped_test')
|
124
|
-
|
125
|
-
validate_event_keys(traces[1], @entry_kvs)
|
126
|
-
traces[1]['QueryOp'].must_equal "indexes"
|
127
|
-
traces[1]['Collection'].must_equal "users"
|
128
|
-
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
129
|
-
validate_event_keys(traces[2], @exit_kvs)
|
130
|
-
|
131
|
-
validate_event_keys(traces[3], @entry_kvs)
|
132
|
-
traces[3]['QueryOp'].must_equal "create_index"
|
133
|
-
traces[3]['Key'].must_equal "{\"name\":1}"
|
134
|
-
traces[3]['Options'].must_equal "{\"unique\":true}"
|
135
|
-
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
136
|
-
validate_event_keys(traces[4], @exit_kvs)
|
137
|
-
|
138
|
-
validate_event_keys(traces[5], @entry_kvs)
|
139
|
-
traces[5]['QueryOp'].must_equal "indexes"
|
140
|
-
traces[5]['Collection'].must_equal "users"
|
141
|
-
traces[5].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
142
|
-
validate_event_keys(traces[6], @exit_kvs)
|
143
|
-
|
144
|
-
validate_event_keys(traces[7], @entry_kvs)
|
145
|
-
traces[7]['QueryOp'].must_equal "drop_indexes"
|
146
|
-
traces[7]['Key'].must_equal "all"
|
147
|
-
traces[7].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
148
|
-
validate_event_keys(traces[8], @exit_kvs)
|
149
|
-
end
|
150
153
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
+
it 'should trace find and count' do
|
155
|
+
Oboe::API.start_trace('moped_test', '', {}) do
|
156
|
+
@users.find.count
|
157
|
+
end
|
158
|
+
|
159
|
+
traces = get_all_traces
|
160
|
+
|
161
|
+
traces.count.must_equal 6
|
162
|
+
validate_outer_layers(traces, 'moped_test')
|
163
|
+
|
164
|
+
validate_event_keys(traces[1], @entry_kvs)
|
165
|
+
traces[1]['QueryOp'].must_equal "find"
|
166
|
+
traces[1]['Collection'].must_equal "users"
|
167
|
+
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
168
|
+
validate_event_keys(traces[2], @exit_kvs)
|
169
|
+
|
170
|
+
validate_event_keys(traces[3], @entry_kvs)
|
171
|
+
traces[3]['QueryOp'].must_equal "count"
|
172
|
+
traces[3]['Query'].must_equal "all"
|
173
|
+
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
174
|
+
validate_event_keys(traces[4], @exit_kvs)
|
154
175
|
end
|
155
|
-
|
156
|
-
traces = get_all_traces
|
157
|
-
|
158
|
-
traces.count.must_equal 6
|
159
|
-
validate_outer_layers(traces, 'moped_test')
|
160
|
-
|
161
|
-
validate_event_keys(traces[1], @entry_kvs)
|
162
|
-
traces[1]['QueryOp'].must_equal "find"
|
163
|
-
traces[1]['Collection'].must_equal "users"
|
164
|
-
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
165
|
-
validate_event_keys(traces[2], @exit_kvs)
|
166
|
-
|
167
|
-
validate_event_keys(traces[3], @entry_kvs)
|
168
|
-
traces[3]['QueryOp'].must_equal "count"
|
169
|
-
traces[3]['Query'].must_equal "all"
|
170
|
-
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
171
|
-
validate_event_keys(traces[4], @exit_kvs)
|
172
|
-
end
|
173
176
|
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
+
it 'should trace find and sort' do
|
178
|
+
Oboe::API.start_trace('moped_test', '', {}) do
|
179
|
+
@users.find(:name => "Mary").sort(:city => 1, :created_at => -1)
|
180
|
+
end
|
181
|
+
|
182
|
+
traces = get_all_traces
|
183
|
+
|
184
|
+
traces.count.must_equal 6
|
185
|
+
validate_outer_layers(traces, 'moped_test')
|
186
|
+
|
187
|
+
validate_event_keys(traces[1], @entry_kvs)
|
188
|
+
traces[1]['QueryOp'].must_equal "find"
|
189
|
+
traces[1]['Query'].must_equal "{\"name\":\"Mary\"}"
|
190
|
+
traces[1]['Collection'].must_equal "users"
|
191
|
+
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
192
|
+
validate_event_keys(traces[2], @exit_kvs)
|
193
|
+
|
194
|
+
validate_event_keys(traces[3], @entry_kvs)
|
195
|
+
traces[3]['QueryOp'].must_equal "sort"
|
196
|
+
traces[3]['Query'].must_equal "{\"name\":\"Mary\"}"
|
197
|
+
traces[3]['Order'].must_equal "{:city=>1, :created_at=>-1}"
|
198
|
+
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
199
|
+
validate_event_keys(traces[4], @exit_kvs)
|
177
200
|
end
|
178
201
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
+
it 'should trace find with limit' do
|
203
|
+
Oboe::API.start_trace('moped_test', '', {}) do
|
204
|
+
@users.find(:name => "Mary").limit(1)
|
205
|
+
end
|
206
|
+
|
207
|
+
traces = get_all_traces
|
208
|
+
|
209
|
+
traces.count.must_equal 6
|
210
|
+
validate_outer_layers(traces, 'moped_test')
|
211
|
+
|
212
|
+
validate_event_keys(traces[1], @entry_kvs)
|
213
|
+
traces[1]['QueryOp'].must_equal "find"
|
214
|
+
traces[1]['Query'].must_equal "{\"name\":\"Mary\"}"
|
215
|
+
traces[1]['Collection'].must_equal "users"
|
216
|
+
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
217
|
+
validate_event_keys(traces[2], @exit_kvs)
|
218
|
+
|
219
|
+
validate_event_keys(traces[3], @entry_kvs)
|
220
|
+
traces[3]['QueryOp'].must_equal "limit"
|
221
|
+
traces[3]['Query'].must_equal "{\"name\":\"Mary\"}"
|
222
|
+
traces[3]['Limit'].must_equal "1"
|
223
|
+
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
224
|
+
validate_event_keys(traces[4], @exit_kvs)
|
202
225
|
end
|
203
|
-
|
204
|
-
traces = get_all_traces
|
205
|
-
|
206
|
-
traces.count.must_equal 6
|
207
|
-
validate_outer_layers(traces, 'moped_test')
|
208
|
-
|
209
|
-
validate_event_keys(traces[1], @entry_kvs)
|
210
|
-
traces[1]['QueryOp'].must_equal "find"
|
211
|
-
traces[1]['Query'].must_equal "{\"name\":\"Mary\"}"
|
212
|
-
traces[1]['Collection'].must_equal "users"
|
213
|
-
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
214
|
-
validate_event_keys(traces[2], @exit_kvs)
|
215
|
-
|
216
|
-
validate_event_keys(traces[3], @entry_kvs)
|
217
|
-
traces[3]['QueryOp'].must_equal "limit"
|
218
|
-
traces[3]['Query'].must_equal "{\"name\":\"Mary\"}"
|
219
|
-
traces[3]['Limit'].must_equal "1"
|
220
|
-
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
221
|
-
validate_event_keys(traces[4], @exit_kvs)
|
222
|
-
end
|
223
226
|
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
+
it 'should trace find with distinct' do
|
228
|
+
Oboe::API.start_trace('moped_test', '', {}) do
|
229
|
+
@users.find(:name => "Mary").distinct(:city)
|
230
|
+
end
|
231
|
+
|
232
|
+
traces = get_all_traces
|
233
|
+
|
234
|
+
traces.count.must_equal 6
|
235
|
+
validate_outer_layers(traces, 'moped_test')
|
236
|
+
|
237
|
+
validate_event_keys(traces[1], @entry_kvs)
|
238
|
+
traces[1]['QueryOp'].must_equal "find"
|
239
|
+
traces[1]['Query'].must_equal "{\"name\":\"Mary\"}"
|
240
|
+
traces[1]['Collection'].must_equal "users"
|
241
|
+
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
242
|
+
validate_event_keys(traces[2], @exit_kvs)
|
243
|
+
|
244
|
+
validate_event_keys(traces[3], @entry_kvs)
|
245
|
+
traces[3]['QueryOp'].must_equal "distinct"
|
246
|
+
traces[3]['Query'].must_equal "{\"name\":\"Mary\"}"
|
247
|
+
traces[3]['Key'].must_equal "city"
|
248
|
+
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
249
|
+
validate_event_keys(traces[4], @exit_kvs)
|
227
250
|
end
|
228
|
-
|
229
|
-
traces = get_all_traces
|
230
|
-
|
231
|
-
traces.count.must_equal 6
|
232
|
-
validate_outer_layers(traces, 'moped_test')
|
233
|
-
|
234
|
-
validate_event_keys(traces[1], @entry_kvs)
|
235
|
-
traces[1]['QueryOp'].must_equal "find"
|
236
|
-
traces[1]['Query'].must_equal "{\"name\":\"Mary\"}"
|
237
|
-
traces[1]['Collection'].must_equal "users"
|
238
|
-
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
239
|
-
validate_event_keys(traces[2], @exit_kvs)
|
240
|
-
|
241
|
-
validate_event_keys(traces[3], @entry_kvs)
|
242
|
-
traces[3]['QueryOp'].must_equal "distinct"
|
243
|
-
traces[3]['Query'].must_equal "{\"name\":\"Mary\"}"
|
244
|
-
traces[3]['Key'].must_equal "city"
|
245
|
-
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
246
|
-
validate_event_keys(traces[4], @exit_kvs)
|
247
|
-
end
|
248
251
|
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
+
it 'should trace find and update' do
|
253
|
+
Oboe::API.start_trace('moped_test', '', {}) do
|
254
|
+
@users.find(:name => "Mary").update({:name => "Tool"}, [:multi])
|
255
|
+
end
|
256
|
+
|
257
|
+
traces = get_all_traces
|
258
|
+
|
259
|
+
traces.count.must_equal 6
|
260
|
+
validate_outer_layers(traces, 'moped_test')
|
261
|
+
|
262
|
+
validate_event_keys(traces[1], @entry_kvs)
|
263
|
+
traces[1]['QueryOp'].must_equal "find"
|
264
|
+
traces[1]['Query'].must_equal "{\"name\":\"Mary\"}"
|
265
|
+
traces[1]['Collection'].must_equal "users"
|
266
|
+
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
267
|
+
validate_event_keys(traces[2], @exit_kvs)
|
268
|
+
|
269
|
+
validate_event_keys(traces[3], @entry_kvs)
|
270
|
+
traces[3]['QueryOp'].must_equal "update"
|
271
|
+
traces[3]['Update_Document'].must_equal "{\"name\":\"Tool\"}"
|
272
|
+
traces[3]['Flags'].must_equal "[:multi]"
|
273
|
+
traces[3]['Collection'].must_equal "users"
|
274
|
+
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
275
|
+
validate_event_keys(traces[4], @exit_kvs)
|
252
276
|
end
|
253
|
-
|
254
|
-
traces = get_all_traces
|
255
|
-
|
256
|
-
traces.count.must_equal 6
|
257
|
-
validate_outer_layers(traces, 'moped_test')
|
258
|
-
|
259
|
-
validate_event_keys(traces[1], @entry_kvs)
|
260
|
-
traces[1]['QueryOp'].must_equal "find"
|
261
|
-
traces[1]['Query'].must_equal "{\"name\":\"Mary\"}"
|
262
|
-
traces[1]['Collection'].must_equal "users"
|
263
|
-
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
264
|
-
validate_event_keys(traces[2], @exit_kvs)
|
265
|
-
|
266
|
-
validate_event_keys(traces[3], @entry_kvs)
|
267
|
-
traces[3]['QueryOp'].must_equal "update"
|
268
|
-
traces[3]['Update_Document'].must_equal "{\"name\":\"Tool\"}"
|
269
|
-
traces[3]['Flags'].must_equal "[:multi]"
|
270
|
-
traces[3]['Collection'].must_equal "users"
|
271
|
-
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
272
|
-
validate_event_keys(traces[4], @exit_kvs)
|
273
|
-
end
|
274
277
|
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
+
it 'should trace find and update_all' do
|
279
|
+
Oboe::API.start_trace('moped_test', '', {}) do
|
280
|
+
@users.find(:name => "Mary").update_all({:name => "Tool"})
|
281
|
+
end
|
282
|
+
|
283
|
+
traces = get_all_traces
|
284
|
+
|
285
|
+
traces.count.must_equal 6
|
286
|
+
validate_outer_layers(traces, 'moped_test')
|
287
|
+
|
288
|
+
validate_event_keys(traces[1], @entry_kvs)
|
289
|
+
traces[1]['QueryOp'].must_equal "find"
|
290
|
+
traces[1]['Query'].must_equal "{\"name\":\"Mary\"}"
|
291
|
+
traces[1]['Collection'].must_equal "users"
|
292
|
+
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
293
|
+
validate_event_keys(traces[2], @exit_kvs)
|
294
|
+
|
295
|
+
validate_event_keys(traces[3], @entry_kvs)
|
296
|
+
traces[3]['QueryOp'].must_equal "update_all"
|
297
|
+
traces[3]['Update_Document'].must_equal "{\"name\":\"Tool\"}"
|
298
|
+
traces[3]['Collection'].must_equal "users"
|
299
|
+
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
300
|
+
validate_event_keys(traces[4], @exit_kvs)
|
278
301
|
end
|
279
|
-
|
280
|
-
traces = get_all_traces
|
281
|
-
|
282
|
-
traces.count.must_equal 6
|
283
|
-
validate_outer_layers(traces, 'moped_test')
|
284
|
-
|
285
|
-
validate_event_keys(traces[1], @entry_kvs)
|
286
|
-
traces[1]['QueryOp'].must_equal "find"
|
287
|
-
traces[1]['Query'].must_equal "{\"name\":\"Mary\"}"
|
288
|
-
traces[1]['Collection'].must_equal "users"
|
289
|
-
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
290
|
-
validate_event_keys(traces[2], @exit_kvs)
|
291
|
-
|
292
|
-
validate_event_keys(traces[3], @entry_kvs)
|
293
|
-
traces[3]['QueryOp'].must_equal "update_all"
|
294
|
-
traces[3]['Update_Document'].must_equal "{\"name\":\"Tool\"}"
|
295
|
-
traces[3]['Collection'].must_equal "users"
|
296
|
-
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
297
|
-
validate_event_keys(traces[4], @exit_kvs)
|
298
|
-
end
|
299
302
|
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
+
it 'should trace find and upsert' do
|
304
|
+
Oboe::API.start_trace('moped_test', '', {}) do
|
305
|
+
@users.find(:name => "Tool").upsert({:name => "Mary"})
|
306
|
+
end
|
307
|
+
|
308
|
+
traces = get_all_traces
|
309
|
+
|
310
|
+
traces.count.must_equal 6
|
311
|
+
validate_outer_layers(traces, 'moped_test')
|
312
|
+
|
313
|
+
validate_event_keys(traces[1], @entry_kvs)
|
314
|
+
traces[1]['QueryOp'].must_equal "find"
|
315
|
+
traces[1]['Query'].must_equal "{\"name\":\"Tool\"}"
|
316
|
+
traces[1]['Collection'].must_equal "users"
|
317
|
+
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
318
|
+
validate_event_keys(traces[2], @exit_kvs)
|
319
|
+
|
320
|
+
validate_event_keys(traces[3], @entry_kvs)
|
321
|
+
traces[3]['QueryOp'].must_equal "upsert"
|
322
|
+
traces[3]['Query'].must_equal "{\"name\":\"Tool\"}"
|
323
|
+
traces[3]['Update_Document'].must_equal "{\"name\":\"Mary\"}"
|
324
|
+
traces[3]['Collection'].must_equal "users"
|
325
|
+
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
326
|
+
validate_event_keys(traces[4], @exit_kvs)
|
303
327
|
end
|
304
|
-
|
305
|
-
traces = get_all_traces
|
306
|
-
|
307
|
-
traces.count.must_equal 6
|
308
|
-
validate_outer_layers(traces, 'moped_test')
|
309
|
-
|
310
|
-
validate_event_keys(traces[1], @entry_kvs)
|
311
|
-
traces[1]['QueryOp'].must_equal "find"
|
312
|
-
traces[1]['Query'].must_equal "{\"name\":\"Tool\"}"
|
313
|
-
traces[1]['Collection'].must_equal "users"
|
314
|
-
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
315
|
-
validate_event_keys(traces[2], @exit_kvs)
|
316
|
-
|
317
|
-
validate_event_keys(traces[3], @entry_kvs)
|
318
|
-
traces[3]['QueryOp'].must_equal "upsert"
|
319
|
-
traces[3]['Query'].must_equal "{\"name\":\"Tool\"}"
|
320
|
-
traces[3]['Update_Document'].must_equal "{\"name\":\"Mary\"}"
|
321
|
-
traces[3]['Collection'].must_equal "users"
|
322
|
-
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
323
|
-
validate_event_keys(traces[4], @exit_kvs)
|
324
|
-
end
|
325
328
|
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
+
it 'should trace find and explain' do
|
330
|
+
Oboe::API.start_trace('moped_test', '', {}) do
|
331
|
+
@users.find(:name => "Mary").explain
|
332
|
+
end
|
333
|
+
|
334
|
+
traces = get_all_traces
|
335
|
+
|
336
|
+
traces.count.must_equal 6
|
337
|
+
validate_outer_layers(traces, 'moped_test')
|
338
|
+
|
339
|
+
validate_event_keys(traces[1], @entry_kvs)
|
340
|
+
traces[1]['QueryOp'].must_equal "find"
|
341
|
+
traces[1]['Query'].must_equal "{\"name\":\"Mary\"}"
|
342
|
+
traces[1]['Collection'].must_equal "users"
|
343
|
+
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
344
|
+
validate_event_keys(traces[2], @exit_kvs)
|
345
|
+
|
346
|
+
validate_event_keys(traces[3], @entry_kvs)
|
347
|
+
traces[3]['QueryOp'].must_equal "explain"
|
348
|
+
traces[3]['Query'].must_equal "{\"name\":\"Mary\"}"
|
349
|
+
traces[3]['Collection'].must_equal "users"
|
350
|
+
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
351
|
+
validate_event_keys(traces[4], @exit_kvs)
|
329
352
|
end
|
330
|
-
|
331
|
-
traces = get_all_traces
|
332
|
-
|
333
|
-
traces.count.must_equal 6
|
334
|
-
validate_outer_layers(traces, 'moped_test')
|
335
|
-
|
336
|
-
validate_event_keys(traces[1], @entry_kvs)
|
337
|
-
traces[1]['QueryOp'].must_equal "find"
|
338
|
-
traces[1]['Query'].must_equal "{\"name\":\"Mary\"}"
|
339
|
-
traces[1]['Collection'].must_equal "users"
|
340
|
-
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
341
|
-
validate_event_keys(traces[2], @exit_kvs)
|
342
|
-
|
343
|
-
validate_event_keys(traces[3], @entry_kvs)
|
344
|
-
traces[3]['QueryOp'].must_equal "explain"
|
345
|
-
traces[3]['Query'].must_equal "{\"name\":\"Mary\"}"
|
346
|
-
traces[3]['Collection'].must_equal "users"
|
347
|
-
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
348
|
-
validate_event_keys(traces[4], @exit_kvs)
|
349
|
-
end
|
350
353
|
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
354
|
+
it 'should trace 3 types of find and modify calls' do
|
355
|
+
Oboe::API.start_trace('moped_test', '', {}) do
|
356
|
+
@users.find(:likes => 1).modify({ "$set" => { :name => "Tool" }}, :upsert => true)
|
357
|
+
@users.find.modify({:query => { "$inc" => { :likes => 1 }}}, :new => true)
|
358
|
+
@users.find.modify({:query => {}}, :remove => true)
|
359
|
+
end
|
360
|
+
|
361
|
+
traces = get_all_traces
|
362
|
+
|
363
|
+
traces.count.must_equal 14
|
364
|
+
validate_outer_layers(traces, 'moped_test')
|
365
|
+
|
366
|
+
validate_event_keys(traces[1], @entry_kvs)
|
367
|
+
traces[1]['QueryOp'].must_equal "find"
|
368
|
+
traces[1]['Query'].must_equal "{\"likes\":1}"
|
369
|
+
traces[1]['Collection'].must_equal "users"
|
370
|
+
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
371
|
+
validate_event_keys(traces[2], @exit_kvs)
|
372
|
+
|
373
|
+
validate_event_keys(traces[3], @entry_kvs)
|
374
|
+
traces[3]['QueryOp'].must_equal "modify"
|
375
|
+
traces[3]['Update_Document'].must_equal "{\"likes\":1}"
|
376
|
+
traces[3]['Collection'].must_equal "users"
|
377
|
+
traces[3]['Options'].must_equal "{\"upsert\":true}"
|
378
|
+
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
379
|
+
validate_event_keys(traces[4], @exit_kvs)
|
380
|
+
|
381
|
+
validate_event_keys(traces[7], @entry_kvs)
|
382
|
+
traces[7]['QueryOp'].must_equal "modify"
|
383
|
+
traces[7]['Update_Document'].must_equal "all"
|
384
|
+
traces[7]['Collection'].must_equal "users"
|
385
|
+
traces[7]['Options'].must_equal "{\"new\":true}"
|
386
|
+
traces[7]['Change'].must_equal "{\"query\":{\"$inc\":{\"likes\":1}}}"
|
387
|
+
traces[7].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
388
|
+
validate_event_keys(traces[8], @exit_kvs)
|
389
|
+
|
390
|
+
validate_event_keys(traces[11], @entry_kvs)
|
391
|
+
traces[11]['Collection'].must_equal "users"
|
392
|
+
traces[11]['QueryOp'].must_equal "modify"
|
393
|
+
traces[11]['Update_Document'].must_equal "all"
|
394
|
+
traces[11]['Change'].must_equal "{\"query\":{}}"
|
395
|
+
traces[11]['Options'].must_equal "{\"remove\":true}"
|
396
|
+
traces[11].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
397
|
+
validate_event_keys(traces[12], @exit_kvs)
|
356
398
|
end
|
357
|
-
|
358
|
-
traces = get_all_traces
|
359
|
-
|
360
|
-
traces.count.must_equal 14
|
361
|
-
validate_outer_layers(traces, 'moped_test')
|
362
|
-
|
363
|
-
validate_event_keys(traces[1], @entry_kvs)
|
364
|
-
traces[1]['QueryOp'].must_equal "find"
|
365
|
-
traces[1]['Query'].must_equal "all"
|
366
|
-
traces[1]['Collection'].must_equal "users"
|
367
|
-
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
368
|
-
validate_event_keys(traces[2], @exit_kvs)
|
369
|
-
|
370
|
-
validate_event_keys(traces[3], @entry_kvs)
|
371
|
-
traces[3]['QueryOp'].must_equal "modify"
|
372
|
-
traces[3]['Update_Document'].must_equal "all"
|
373
|
-
traces[3]['Collection'].must_equal "users"
|
374
|
-
traces[3]['Options'].must_equal "{\"upsert\":true,\"new\":true}"
|
375
|
-
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
376
|
-
validate_event_keys(traces[4], @exit_kvs)
|
377
|
-
|
378
|
-
validate_event_keys(traces[7], @entry_kvs)
|
379
|
-
traces[7]['QueryOp'].must_equal "modify"
|
380
|
-
traces[7]['Update_Document'].must_equal "all"
|
381
|
-
traces[7]['Collection'].must_equal "users"
|
382
|
-
traces[7]['Options'].must_equal "{\"new\":true}"
|
383
|
-
traces[7]['Change'].must_equal "{\"$inc\":{\"likes\":1}}"
|
384
|
-
traces[7].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
385
|
-
validate_event_keys(traces[8], @exit_kvs)
|
386
|
-
|
387
|
-
validate_event_keys(traces[11], @entry_kvs)
|
388
|
-
traces[11]['Collection'].must_equal "users"
|
389
|
-
traces[11]['QueryOp'].must_equal "modify"
|
390
|
-
traces[11]['Update_Document'].must_equal "all"
|
391
|
-
traces[11]['Change'].must_equal "{}"
|
392
|
-
traces[11]['Options'].must_equal "{\"remove\":true}"
|
393
|
-
traces[11].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
394
|
-
validate_event_keys(traces[12], @exit_kvs)
|
395
|
-
end
|
396
399
|
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
+
it 'should trace remove' do
|
401
|
+
Oboe::API.start_trace('moped_test', '', {}) do
|
402
|
+
@users.find(:name => "Tool").remove
|
403
|
+
end
|
404
|
+
|
405
|
+
traces = get_all_traces
|
406
|
+
|
407
|
+
traces.count.must_equal 6
|
408
|
+
validate_outer_layers(traces, 'moped_test')
|
409
|
+
|
410
|
+
validate_event_keys(traces[1], @entry_kvs)
|
411
|
+
traces[1]['QueryOp'].must_equal "find"
|
412
|
+
traces[1]['Query'].must_equal "{\"name\":\"Tool\"}"
|
413
|
+
traces[1]['Collection'].must_equal "users"
|
414
|
+
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
415
|
+
validate_event_keys(traces[2], @exit_kvs)
|
416
|
+
|
417
|
+
validate_event_keys(traces[3], @entry_kvs)
|
418
|
+
traces[3]['QueryOp'].must_equal "remove"
|
419
|
+
traces[3]['Query'].must_equal "{\"name\":\"Tool\"}"
|
420
|
+
traces[3]['Collection'].must_equal "users"
|
421
|
+
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
422
|
+
validate_event_keys(traces[4], @exit_kvs)
|
400
423
|
end
|
401
|
-
|
402
|
-
traces = get_all_traces
|
403
|
-
|
404
|
-
traces.count.must_equal 6
|
405
|
-
validate_outer_layers(traces, 'moped_test')
|
406
|
-
|
407
|
-
validate_event_keys(traces[1], @entry_kvs)
|
408
|
-
traces[1]['QueryOp'].must_equal "find"
|
409
|
-
traces[1]['Query'].must_equal "{\"name\":\"Tool\"}"
|
410
|
-
traces[1]['Collection'].must_equal "users"
|
411
|
-
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
412
|
-
validate_event_keys(traces[2], @exit_kvs)
|
413
|
-
|
414
|
-
validate_event_keys(traces[3], @entry_kvs)
|
415
|
-
traces[3]['QueryOp'].must_equal "remove"
|
416
|
-
traces[3]['Query'].must_equal "{\"name\":\"Tool\"}"
|
417
|
-
traces[3]['Collection'].must_equal "users"
|
418
|
-
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
419
|
-
validate_event_keys(traces[4], @exit_kvs)
|
420
|
-
end
|
421
424
|
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
+
it 'should trace remove_all' do
|
426
|
+
Oboe::API.start_trace('moped_test', '', {}) do
|
427
|
+
@users.find(:name => "Mary").remove_all
|
428
|
+
end
|
429
|
+
|
430
|
+
traces = get_all_traces
|
431
|
+
|
432
|
+
traces.count.must_equal 6
|
433
|
+
validate_outer_layers(traces, 'moped_test')
|
434
|
+
|
435
|
+
validate_event_keys(traces[1], @entry_kvs)
|
436
|
+
traces[1]['QueryOp'].must_equal "find"
|
437
|
+
traces[1]['Query'].must_equal "{\"name\":\"Mary\"}"
|
438
|
+
traces[1]['Collection'].must_equal "users"
|
439
|
+
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
440
|
+
validate_event_keys(traces[2], @exit_kvs)
|
441
|
+
|
442
|
+
validate_event_keys(traces[3], @entry_kvs)
|
443
|
+
traces[3]['QueryOp'].must_equal "remove_all"
|
444
|
+
traces[3]['Query'].must_equal "{\"name\":\"Mary\"}"
|
445
|
+
traces[3]['Collection'].must_equal "users"
|
446
|
+
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
447
|
+
validate_event_keys(traces[4], @exit_kvs)
|
425
448
|
end
|
426
449
|
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
traces[1].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
437
|
-
validate_event_keys(traces[2], @exit_kvs)
|
438
|
-
|
439
|
-
validate_event_keys(traces[3], @entry_kvs)
|
440
|
-
traces[3]['QueryOp'].must_equal "remove_all"
|
441
|
-
traces[3]['Query'].must_equal "{\"name\":\"Mary\"}"
|
442
|
-
traces[3]['Collection'].must_equal "users"
|
443
|
-
traces[3].has_key?('Backtrace').must_equal Oboe::Config[:moped][:collect_backtraces]
|
444
|
-
validate_event_keys(traces[4], @exit_kvs)
|
445
|
-
end
|
446
|
-
|
447
|
-
it "should obey :collect_backtraces setting when true" do
|
448
|
-
Oboe::Config[:moped][:collect_backtraces] = true
|
449
|
-
|
450
|
-
Oboe::API.start_trace('moped_test', '', {}) do
|
451
|
-
@users.find(name: "Mary").limit(1)
|
450
|
+
it "should obey :collect_backtraces setting when true" do
|
451
|
+
Oboe::Config[:moped][:collect_backtraces] = true
|
452
|
+
|
453
|
+
Oboe::API.start_trace('moped_test', '', {}) do
|
454
|
+
@users.find(:name => "Mary").limit(1)
|
455
|
+
end
|
456
|
+
|
457
|
+
traces = get_all_traces
|
458
|
+
layer_has_key(traces, 'mongo', 'Backtrace')
|
452
459
|
end
|
453
460
|
|
454
|
-
|
455
|
-
|
456
|
-
|
461
|
+
it "should obey :collect_backtraces setting when false" do
|
462
|
+
Oboe::Config[:moped][:collect_backtraces] = false
|
463
|
+
|
464
|
+
Oboe::API.start_trace('moped_test', '', {}) do
|
465
|
+
@users.find(:name => "Mary").limit(1)
|
466
|
+
end
|
457
467
|
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
Oboe::API.start_trace('moped_test', '', {}) do
|
462
|
-
@users.find(name: "Mary").limit(1)
|
468
|
+
traces = get_all_traces
|
469
|
+
layer_doesnt_have_key(traces, 'mongo', 'Backtrace')
|
463
470
|
end
|
464
|
-
|
465
|
-
traces = get_all_traces
|
466
|
-
layer_doesnt_have_key(traces, 'mongo', 'Backtrace')
|
467
471
|
end
|
472
|
+
|
468
473
|
end
|