scout_apm 2.1.32 → 2.2.0.pre0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/CHANGELOG.markdown +2 -161
- data/Rakefile +2 -2
- data/ext/allocations/allocations.c +0 -6
- data/ext/allocations/extconf.rb +0 -1
- data/ext/stacks/extconf.rb +33 -0
- data/ext/stacks/scout_atomics.h +86 -0
- data/ext/stacks/stacks.c +744 -0
- data/lib/scout_apm.rb +16 -24
- data/lib/scout_apm/agent.rb +38 -93
- data/lib/scout_apm/agent/logging.rb +1 -6
- data/lib/scout_apm/agent/reporting.rb +6 -8
- data/lib/scout_apm/app_server_load.rb +10 -21
- data/lib/scout_apm/attribute_arranger.rb +2 -0
- data/lib/scout_apm/background_job_integrations/delayed_job.rb +1 -71
- data/lib/scout_apm/background_job_integrations/sidekiq.rb +27 -66
- data/lib/scout_apm/background_worker.rb +15 -19
- data/lib/scout_apm/capacity.rb +57 -0
- data/lib/scout_apm/config.rb +29 -135
- data/lib/scout_apm/context.rb +5 -9
- data/lib/scout_apm/deploy_integrations/capistrano_2.cap +12 -0
- data/lib/scout_apm/deploy_integrations/capistrano_2.rb +83 -0
- data/lib/scout_apm/deploy_integrations/capistrano_3.cap +12 -0
- data/lib/scout_apm/deploy_integrations/capistrano_3.rb +88 -0
- data/lib/scout_apm/environment.rb +15 -22
- data/lib/scout_apm/histogram.rb +2 -11
- data/lib/scout_apm/instant/assets/xmlhttp_instrumentation.html +2 -2
- data/lib/scout_apm/instant/middleware.rb +57 -198
- data/lib/scout_apm/instruments/action_controller_rails_2.rb +2 -1
- data/lib/scout_apm/instruments/action_controller_rails_3_rails4.rb +59 -90
- data/lib/scout_apm/instruments/active_record.rb +5 -7
- data/lib/scout_apm/instruments/delayed_job.rb +57 -0
- data/lib/scout_apm/instruments/grape.rb +3 -4
- data/lib/scout_apm/instruments/middleware_detailed.rb +6 -4
- data/lib/scout_apm/instruments/middleware_summary.rb +1 -39
- data/lib/scout_apm/instruments/mongoid.rb +3 -24
- data/lib/scout_apm/instruments/net_http.rb +2 -7
- data/lib/scout_apm/instruments/percentile_sampler.rb +19 -36
- data/lib/scout_apm/instruments/process/process_cpu.rb +2 -3
- data/lib/scout_apm/instruments/process/process_memory.rb +3 -3
- data/lib/scout_apm/layaway.rb +33 -76
- data/lib/scout_apm/layer.rb +59 -16
- data/lib/scout_apm/layer_converters/converter_base.rb +0 -199
- data/lib/scout_apm/layer_converters/job_converter.rb +1 -1
- data/lib/scout_apm/layer_converters/metric_converter.rb +1 -1
- data/lib/scout_apm/layer_converters/slow_job_converter.rb +90 -15
- data/lib/scout_apm/layer_converters/slow_request_converter.rb +101 -13
- data/lib/scout_apm/metric_set.rb +1 -9
- data/lib/scout_apm/metric_stats.rb +8 -8
- data/lib/scout_apm/reporter.rb +15 -51
- data/lib/scout_apm/request_histograms.rb +0 -4
- data/lib/scout_apm/request_manager.rb +1 -2
- data/lib/scout_apm/scored_item_set.rb +0 -7
- data/lib/scout_apm/serializers/deploy_serializer.rb +16 -0
- data/lib/scout_apm/serializers/payload_serializer.rb +3 -9
- data/lib/scout_apm/serializers/payload_serializer_to_json.rb +5 -2
- data/lib/scout_apm/serializers/slow_jobs_serializer_to_json.rb +1 -2
- data/lib/scout_apm/server_integrations/puma.rb +2 -5
- data/lib/scout_apm/slow_item_set.rb +80 -0
- data/lib/scout_apm/slow_job_record.rb +1 -6
- data/lib/scout_apm/slow_transaction.rb +2 -20
- data/lib/scout_apm/store.rb +12 -50
- data/lib/scout_apm/trace_compactor.rb +311 -0
- data/lib/scout_apm/tracked_request.rb +37 -128
- data/lib/scout_apm/utils/backtrace_parser.rb +5 -7
- data/lib/scout_apm/utils/fake_stacks.rb +83 -0
- data/lib/scout_apm/version.rb +1 -1
- data/scout_apm.gemspec +4 -6
- data/test/test_helper.rb +0 -56
- data/test/unit/config_test.rb +9 -60
- data/test/unit/histogram_test.rb +0 -14
- data/test/unit/layaway_test.rb +16 -31
- data/test/unit/serializers/payload_serializer_test.rb +105 -3
- data/test/unit/slow_item_set_test.rb +94 -0
- data/test/unit/slow_job_policy_test.rb +49 -0
- data/test/unit/slow_request_policy_test.rb +5 -4
- data/test/unit/utils/backtrace_parser_test.rb +0 -19
- data/tester.rb +53 -0
- metadata +29 -124
- data/.rubocop.yml +0 -8
- data/Guardfile +0 -42
- data/ext/rusage/README.md +0 -26
- data/ext/rusage/extconf.rb +0 -5
- data/ext/rusage/rusage.c +0 -52
- data/lib/scout_apm/background_job_integrations/resque.rb +0 -85
- data/lib/scout_apm/background_recorder.rb +0 -43
- data/lib/scout_apm/debug.rb +0 -37
- data/lib/scout_apm/git_revision.rb +0 -51
- data/lib/scout_apm/instruments/action_view.rb +0 -49
- data/lib/scout_apm/instruments/resque.rb +0 -40
- data/lib/scout_apm/layer_children_set.rb +0 -77
- data/lib/scout_apm/limited_layer.rb +0 -122
- data/lib/scout_apm/rack.rb +0 -26
- data/lib/scout_apm/remote/message.rb +0 -23
- data/lib/scout_apm/remote/recorder.rb +0 -57
- data/lib/scout_apm/remote/router.rb +0 -49
- data/lib/scout_apm/remote/server.rb +0 -58
- data/lib/scout_apm/serializers/histograms_serializer_to_json.rb +0 -21
- data/lib/scout_apm/synchronous_recorder.rb +0 -26
- data/lib/scout_apm/utils/gzip_helper.rb +0 -24
- data/lib/scout_apm/utils/numbers.rb +0 -14
- data/lib/scout_apm/utils/scm.rb +0 -14
- data/test/unit/background_job_integrations/sidekiq_test.rb +0 -104
- data/test/unit/context_test.rb +0 -30
- data/test/unit/git_revision_test.rb +0 -15
- data/test/unit/instruments/net_http_test.rb +0 -21
- data/test/unit/instruments/percentile_sampler_test.rb +0 -137
- data/test/unit/layer_children_set_test.rb +0 -88
- data/test/unit/limited_layer_test.rb +0 -53
- data/test/unit/remote/test_message.rb +0 -13
- data/test/unit/remote/test_router.rb +0 -33
- data/test/unit/remote/test_server.rb +0 -15
- data/test/unit/store_test.rb +0 -89
- data/test/unit/test_tracked_request.rb +0 -87
- data/test/unit/utils/numbers_test.rb +0 -15
- data/test/unit/utils/scm.rb +0 -17
@@ -42,47 +42,35 @@ module ScoutApm
|
|
42
42
|
# Whereas the instant_key gets set per-request in reponse to a URL param, dev_trace is set in the config file
|
43
43
|
attr_accessor :dev_trace
|
44
44
|
|
45
|
-
# An object that responds to `record!(TrackedRequest)` to store this tracked request
|
46
|
-
attr_reader :recorder
|
47
|
-
|
48
45
|
def initialize(store)
|
49
46
|
@store = store #this is passed in so we can use a real store (normal operation) or fake store (instant mode only)
|
50
47
|
@layers = []
|
51
48
|
@call_set = Hash.new { |h, k| h[k] = CallSet.new }
|
52
49
|
@annotations = {}
|
53
|
-
@ignoring_children =
|
50
|
+
@ignoring_children = false
|
54
51
|
@context = Context.new
|
55
52
|
@root_layer = nil
|
56
53
|
@error = false
|
57
|
-
@stopping = false
|
58
54
|
@instant_key = nil
|
59
55
|
@mem_start = mem_usage
|
60
|
-
@dev_trace = ScoutApm::Agent.instance.config.value('dev_trace') &&
|
61
|
-
@recorder = ScoutApm::Agent.instance.recorder
|
62
|
-
|
63
|
-
ignore_request! if @recorder.nil?
|
56
|
+
@dev_trace = ScoutApm::Agent.instance.config.value('dev_trace') && Rails.env.development?
|
64
57
|
end
|
65
58
|
|
66
59
|
def start_layer(layer)
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
return if ignoring_children?
|
60
|
+
if ignoring_children?
|
61
|
+
return
|
62
|
+
end
|
71
63
|
|
72
|
-
|
64
|
+
layer.start_sampling
|
73
65
|
|
74
66
|
start_request(layer) unless @root_layer
|
67
|
+
@layers[-1].add_child(layer) if @layers.any?
|
75
68
|
@layers.push(layer)
|
76
69
|
end
|
77
70
|
|
78
71
|
def stop_layer
|
79
|
-
# If we're already stopping, don't do additional layers
|
80
|
-
return if stopping?
|
81
|
-
|
82
72
|
return if ignoring_children?
|
83
73
|
|
84
|
-
return ignoring_stop_layer if ignoring_request?
|
85
|
-
|
86
74
|
layer = @layers.pop
|
87
75
|
|
88
76
|
# Safeguard against a mismatch in the layer tracking in an instrument.
|
@@ -90,16 +78,15 @@ module ScoutApm
|
|
90
78
|
# lined up correctly. If stop_layer gets called twice, when it should
|
91
79
|
# only have been called once you'll end up with this error.
|
92
80
|
if layer.nil?
|
93
|
-
logger.warn("Error stopping layer, was nil. Root Layer: #{@root_layer.inspect}")
|
81
|
+
ScoutApm::Agent.instance.logger.warn("Error stopping layer, was nil. Root Layer: #{@root_layer.inspect}")
|
94
82
|
stop_request
|
95
83
|
return
|
96
84
|
end
|
97
85
|
|
86
|
+
layer.record_traces!
|
98
87
|
layer.record_stop_time!
|
99
88
|
layer.record_allocations!
|
100
89
|
|
101
|
-
@layers[-1].add_child(layer) if @layers.any?
|
102
|
-
|
103
90
|
# This must be called before checking if a backtrace should be collected as the call count influences our capture logic.
|
104
91
|
# We call `#update_call_counts in stop layer to ensure the layer has a final desc. Layer#desc is updated during the AR instrumentation flow.
|
105
92
|
update_call_counts!(layer)
|
@@ -109,6 +96,8 @@ module ScoutApm
|
|
109
96
|
|
110
97
|
if finalized?
|
111
98
|
stop_request
|
99
|
+
else
|
100
|
+
continue_sampling_for_layers if ScoutApm::Agent.instance.config.value('profile')
|
112
101
|
end
|
113
102
|
end
|
114
103
|
|
@@ -126,8 +115,6 @@ module ScoutApm
|
|
126
115
|
|
127
116
|
BACKTRACE_BLACKLIST = ["Controller", "Job"]
|
128
117
|
def capture_backtrace?(layer)
|
129
|
-
return if ignoring_request?
|
130
|
-
|
131
118
|
# Never capture backtraces for this kind of layer. The backtrace will
|
132
119
|
# always be 100% framework code.
|
133
120
|
return false if BACKTRACE_BLACKLIST.include?(layer.type)
|
@@ -171,6 +158,13 @@ module ScoutApm
|
|
171
158
|
@layers.none?
|
172
159
|
end
|
173
160
|
|
161
|
+
def continue_sampling_for_layers
|
162
|
+
if last_traced_layer = @layers.select{|layer| layer.traced?}.last
|
163
|
+
ScoutApm::Instruments::Stacks.update_indexes(@layers.last.frame_index, @layers.last.trace_index)
|
164
|
+
ScoutApm::Instruments::Stacks.start_sampling
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
174
168
|
# Run at the beginning of the whole request
|
175
169
|
#
|
176
170
|
# * Capture the first layer as the root_layer
|
@@ -182,15 +176,21 @@ module ScoutApm
|
|
182
176
|
#
|
183
177
|
# * Send the request off to be stored
|
184
178
|
def stop_request
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
recorder.record!(self)
|
179
|
+
if ScoutApm::Agent.instance.config.value('profile')
|
180
|
+
ScoutApm::Instruments::Stacks.stop_sampling(true)
|
181
|
+
ScoutApm::Instruments::Stacks.update_indexes(0, 0)
|
189
182
|
end
|
183
|
+
record!
|
184
|
+
end
|
185
|
+
|
186
|
+
# Enable ScoutProf for this thread
|
187
|
+
def enable_profiled_thread!
|
188
|
+
ScoutApm::Instruments::Stacks.add_profiled_thread
|
190
189
|
end
|
191
190
|
|
192
|
-
|
193
|
-
|
191
|
+
# Disable ScoutProf for this thread
|
192
|
+
def disable_profiled_thread!
|
193
|
+
ScoutApm::Instruments::Stacks.remove_profiled_thread
|
194
194
|
end
|
195
195
|
|
196
196
|
###################################
|
@@ -236,8 +236,6 @@ module ScoutApm
|
|
236
236
|
end
|
237
237
|
|
238
238
|
def instant?
|
239
|
-
return false if ignoring_request?
|
240
|
-
|
241
239
|
instant_key
|
242
240
|
end
|
243
241
|
|
@@ -245,20 +243,10 @@ module ScoutApm
|
|
245
243
|
# Persist the Request
|
246
244
|
###################################
|
247
245
|
|
248
|
-
def recorded!
|
249
|
-
@recorded = true
|
250
|
-
end
|
251
|
-
|
252
246
|
# Convert this request to the appropriate structure, then report it into
|
253
247
|
# the peristent Store object
|
254
248
|
def record!
|
255
|
-
recorded
|
256
|
-
|
257
|
-
return if ignoring_request?
|
258
|
-
|
259
|
-
# If we didn't have store, but we're trying to record anyway, go
|
260
|
-
# figure that out. (this happens in Remote Agent scenarios)
|
261
|
-
restore_store if @store.nil?
|
249
|
+
@recorded = true
|
262
250
|
|
263
251
|
# Bail out early if the user asked us to ignore this uri
|
264
252
|
return if ScoutApm::Agent.instance.ignored_uris.ignore?(annotations[:uri])
|
@@ -290,7 +278,7 @@ module ScoutApm
|
|
290
278
|
# If there's an instant_key, it means we need to report this right away
|
291
279
|
if instant?
|
292
280
|
trace = slow_converter.call
|
293
|
-
ScoutApm::InstantReporting.new(trace, instant_key).call
|
281
|
+
ScoutApm::InstantReporting.new(trace, instant_key).call()
|
294
282
|
end
|
295
283
|
end
|
296
284
|
|
@@ -304,12 +292,11 @@ module ScoutApm
|
|
304
292
|
|
305
293
|
allocation_metrics = LayerConverters::AllocationMetricConverter.new(self).call
|
306
294
|
@store.track!(allocation_metrics)
|
295
|
+
|
307
296
|
end
|
308
297
|
|
309
298
|
# Only call this after the request is complete
|
310
299
|
def unique_name
|
311
|
-
return nil if ignoring_request?
|
312
|
-
|
313
300
|
@unique_name ||= begin
|
314
301
|
scope_layer = LayerConverters::ConverterBase.new(self).scope_layer
|
315
302
|
if scope_layer
|
@@ -324,8 +311,6 @@ module ScoutApm
|
|
324
311
|
# Used to know when we should just create a new one (don't attempt to add
|
325
312
|
# data to an already-recorded request). See RequestManager
|
326
313
|
def recorded?
|
327
|
-
return ignoring_recorded? if ignoring_request?
|
328
|
-
|
329
314
|
@recorded
|
330
315
|
end
|
331
316
|
|
@@ -338,36 +323,21 @@ module ScoutApm
|
|
338
323
|
# specific, and useful than the fact that InfluxDB happens to use Net::HTTP
|
339
324
|
# internally
|
340
325
|
#
|
341
|
-
# When enabled, new layers won't be added to the current Request
|
342
|
-
# to stop_layer will be ignored.
|
326
|
+
# When enabled, new layers won't be added to the current Request.
|
343
327
|
#
|
344
328
|
# Do not forget to turn if off when leaving a layer, it is the
|
345
329
|
# instrumentation's task to do that.
|
346
|
-
#
|
347
|
-
# When you use this in code, be sure to use it in this order:
|
348
|
-
#
|
349
|
-
# start_layer
|
350
|
-
# ignore_children
|
351
|
-
# -> call
|
352
|
-
# acknowledge_children
|
353
|
-
# stop_layer
|
354
|
-
#
|
355
|
-
# If you don't call it in this order, it's possible to get out of sync, and
|
356
|
-
# have an ignored start and an actually-executed stop, causing layers to
|
357
|
-
# get out of sync
|
358
330
|
|
359
331
|
def ignore_children!
|
360
|
-
@ignoring_children
|
332
|
+
@ignoring_children = true
|
361
333
|
end
|
362
334
|
|
363
335
|
def acknowledge_children!
|
364
|
-
|
365
|
-
@ignoring_children -= 1
|
366
|
-
end
|
336
|
+
@ignoring_children = false
|
367
337
|
end
|
368
338
|
|
369
339
|
def ignoring_children?
|
370
|
-
@ignoring_children
|
340
|
+
@ignoring_children
|
371
341
|
end
|
372
342
|
|
373
343
|
# Grab backtraces more aggressively when running in dev trace mode
|
@@ -375,66 +345,5 @@ module ScoutApm
|
|
375
345
|
dev_trace ? 0.05 : 0.5 # the minimum threshold in seconds to record the backtrace for a metric.
|
376
346
|
end
|
377
347
|
|
378
|
-
################################################################################
|
379
|
-
# Ignoring the rest of a request
|
380
|
-
################################################################################
|
381
|
-
|
382
|
-
# At any point in the request, calling code or instrumentation can call
|
383
|
-
# `ignore_request!` to immediately stop recording any information about new
|
384
|
-
# layers, and delete any existing layer info. This class will still exist,
|
385
|
-
# and respond to methods as normal, but `record!` won't be called, and no
|
386
|
-
# data will be recorded.
|
387
|
-
|
388
|
-
def ignore_request!
|
389
|
-
return if @ignoring_request
|
390
|
-
|
391
|
-
# Set instance variable
|
392
|
-
@ignoring_request = true
|
393
|
-
|
394
|
-
# Store data we'll need
|
395
|
-
@ignoring_depth = @layers.length
|
396
|
-
|
397
|
-
# Clear data
|
398
|
-
@layers = []
|
399
|
-
@root_layer = nil
|
400
|
-
@call_set = nil
|
401
|
-
@annotations = {}
|
402
|
-
@instant_key = nil
|
403
|
-
end
|
404
|
-
|
405
|
-
def ignoring_request?
|
406
|
-
@ignoring_request
|
407
|
-
end
|
408
|
-
|
409
|
-
def ignoring_start_layer
|
410
|
-
@ignoring_depth += 1
|
411
|
-
end
|
412
|
-
|
413
|
-
def ignoring_stop_layer
|
414
|
-
@ignoring_depth -= 1
|
415
|
-
end
|
416
|
-
|
417
|
-
def ignoring_recorded?
|
418
|
-
@ignoring_depth <= 0
|
419
|
-
end
|
420
|
-
|
421
|
-
def logger
|
422
|
-
ScoutApm::Agent.instance.logger
|
423
|
-
end
|
424
|
-
|
425
|
-
# Actually go fetch & make-real any lazily created data.
|
426
|
-
# Clean up any cleverness in objects.
|
427
|
-
# Makes this object ready to be Marshal Dumped (or otherwise serialized)
|
428
|
-
def prepare_to_dump!
|
429
|
-
@call_set = nil
|
430
|
-
@store = nil
|
431
|
-
@recorder = nil
|
432
|
-
end
|
433
|
-
|
434
|
-
# Go re-fetch the store based on what the Agent's official one is. Used
|
435
|
-
# after hydrating a dumped TrackedRequest
|
436
|
-
def restore_store
|
437
|
-
@store = ScoutApm::Agent.instance.store
|
438
|
-
end
|
439
348
|
end
|
440
349
|
end
|
@@ -6,30 +6,28 @@ require 'scout_apm/environment'
|
|
6
6
|
module ScoutApm
|
7
7
|
module Utils
|
8
8
|
class BacktraceParser
|
9
|
-
|
10
|
-
APP_FRAMES =
|
9
|
+
|
10
|
+
APP_FRAMES = 3 # will return up to 3 frames from the app stack.
|
11
11
|
|
12
12
|
attr_reader :call_stack
|
13
13
|
|
14
14
|
def initialize(call_stack, root=ScoutApm::Environment.instance.root)
|
15
15
|
@call_stack = call_stack
|
16
16
|
# We can't use a constant as it'd be too early to fetch environment info
|
17
|
-
|
18
|
-
# This regex looks for files under the app root, inside lib/, app/, and
|
19
|
-
# config/ dirs, and captures the path under root.
|
20
|
-
@@app_dir_regex = %r[#{root}/((?:lib/|app/|config/).*)]
|
17
|
+
@@app_dir_regex = %r|#{root}/(.*)|
|
21
18
|
end
|
22
19
|
|
23
20
|
def call
|
24
21
|
stack = []
|
25
22
|
call_stack.each do |c|
|
26
23
|
if m = c.match(@@app_dir_regex)
|
27
|
-
stack <<
|
24
|
+
stack << m[1]
|
28
25
|
break if stack.size == APP_FRAMES
|
29
26
|
end
|
30
27
|
end
|
31
28
|
stack
|
32
29
|
end
|
30
|
+
|
33
31
|
end
|
34
32
|
end
|
35
33
|
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# A fake implementation of the allocations native extension, for systems that don't support it.
|
2
|
+
module ScoutApm
|
3
|
+
module Instruments
|
4
|
+
class Stacks
|
5
|
+
ENABLED = false
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def install(*args)
|
9
|
+
# noop
|
10
|
+
end
|
11
|
+
|
12
|
+
def uninstall(*args)
|
13
|
+
# noop
|
14
|
+
end
|
15
|
+
|
16
|
+
def start(*args)
|
17
|
+
# noop
|
18
|
+
end
|
19
|
+
|
20
|
+
def add_profiled_thread(*args)
|
21
|
+
# noop
|
22
|
+
end
|
23
|
+
|
24
|
+
def remove_profiled_thread(*args)
|
25
|
+
# noop
|
26
|
+
end
|
27
|
+
|
28
|
+
def profile_frames(*args)
|
29
|
+
[] # frames that were profiled (none)
|
30
|
+
end
|
31
|
+
|
32
|
+
def start_sampling(*args)
|
33
|
+
# noop
|
34
|
+
end
|
35
|
+
|
36
|
+
def stop_sampling(*args)
|
37
|
+
# noop
|
38
|
+
end
|
39
|
+
|
40
|
+
def update_indexes(*args)
|
41
|
+
# noop
|
42
|
+
true
|
43
|
+
end
|
44
|
+
|
45
|
+
def current_trace_index(*args)
|
46
|
+
:opaque_value
|
47
|
+
end
|
48
|
+
|
49
|
+
def current_frame_index(*args)
|
50
|
+
:opaque_value
|
51
|
+
end
|
52
|
+
|
53
|
+
def frame_klass(*args)
|
54
|
+
nil
|
55
|
+
end
|
56
|
+
|
57
|
+
def frame_method(*args)
|
58
|
+
nil
|
59
|
+
end
|
60
|
+
|
61
|
+
def frame_file(*args)
|
62
|
+
nil
|
63
|
+
end
|
64
|
+
|
65
|
+
def frame_lineno(*args)
|
66
|
+
nil
|
67
|
+
end
|
68
|
+
|
69
|
+
def skipped_in_gc(*args)
|
70
|
+
0
|
71
|
+
end
|
72
|
+
|
73
|
+
def skipped_in_handler(*args)
|
74
|
+
0
|
75
|
+
end
|
76
|
+
|
77
|
+
def skipped_in_job_registered(*args)
|
78
|
+
0
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
data/lib/scout_apm/version.rb
CHANGED
data/scout_apm.gemspec
CHANGED
@@ -19,15 +19,13 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib","data"]
|
21
21
|
s.extensions << 'ext/allocations/extconf.rb'
|
22
|
-
s.extensions << 'ext/
|
22
|
+
s.extensions << 'ext/stacks/extconf.rb'
|
23
|
+
|
24
|
+
s.add_runtime_dependency "rusage", '~> 0.2.0'
|
23
25
|
|
24
26
|
s.add_development_dependency "minitest"
|
25
|
-
s.add_development_dependency 'mocha'
|
26
27
|
s.add_development_dependency "pry"
|
27
28
|
s.add_development_dependency "m"
|
28
29
|
s.add_development_dependency "simplecov"
|
29
30
|
s.add_development_dependency "rake-compiler"
|
30
|
-
|
31
|
-
s.add_development_dependency "guard"
|
32
|
-
s.add_development_dependency "guard-minitest"
|
33
|
-
end
|
31
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -5,7 +5,6 @@ SimpleCov.start
|
|
5
5
|
require 'minitest/autorun'
|
6
6
|
require 'minitest/unit'
|
7
7
|
require 'minitest/pride'
|
8
|
-
require 'mocha/mini_test'
|
9
8
|
require 'pry'
|
10
9
|
|
11
10
|
|
@@ -16,44 +15,8 @@ Kernel.module_eval do
|
|
16
15
|
def self.const_unset(const)
|
17
16
|
self.instance_eval { remove_const(const) }
|
18
17
|
end
|
19
|
-
|
20
|
-
def silence_warnings(&block)
|
21
|
-
warn_level = $VERBOSE
|
22
|
-
$VERBOSE = nil
|
23
|
-
result = block.call
|
24
|
-
$VERBOSE = warn_level
|
25
|
-
result
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
# A test helper class to create a temporary "configuration" we can control entirely purposes
|
30
|
-
class FakeConfigOverlay
|
31
|
-
def initialize(values)
|
32
|
-
@values = values
|
33
|
-
end
|
34
|
-
|
35
|
-
def value(key)
|
36
|
-
@values[key]
|
37
|
-
end
|
38
|
-
|
39
|
-
def has_key?(key)
|
40
|
-
@values.has_key?(key)
|
41
|
-
end
|
42
18
|
end
|
43
19
|
|
44
|
-
class FakeEnvironment
|
45
|
-
def initialize(values)
|
46
|
-
@values = values
|
47
|
-
end
|
48
|
-
|
49
|
-
def method_missing(sym)
|
50
|
-
if @values.has_key?(sym)
|
51
|
-
@values[sym]
|
52
|
-
else
|
53
|
-
raise "#{sym} not found in FakeEnvironment"
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
20
|
|
58
21
|
# Helpers available to all tests
|
59
22
|
class Minitest::Test
|
@@ -79,25 +42,6 @@ class Minitest::Test
|
|
79
42
|
ScoutApm::Agent.instance.instance_variable_set("@logger", @logger)
|
80
43
|
end
|
81
44
|
|
82
|
-
def make_fake_environment(values)
|
83
|
-
FakeEnvironment.new(values)
|
84
|
-
end
|
85
|
-
|
86
|
-
def make_fake_config(values)
|
87
|
-
ScoutApm::Config.new(FakeConfigOverlay.new(values))
|
88
|
-
end
|
89
|
-
|
90
45
|
DATA_FILE_DIR = File.dirname(__FILE__) + '/tmp'
|
91
46
|
DATA_FILE_PATH = "#{DATA_FILE_DIR}/scout_apm.db"
|
92
47
|
end
|
93
|
-
|
94
|
-
|
95
|
-
module CustomAsserts
|
96
|
-
def assert_false(thing)
|
97
|
-
assert !thing
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
class Minitest::Test
|
102
|
-
include CustomAsserts
|
103
|
-
end
|