oboe 1.3.6 → 1.3.7
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.
data/lib/oboe/api/logging.rb
CHANGED
|
@@ -82,12 +82,12 @@ module Oboe
|
|
|
82
82
|
xtrace
|
|
83
83
|
end
|
|
84
84
|
|
|
85
|
-
def log_entry(layer, opts={}, protect_op=
|
|
86
|
-
Oboe::Context.layer_op =
|
|
85
|
+
def log_entry(layer, opts={}, protect_op=nil)
|
|
86
|
+
Oboe::Context.layer_op = protect_op if protect_op
|
|
87
87
|
log_event(layer, 'entry', Oboe::Context.createEvent, opts)
|
|
88
88
|
end
|
|
89
89
|
|
|
90
|
-
def log_exit(layer, opts={}, protect_op=
|
|
90
|
+
def log_exit(layer, opts={}, protect_op=nil)
|
|
91
91
|
Oboe::Context.layer_op = nil if protect_op
|
|
92
92
|
log_event(layer, 'exit', Oboe::Context.createEvent, opts)
|
|
93
93
|
end
|
data/lib/oboe/api/tracing.rb
CHANGED
|
@@ -11,6 +11,8 @@ module Oboe
|
|
|
11
11
|
# layer - The layer the block of code belongs to.
|
|
12
12
|
# opts - A hash containing key/value pairs that will be reported along
|
|
13
13
|
# with the first event of this layer (optional).
|
|
14
|
+
# protect_op - specify the operating being traced. Used to avoid
|
|
15
|
+
# double tracing between operations that call each other
|
|
14
16
|
#
|
|
15
17
|
# Example
|
|
16
18
|
#
|
|
@@ -28,7 +30,7 @@ module Oboe
|
|
|
28
30
|
# result = computation_with_oboe(1000)
|
|
29
31
|
#
|
|
30
32
|
# Returns the result of the block.
|
|
31
|
-
def trace(layer, opts={}, protect_op=
|
|
33
|
+
def trace(layer, opts={}, protect_op=nil)
|
|
32
34
|
log_entry(layer, opts, protect_op)
|
|
33
35
|
begin
|
|
34
36
|
yield
|
|
@@ -83,7 +83,7 @@ module Oboe
|
|
|
83
83
|
def get_columns_with_oboe(column_family, key, *columns_and_options)
|
|
84
84
|
args = [column_family, key] + columns_and_options
|
|
85
85
|
|
|
86
|
-
if Oboe::Config.tracing? and not Oboe::Context.
|
|
86
|
+
if Oboe::Config.tracing? and not Oboe::Context.tracing_layer_op?(:multi_get_columns)
|
|
87
87
|
report_kvs = extract_trace_details(:get_columns, column_family, key, columns_and_options)
|
|
88
88
|
|
|
89
89
|
Oboe::API.trace('cassandra', report_kvs) do
|
|
@@ -100,7 +100,7 @@ module Oboe
|
|
|
100
100
|
if Oboe::Config.tracing?
|
|
101
101
|
report_kvs = extract_trace_details(:multi_get_columns, column_family, key, columns_and_options)
|
|
102
102
|
|
|
103
|
-
Oboe::API.trace('cassandra', report_kvs,
|
|
103
|
+
Oboe::API.trace('cassandra', report_kvs, :multi_get_columns) do
|
|
104
104
|
send :multi_get_columns_without_oboe, *args
|
|
105
105
|
end
|
|
106
106
|
else
|
|
@@ -114,7 +114,7 @@ module Oboe
|
|
|
114
114
|
if Oboe::Config.tracing?
|
|
115
115
|
report_kvs = extract_trace_details(:get, column_family, key, columns_and_options)
|
|
116
116
|
|
|
117
|
-
Oboe::API.trace('cassandra', report_kvs,
|
|
117
|
+
Oboe::API.trace('cassandra', report_kvs, :get) do
|
|
118
118
|
send :get_without_oboe, *args
|
|
119
119
|
end
|
|
120
120
|
else
|
|
@@ -125,7 +125,7 @@ module Oboe
|
|
|
125
125
|
def multi_get_with_oboe(column_family, key, *columns_and_options)
|
|
126
126
|
args = [column_family, key] + columns_and_options
|
|
127
127
|
|
|
128
|
-
if Oboe::Config.tracing? and not Oboe::Context.
|
|
128
|
+
if Oboe::Config.tracing? and not Oboe::Context.tracing_layer_op?(:get)
|
|
129
129
|
report_kvs = extract_trace_details(:multi_get, column_family, key, columns_and_options)
|
|
130
130
|
|
|
131
131
|
Oboe::API.trace('cassandra', report_kvs) do
|
|
@@ -151,7 +151,7 @@ module Oboe
|
|
|
151
151
|
end
|
|
152
152
|
|
|
153
153
|
def get_range_single_with_oboe(column_family, options = {})
|
|
154
|
-
if Oboe::Config.tracing? and not Oboe::Context.
|
|
154
|
+
if Oboe::Config.tracing? and not Oboe::Context.tracing_layer_op?(:get_range_batch)
|
|
155
155
|
report_kvs = extract_trace_details(:get_range_single, column_family, nil, nil)
|
|
156
156
|
args = [column_family, options]
|
|
157
157
|
|
|
@@ -168,7 +168,7 @@ module Oboe
|
|
|
168
168
|
report_kvs = extract_trace_details(:get_range_batch, column_family, nil, nil)
|
|
169
169
|
args = [column_family, options]
|
|
170
170
|
|
|
171
|
-
Oboe::API.trace('cassandra', report_kvs,
|
|
171
|
+
Oboe::API.trace('cassandra', report_kvs, :get_range_batch) do
|
|
172
172
|
get_range_batch_without_oboe(column_family, options)
|
|
173
173
|
end
|
|
174
174
|
else
|
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
# Copyright (c) 2012 by Tracelytics, Inc.
|
|
2
|
+
# All rights reserved.
|
|
3
|
+
|
|
4
|
+
module Oboe
|
|
5
|
+
module Inst
|
|
6
|
+
module Moped
|
|
7
|
+
FLAVOR = 'mongodb'
|
|
8
|
+
|
|
9
|
+
# Moped::Database
|
|
10
|
+
DB_OPS = [ :command, :drop ]
|
|
11
|
+
|
|
12
|
+
# Moped::Indexes
|
|
13
|
+
INDEX_OPS = [ :create, :drop ]
|
|
14
|
+
|
|
15
|
+
# Moped::Query
|
|
16
|
+
QUERY_OPS = [ :count, :sort, :limit, :distinct, :update, :update_all, :upsert,
|
|
17
|
+
:explain, :modify, :remove, :remove_all ]
|
|
18
|
+
|
|
19
|
+
# Moped::Collection
|
|
20
|
+
COLLECTION_OPS = [ :drop, :find, :indexes, :insert, :aggregate ]
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
puts "[oboe/loading] Instrumenting moped" if Oboe::Config[:verbose] and defined?(::Moped)
|
|
26
|
+
|
|
27
|
+
if defined?(::Moped::Database)
|
|
28
|
+
module ::Moped
|
|
29
|
+
class Database
|
|
30
|
+
include Oboe::Inst::Moped
|
|
31
|
+
|
|
32
|
+
def extract_trace_details(op)
|
|
33
|
+
report_kvs = {}
|
|
34
|
+
begin
|
|
35
|
+
report_kvs[:Flavor] = Oboe::Inst::Moped::FLAVOR
|
|
36
|
+
# FIXME: We're only grabbing the first of potentially multiple servers here
|
|
37
|
+
report_kvs[:RemoteHost], report_kvs[:RemotePort] = session.cluster.seeds.first.split(':')
|
|
38
|
+
report_kvs[:Database] = name
|
|
39
|
+
report_kvs[:QueryOp] = op.to_s
|
|
40
|
+
rescue
|
|
41
|
+
end
|
|
42
|
+
report_kvs
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def command_with_oboe(command)
|
|
46
|
+
if Oboe::Config.tracing? and not Oboe::Context.layer_op and command.has_key?(:mapreduce)
|
|
47
|
+
report_kvs = extract_trace_details(:map_reduce)
|
|
48
|
+
report_kvs[:Map_Function] = command[:map]
|
|
49
|
+
report_kvs[:Reduce_Function] = command[:reduce]
|
|
50
|
+
|
|
51
|
+
Oboe::API.trace('mongo', report_kvs) do
|
|
52
|
+
command_without_oboe(command)
|
|
53
|
+
end
|
|
54
|
+
else
|
|
55
|
+
command_without_oboe(command)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def drop_with_oboe
|
|
60
|
+
if Oboe::Config.tracing?
|
|
61
|
+
report_kvs = extract_trace_details(:drop_database)
|
|
62
|
+
|
|
63
|
+
Oboe::API.trace('mongo', report_kvs) do
|
|
64
|
+
drop_without_oboe
|
|
65
|
+
end
|
|
66
|
+
else
|
|
67
|
+
drop_without_oboe
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
Oboe::Inst::Moped::DB_OPS.each do |m|
|
|
72
|
+
if method_defined?(m)
|
|
73
|
+
class_eval "alias #{m}_without_oboe #{m}"
|
|
74
|
+
class_eval "alias #{m} #{m}_with_oboe"
|
|
75
|
+
else puts "[oboe/loading] Couldn't properly instrument moped (#{m}). Partial traces may occur."
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
if defined?(::Moped::Indexes)
|
|
83
|
+
module ::Moped
|
|
84
|
+
class Indexes
|
|
85
|
+
include Oboe::Inst::Moped
|
|
86
|
+
|
|
87
|
+
def extract_trace_details(op)
|
|
88
|
+
report_kvs = {}
|
|
89
|
+
begin
|
|
90
|
+
report_kvs[:Flavor] = Oboe::Inst::Moped::FLAVOR
|
|
91
|
+
# FIXME: We're only grabbing the first of potentially multiple servers here
|
|
92
|
+
report_kvs[:RemoteHost], report_kvs[:RemotePort] = database.session.cluster.seeds.first.split(':')
|
|
93
|
+
report_kvs[:Database] = database.name
|
|
94
|
+
report_kvs[:QueryOp] = op.to_s
|
|
95
|
+
rescue
|
|
96
|
+
end
|
|
97
|
+
report_kvs
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def create_with_oboe(key, options = {})
|
|
101
|
+
if Oboe::Config.tracing?
|
|
102
|
+
# We report :create_index here to be consistent
|
|
103
|
+
# with other mongo implementations
|
|
104
|
+
report_kvs = extract_trace_details(:create_index)
|
|
105
|
+
report_kvs[:Key] = key.try(:to_json)
|
|
106
|
+
report_kvs[:Options] = options.try(:to_json)
|
|
107
|
+
|
|
108
|
+
Oboe::API.trace('mongo', report_kvs, :create_index) do
|
|
109
|
+
create_without_oboe(key, options = {})
|
|
110
|
+
end
|
|
111
|
+
else
|
|
112
|
+
create_without_oboe(key, options = {})
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def drop_with_oboe(key = nil)
|
|
117
|
+
if Oboe::Config.tracing?
|
|
118
|
+
# We report :drop_indexes here to be consistent
|
|
119
|
+
# with other mongo implementations
|
|
120
|
+
report_kvs = extract_trace_details(:drop_indexes)
|
|
121
|
+
report_kvs[:Key] = key.nil? ? "all" : key.try(:to_json)
|
|
122
|
+
|
|
123
|
+
Oboe::API.trace('mongo', report_kvs) do
|
|
124
|
+
drop_without_oboe(key = nil)
|
|
125
|
+
end
|
|
126
|
+
else
|
|
127
|
+
drop_without_oboe(key = nil)
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
Oboe::Inst::Moped::INDEX_OPS.each do |m|
|
|
132
|
+
if method_defined?(m)
|
|
133
|
+
class_eval "alias #{m}_without_oboe #{m}"
|
|
134
|
+
class_eval "alias #{m} #{m}_with_oboe"
|
|
135
|
+
else puts "[oboe/loading] Couldn't properly instrument moped (#{m}). Partial traces may occur."
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
if defined?(::Moped::Query)
|
|
143
|
+
module ::Moped
|
|
144
|
+
class Query
|
|
145
|
+
include Oboe::Inst::Moped
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def extract_trace_details(op)
|
|
149
|
+
report_kvs = {}
|
|
150
|
+
begin
|
|
151
|
+
report_kvs[:Flavor] = Oboe::Inst::Moped::FLAVOR
|
|
152
|
+
# FIXME: We're only grabbing the first of potentially multiple servers here
|
|
153
|
+
report_kvs[:RemoteHost], report_kvs[:RemotePort] = collection.database.session.cluster.seeds.first.split(':')
|
|
154
|
+
report_kvs[:Database] = collection.database.name
|
|
155
|
+
report_kvs[:Collection_Name] = collection.name
|
|
156
|
+
report_kvs[:QueryOp] = op.to_s
|
|
157
|
+
rescue
|
|
158
|
+
end
|
|
159
|
+
report_kvs
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def count_with_oboe
|
|
163
|
+
if Oboe::Config.tracing?
|
|
164
|
+
report_kvs = extract_trace_details(:count)
|
|
165
|
+
report_kvs[:Query] = selector.try(:empty?) ? "all" : selector.try(:to_json)
|
|
166
|
+
|
|
167
|
+
Oboe::API.trace('mongo', report_kvs) do
|
|
168
|
+
count_without_oboe
|
|
169
|
+
end
|
|
170
|
+
else
|
|
171
|
+
count_without_oboe
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
def sort_with_oboe(sort)
|
|
176
|
+
if Oboe::Config.tracing?
|
|
177
|
+
report_kvs = extract_trace_details(:sort)
|
|
178
|
+
report_kvs[:Query] = selector.try(:empty?) ? "all" : selector.try(:to_json)
|
|
179
|
+
report_kvs[:Order] = sort.to_s
|
|
180
|
+
|
|
181
|
+
Oboe::API.trace('mongo', report_kvs) do
|
|
182
|
+
sort_without_oboe(sort)
|
|
183
|
+
end
|
|
184
|
+
else
|
|
185
|
+
sort_without_oboe(sort)
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
def limit_with_oboe(limit)
|
|
190
|
+
if Oboe::Config.tracing? and not Oboe::Context.tracing_layer_op?(:explain)
|
|
191
|
+
report_kvs = extract_trace_details(:limit)
|
|
192
|
+
report_kvs[:Query] = selector.try(:empty?) ? "all" : selector.try(:to_json)
|
|
193
|
+
report_kvs[:Limit] = limit.to_s
|
|
194
|
+
|
|
195
|
+
Oboe::API.trace('mongo', report_kvs) do
|
|
196
|
+
limit_without_oboe(limit)
|
|
197
|
+
end
|
|
198
|
+
else
|
|
199
|
+
limit_without_oboe(limit)
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
def distinct_with_oboe(key)
|
|
204
|
+
if Oboe::Config.tracing?
|
|
205
|
+
report_kvs = extract_trace_details(:distinct)
|
|
206
|
+
report_kvs[:Query] = selector.try(:empty?) ? "all" : selector.try(:to_json)
|
|
207
|
+
report_kvs[:Key] = key.to_s
|
|
208
|
+
|
|
209
|
+
Oboe::API.trace('mongo', report_kvs) do
|
|
210
|
+
distinct_without_oboe(key)
|
|
211
|
+
end
|
|
212
|
+
else
|
|
213
|
+
distinct_without_oboe(key)
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
def update_with_oboe(change, flags = nil)
|
|
218
|
+
if Oboe::Config.tracing? and not Oboe::Context.tracing_layer_op?([:update_all, :upsert])
|
|
219
|
+
report_kvs = extract_trace_details(:update)
|
|
220
|
+
report_kvs[:Flags] = flags.to_s if flags
|
|
221
|
+
report_kvs[:Update_Document] = change.try(:to_json)
|
|
222
|
+
|
|
223
|
+
Oboe::API.trace('mongo', report_kvs) do
|
|
224
|
+
update_without_oboe(change, flags = nil)
|
|
225
|
+
end
|
|
226
|
+
else
|
|
227
|
+
update_without_oboe(change, flags = nil)
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
def update_all_with_oboe(change)
|
|
232
|
+
if Oboe::Config.tracing?
|
|
233
|
+
report_kvs = extract_trace_details(:update_all)
|
|
234
|
+
report_kvs[:Update_Document] = change.try(:to_json)
|
|
235
|
+
|
|
236
|
+
Oboe::API.trace('mongo', report_kvs, :update_all) do
|
|
237
|
+
update_all_without_oboe(change)
|
|
238
|
+
end
|
|
239
|
+
else
|
|
240
|
+
update_all_without_oboe(change)
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
def upsert_with_oboe(change)
|
|
245
|
+
if Oboe::Config.tracing?
|
|
246
|
+
report_kvs = extract_trace_details(:upsert)
|
|
247
|
+
report_kvs[:Query] = selector.try(:to_json)
|
|
248
|
+
report_kvs[:Update_Document] = change.try(:to_json)
|
|
249
|
+
|
|
250
|
+
Oboe::API.trace('mongo', report_kvs, :upsert) do
|
|
251
|
+
upsert_without_oboe(change)
|
|
252
|
+
end
|
|
253
|
+
else
|
|
254
|
+
upsert_without_oboe(change)
|
|
255
|
+
end
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
def explain_with_oboe
|
|
259
|
+
if Oboe::Config.tracing?
|
|
260
|
+
report_kvs = extract_trace_details(:explain)
|
|
261
|
+
report_kvs[:Query] = selector.try(:empty?) ? "all" : selector.try(:to_json)
|
|
262
|
+
|
|
263
|
+
Oboe::API.trace('mongo', report_kvs, :explain) do
|
|
264
|
+
explain_without_oboe
|
|
265
|
+
end
|
|
266
|
+
else
|
|
267
|
+
explain_without_oboe
|
|
268
|
+
end
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
def modify_with_oboe(change, options = {})
|
|
272
|
+
if Oboe::Config.tracing?
|
|
273
|
+
report_kvs = extract_trace_details(:modify)
|
|
274
|
+
report_kvs[:Update_Document] = selector.try(:empty?) ? "all" : selector.try(:to_json)
|
|
275
|
+
report_kvs[:Change] = change.try(:to_json)
|
|
276
|
+
report_kvs[:Options] = options.try(:to_json)
|
|
277
|
+
|
|
278
|
+
Oboe::API.trace('mongo', report_kvs) do
|
|
279
|
+
modify_without_oboe(change, options)
|
|
280
|
+
end
|
|
281
|
+
else
|
|
282
|
+
modify_without_oboe(change, options)
|
|
283
|
+
end
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
def remove_with_oboe
|
|
287
|
+
if Oboe::Config.tracing?
|
|
288
|
+
report_kvs = extract_trace_details(:remove)
|
|
289
|
+
report_kvs[:Query] = selector.try(:to_json)
|
|
290
|
+
|
|
291
|
+
Oboe::API.trace('mongo', report_kvs) do
|
|
292
|
+
remove_without_oboe
|
|
293
|
+
end
|
|
294
|
+
else
|
|
295
|
+
remove_without_oboe
|
|
296
|
+
end
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
def remove_all_with_oboe
|
|
300
|
+
if Oboe::Config.tracing?
|
|
301
|
+
report_kvs = extract_trace_details(:remove_all)
|
|
302
|
+
report_kvs[:Query] = selector.try(:to_json)
|
|
303
|
+
|
|
304
|
+
Oboe::API.trace('mongo', report_kvs) do
|
|
305
|
+
remove_all_without_oboe
|
|
306
|
+
end
|
|
307
|
+
else
|
|
308
|
+
remove_all_without_oboe
|
|
309
|
+
end
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
Oboe::Inst::Moped::QUERY_OPS.each do |m|
|
|
313
|
+
if method_defined?(m)
|
|
314
|
+
class_eval "alias #{m}_without_oboe #{m}"
|
|
315
|
+
class_eval "alias #{m} #{m}_with_oboe"
|
|
316
|
+
else puts "[oboe/loading] Couldn't properly instrument moped (#{m}). Partial traces may occur."
|
|
317
|
+
end
|
|
318
|
+
end
|
|
319
|
+
end
|
|
320
|
+
end
|
|
321
|
+
end # ::Moped::Query
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
if defined?(::Moped::Collection)
|
|
325
|
+
module ::Moped
|
|
326
|
+
class Collection
|
|
327
|
+
include Oboe::Inst::Moped
|
|
328
|
+
|
|
329
|
+
def extract_trace_details(op)
|
|
330
|
+
report_kvs = {}
|
|
331
|
+
begin
|
|
332
|
+
report_kvs[:Flavor] = Oboe::Inst::Moped::FLAVOR
|
|
333
|
+
# FIXME: We're only grabbing the first of potentially multiple servers here
|
|
334
|
+
report_kvs[:RemoteHost], report_kvs[:RemotePort] = @database.session.cluster.seeds.first.split(':')
|
|
335
|
+
report_kvs[:Database] = @database.name
|
|
336
|
+
report_kvs[:Collection_Name] = @name
|
|
337
|
+
report_kvs[:QueryOp] = op.to_s
|
|
338
|
+
rescue
|
|
339
|
+
end
|
|
340
|
+
report_kvs
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
def drop_with_oboe
|
|
344
|
+
if Oboe::Config.tracing?
|
|
345
|
+
# We report :drop_collection here to be consistent
|
|
346
|
+
# with other mongo implementations
|
|
347
|
+
report_kvs = extract_trace_details(:drop_collection)
|
|
348
|
+
|
|
349
|
+
Oboe::API.trace('mongo', report_kvs) do
|
|
350
|
+
drop_without_oboe
|
|
351
|
+
end
|
|
352
|
+
else
|
|
353
|
+
drop_without_oboe
|
|
354
|
+
end
|
|
355
|
+
end
|
|
356
|
+
|
|
357
|
+
def find_with_oboe(selector = {})
|
|
358
|
+
if Oboe::Config.tracing?
|
|
359
|
+
report_kvs = extract_trace_details(:find)
|
|
360
|
+
report_kvs[:Query] = selector.try(:empty?) ? "all" : selector.try(:to_json)
|
|
361
|
+
|
|
362
|
+
Oboe::API.trace('mongo', report_kvs) do
|
|
363
|
+
find_without_oboe(selector)
|
|
364
|
+
end
|
|
365
|
+
else
|
|
366
|
+
find_without_oboe(selector)
|
|
367
|
+
end
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
def indexes_with_oboe
|
|
371
|
+
if Oboe::Config.tracing?
|
|
372
|
+
report_kvs = extract_trace_details(:indexes)
|
|
373
|
+
|
|
374
|
+
Oboe::API.trace('mongo', report_kvs) do
|
|
375
|
+
indexes_without_oboe
|
|
376
|
+
end
|
|
377
|
+
else
|
|
378
|
+
indexes_without_oboe
|
|
379
|
+
end
|
|
380
|
+
end
|
|
381
|
+
|
|
382
|
+
def insert_with_oboe(documents, flags = nil)
|
|
383
|
+
if Oboe::Config.tracing? and not Oboe::Context.tracing_layer_op?(:create_index)
|
|
384
|
+
report_kvs = extract_trace_details(:insert)
|
|
385
|
+
|
|
386
|
+
Oboe::API.trace('mongo', report_kvs) do
|
|
387
|
+
insert_without_oboe(documents, flags)
|
|
388
|
+
end
|
|
389
|
+
else
|
|
390
|
+
insert_without_oboe(documents, flags)
|
|
391
|
+
end
|
|
392
|
+
end
|
|
393
|
+
|
|
394
|
+
def aggregate_with_oboe(pipeline)
|
|
395
|
+
if Oboe::Config.tracing?
|
|
396
|
+
report_kvs = extract_trace_details(:aggregate)
|
|
397
|
+
|
|
398
|
+
Oboe::API.trace('mongo', report_kvs) do
|
|
399
|
+
aggregate_without_oboe(pipeline)
|
|
400
|
+
end
|
|
401
|
+
else
|
|
402
|
+
aggregate_without_oboe(pipeline)
|
|
403
|
+
end
|
|
404
|
+
end
|
|
405
|
+
|
|
406
|
+
Oboe::Inst::Moped::COLLECTION_OPS.each do |m|
|
|
407
|
+
if method_defined?(m)
|
|
408
|
+
class_eval "alias #{m}_without_oboe #{m}"
|
|
409
|
+
class_eval "alias #{m} #{m}_with_oboe"
|
|
410
|
+
else puts "[oboe/loading] Couldn't properly instrument moped (#{m}). Partial traces may occur."
|
|
411
|
+
end
|
|
412
|
+
end
|
|
413
|
+
end
|
|
414
|
+
end
|
|
415
|
+
end # ::Moped::Collection
|
data/lib/oboe/version.rb
CHANGED
data/lib/oboe_metal.rb
CHANGED
|
@@ -18,15 +18,19 @@ module Oboe_metal
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def self.layer_op=(op)
|
|
21
|
-
@layer_op = op
|
|
21
|
+
@layer_op = op
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def self.layer_op
|
|
25
25
|
@layer_op
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
def self.
|
|
29
|
-
|
|
28
|
+
def self.tracing_layer_op?(operation)
|
|
29
|
+
if operation.is_a?(Array)
|
|
30
|
+
return operation.include?(@layer_op)
|
|
31
|
+
else
|
|
32
|
+
return @layer_op == operation
|
|
33
|
+
end
|
|
30
34
|
end
|
|
31
35
|
end
|
|
32
36
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: oboe
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.7
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -35,6 +35,7 @@ files:
|
|
|
35
35
|
- lib/oboe/frameworks/rails/inst/http.rb
|
|
36
36
|
- lib/oboe/frameworks/rails/inst/rack.rb
|
|
37
37
|
- lib/oboe/frameworks/rails/inst/action_controller.rb
|
|
38
|
+
- lib/oboe/frameworks/rails/inst/moped.rb
|
|
38
39
|
- lib/oboe/frameworks/rails/inst/dalli.rb
|
|
39
40
|
- lib/oboe/frameworks/rails/inst/active_record.rb
|
|
40
41
|
- lib/oboe/frameworks/rails/inst/action_view.rb
|