scout_apm 5.7.1 → 6.0.0
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.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +2 -0
- data/CHANGELOG.markdown +21 -1
- data/README.markdown +20 -8
- data/gems/instruments.gemfile +1 -0
- data/lib/scout_apm/auto_instrument/instruction_sequence.rb +2 -1
- data/lib/scout_apm/auto_instrument/parser.rb +150 -2
- data/lib/scout_apm/auto_instrument/prism.rb +357 -0
- data/lib/scout_apm/auto_instrument/rails.rb +9 -155
- data/lib/scout_apm/auto_instrument/requirements.rb +11 -0
- data/lib/scout_apm/background_job_integrations/delayed_job.rb +25 -1
- data/lib/scout_apm/background_job_integrations/faktory.rb +7 -1
- data/lib/scout_apm/background_job_integrations/good_job.rb +7 -1
- data/lib/scout_apm/background_job_integrations/legacy_sneakers.rb +7 -1
- data/lib/scout_apm/background_job_integrations/que.rb +7 -1
- data/lib/scout_apm/background_job_integrations/shoryuken.rb +7 -1
- data/lib/scout_apm/background_job_integrations/sidekiq.rb +89 -1
- data/lib/scout_apm/background_job_integrations/sneakers.rb +7 -1
- data/lib/scout_apm/background_job_integrations/solid_queue.rb +19 -1
- data/lib/scout_apm/config.rb +32 -7
- data/lib/scout_apm/context.rb +3 -1
- data/lib/scout_apm/error_service/error_record.rb +5 -1
- data/lib/scout_apm/instrument_manager.rb +2 -0
- data/lib/scout_apm/instruments/http_client.rb +10 -0
- data/lib/scout_apm/instruments/httpx.rb +119 -0
- data/lib/scout_apm/instruments/opensearch.rb +131 -0
- data/lib/scout_apm/limited_layer.rb +5 -2
- data/lib/scout_apm/logger.rb +1 -1
- data/lib/scout_apm/sampling.rb +25 -13
- data/lib/scout_apm/server_integrations/puma.rb +21 -4
- data/lib/scout_apm/version.rb +1 -1
- data/lib/scout_apm.rb +9 -4
- data/test/unit/auto_instrument/controller-ast.prism.txt +1015 -0
- data/test/unit/auto_instrument/controller-instrumented.rb +36 -11
- data/test/unit/auto_instrument/controller.rb +25 -0
- data/test/unit/auto_instrument/hash_shorthand_controller-instrumented.rb +28 -10
- data/test/unit/auto_instrument/hash_shorthand_controller.rb +19 -1
- data/test/unit/auto_instrument_test.rb +7 -1
- data/test/unit/background_job_integrations/faktory_test.rb +109 -0
- data/test/unit/background_job_integrations/shoryuken_test.rb +81 -0
- data/test/unit/background_job_integrations/sidekiq_test.rb +38 -0
- data/test/unit/config_test.rb +14 -0
- data/test/unit/error_service/error_buffer_test.rb +32 -0
- data/test/unit/error_test.rb +3 -3
- data/test/unit/ignored_uris_test.rb +7 -0
- data/test/unit/instruments/http_client_test.rb +0 -2
- data/test/unit/instruments/httpx_test.rb +78 -0
- data/test/unit/limited_layer_test.rb +4 -4
- data/test/unit/sampling_test.rb +10 -10
- metadata +10 -3
- data/lib/scout_apm/utils/time.rb +0 -12
- /data/test/unit/auto_instrument/{controller-ast.txt → controller-ast.parser.txt} +0 -0
|
@@ -18,16 +18,16 @@ class LimitedLayerTest < Minitest::Test
|
|
|
18
18
|
ll = ScoutApm::LimitedLayer.new("ActiveRecord")
|
|
19
19
|
|
|
20
20
|
ll.absorb faux_layer("ActiveRecord", "User#Find", 2, 1, 200, 100)
|
|
21
|
-
assert_equal
|
|
21
|
+
assert_equal 2, ll.total_exclusive_time
|
|
22
22
|
assert_equal 2, ll.total_call_time
|
|
23
|
-
assert_equal
|
|
23
|
+
assert_equal 200, ll.total_exclusive_allocations
|
|
24
24
|
assert_equal 200, ll.total_allocations
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
ll.absorb faux_layer("ActiveRecord", "User#Find", 4, 3, 400, 300)
|
|
28
|
-
assert_equal
|
|
28
|
+
assert_equal 6, ll.total_exclusive_time # 4 + 2 (for limited layers, should equal total time)
|
|
29
29
|
assert_equal 6, ll.total_call_time # 4 + 2
|
|
30
|
-
assert_equal
|
|
30
|
+
assert_equal 600, ll.total_exclusive_allocations # 400 + 200 (same goes for allocations)
|
|
31
31
|
assert_equal 600, ll.total_allocations # 400 + 200
|
|
32
32
|
end
|
|
33
33
|
|
data/test/unit/sampling_test.rb
CHANGED
|
@@ -7,7 +7,7 @@ class SamplingTest < Minitest::Test
|
|
|
7
7
|
def setup
|
|
8
8
|
@global_sample_config = FakeConfigOverlay.new(
|
|
9
9
|
{
|
|
10
|
-
'sample_rate' => 80,
|
|
10
|
+
'sample_rate' => 0.80,
|
|
11
11
|
}
|
|
12
12
|
)
|
|
13
13
|
|
|
@@ -23,7 +23,7 @@ class SamplingTest < Minitest::Test
|
|
|
23
23
|
|
|
24
24
|
def test_individual_sample_to_hash
|
|
25
25
|
sampling = ScoutApm::Sampling.new(@individual_config)
|
|
26
|
-
assert_equal({'/foo/bar' =>
|
|
26
|
+
assert_equal({'/foo/bar' => 1, '/foo' => 0.50, '/bar/zap' => 0.80}, sampling.individual_sample_to_hash(@individual_config.value('sample_endpoints')))
|
|
27
27
|
|
|
28
28
|
sampling = ScoutApm::Sampling.new(@global_sample_config)
|
|
29
29
|
assert_nil sampling.individual_sample_to_hash(@global_sample_config.value('sample_endpoints'))
|
|
@@ -38,7 +38,7 @@ class SamplingTest < Minitest::Test
|
|
|
38
38
|
def test_uri_sample
|
|
39
39
|
sampling = ScoutApm::Sampling.new(@individual_config)
|
|
40
40
|
rate = sampling.web_sample_rate('/foo/far')
|
|
41
|
-
|
|
41
|
+
assert_in_delta 0.50, rate
|
|
42
42
|
|
|
43
43
|
rate = sampling.web_sample_rate('/bar')
|
|
44
44
|
assert_nil rate
|
|
@@ -47,7 +47,7 @@ class SamplingTest < Minitest::Test
|
|
|
47
47
|
assert_nil rate
|
|
48
48
|
|
|
49
49
|
rate = sampling.web_sample_rate('/foo/bar/baz')
|
|
50
|
-
assert_equal
|
|
50
|
+
assert_equal 1.0, rate
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
def test_job_ignore
|
|
@@ -58,18 +58,18 @@ class SamplingTest < Minitest::Test
|
|
|
58
58
|
|
|
59
59
|
def test_job_sample
|
|
60
60
|
sampling = ScoutApm::Sampling.new(@individual_config)
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
assert_in_delta 0.50, sampling.job_sample_rate('joba')
|
|
62
|
+
assert_in_delta 0.95, sampling.job_sample_rate('Foo::BarJob')
|
|
63
63
|
assert_nil sampling.job_sample_rate('jobb')
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
def test_sample
|
|
67
67
|
sampling = ScoutApm::Sampling.new(@individual_config)
|
|
68
68
|
sampling.stub(:rand, 0.01) do
|
|
69
|
-
assert_equal(false, sampling.
|
|
69
|
+
assert_equal(false, sampling.downsample?(0.50))
|
|
70
70
|
end
|
|
71
71
|
sampling.stub(:rand, 0.99) do
|
|
72
|
-
assert_equal(true, sampling.
|
|
72
|
+
assert_equal(true, sampling.downsample?(0.50))
|
|
73
73
|
end
|
|
74
74
|
end
|
|
75
75
|
|
|
@@ -104,7 +104,7 @@ class SamplingTest < Minitest::Test
|
|
|
104
104
|
end
|
|
105
105
|
|
|
106
106
|
def test_web_reqeust_general_sampling
|
|
107
|
-
config = FakeConfigOverlay.new(@individual_config.values.merge({'endpoint_sample_rate' => 80}))
|
|
107
|
+
config = FakeConfigOverlay.new(@individual_config.values.merge({'endpoint_sample_rate' => 0.80}))
|
|
108
108
|
sampling = ScoutApm::Sampling.new(config)
|
|
109
109
|
|
|
110
110
|
transaction = FakeTrackedRequest.new_web_request('/foo/far')
|
|
@@ -171,7 +171,7 @@ class SamplingTest < Minitest::Test
|
|
|
171
171
|
end
|
|
172
172
|
|
|
173
173
|
def test_job_general_sampling
|
|
174
|
-
config = FakeConfigOverlay.new(@individual_config.values.merge({'job_sample_rate' => 80}))
|
|
174
|
+
config = FakeConfigOverlay.new(@individual_config.values.merge({'job_sample_rate' => 0.80}))
|
|
175
175
|
sampling = ScoutApm::Sampling.new(config)
|
|
176
176
|
|
|
177
177
|
transaction = FakeTrackedRequest.new_job_request('joba')
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: scout_apm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 6.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Derek Haynes
|
|
@@ -255,7 +255,9 @@ files:
|
|
|
255
255
|
- lib/scout_apm/auto_instrument/instruction_sequence.rb
|
|
256
256
|
- lib/scout_apm/auto_instrument/layer.rb
|
|
257
257
|
- lib/scout_apm/auto_instrument/parser.rb
|
|
258
|
+
- lib/scout_apm/auto_instrument/prism.rb
|
|
258
259
|
- lib/scout_apm/auto_instrument/rails.rb
|
|
260
|
+
- lib/scout_apm/auto_instrument/requirements.rb
|
|
259
261
|
- lib/scout_apm/background_job_integrations/delayed_job.rb
|
|
260
262
|
- lib/scout_apm/background_job_integrations/faktory.rb
|
|
261
263
|
- lib/scout_apm/background_job_integrations/good_job.rb
|
|
@@ -313,6 +315,7 @@ files:
|
|
|
313
315
|
- lib/scout_apm/instruments/grape.rb
|
|
314
316
|
- lib/scout_apm/instruments/http.rb
|
|
315
317
|
- lib/scout_apm/instruments/http_client.rb
|
|
318
|
+
- lib/scout_apm/instruments/httpx.rb
|
|
316
319
|
- lib/scout_apm/instruments/influxdb.rb
|
|
317
320
|
- lib/scout_apm/instruments/memcached.rb
|
|
318
321
|
- lib/scout_apm/instruments/middleware_detailed.rb
|
|
@@ -320,6 +323,7 @@ files:
|
|
|
320
323
|
- lib/scout_apm/instruments/mongoid.rb
|
|
321
324
|
- lib/scout_apm/instruments/moped.rb
|
|
322
325
|
- lib/scout_apm/instruments/net_http.rb
|
|
326
|
+
- lib/scout_apm/instruments/opensearch.rb
|
|
323
327
|
- lib/scout_apm/instruments/percentile_sampler.rb
|
|
324
328
|
- lib/scout_apm/instruments/process/process_cpu.rb
|
|
325
329
|
- lib/scout_apm/instruments/process/process_memory.rb
|
|
@@ -413,7 +417,6 @@ files:
|
|
|
413
417
|
- lib/scout_apm/utils/numbers.rb
|
|
414
418
|
- lib/scout_apm/utils/scm.rb
|
|
415
419
|
- lib/scout_apm/utils/sql_sanitizer.rb
|
|
416
|
-
- lib/scout_apm/utils/time.rb
|
|
417
420
|
- lib/scout_apm/utils/unique_id.rb
|
|
418
421
|
- lib/scout_apm/version.rb
|
|
419
422
|
- lib/tasks/doctor.rake
|
|
@@ -426,7 +429,8 @@ files:
|
|
|
426
429
|
- test/unit/auto_instrument/anonymous_block_value.rb
|
|
427
430
|
- test/unit/auto_instrument/assignments-instrumented.rb
|
|
428
431
|
- test/unit/auto_instrument/assignments.rb
|
|
429
|
-
- test/unit/auto_instrument/controller-ast.txt
|
|
432
|
+
- test/unit/auto_instrument/controller-ast.parser.txt
|
|
433
|
+
- test/unit/auto_instrument/controller-ast.prism.txt
|
|
430
434
|
- test/unit/auto_instrument/controller-instrumented.rb
|
|
431
435
|
- test/unit/auto_instrument/controller.rb
|
|
432
436
|
- test/unit/auto_instrument/hanging_method.rb
|
|
@@ -435,6 +439,8 @@ files:
|
|
|
435
439
|
- test/unit/auto_instrument/rescue_from-instrumented.rb
|
|
436
440
|
- test/unit/auto_instrument/rescue_from.rb
|
|
437
441
|
- test/unit/auto_instrument_test.rb
|
|
442
|
+
- test/unit/background_job_integrations/faktory_test.rb
|
|
443
|
+
- test/unit/background_job_integrations/shoryuken_test.rb
|
|
438
444
|
- test/unit/background_job_integrations/sidekiq_test.rb
|
|
439
445
|
- test/unit/config_test.rb
|
|
440
446
|
- test/unit/context_test.rb
|
|
@@ -459,6 +465,7 @@ files:
|
|
|
459
465
|
- test/unit/instruments/fixtures/test_view.html.erb
|
|
460
466
|
- test/unit/instruments/http_client_test.rb
|
|
461
467
|
- test/unit/instruments/http_test.rb
|
|
468
|
+
- test/unit/instruments/httpx_test.rb
|
|
462
469
|
- test/unit/instruments/moped_test.rb
|
|
463
470
|
- test/unit/instruments/net_http_test.rb
|
|
464
471
|
- test/unit/instruments/percentile_sampler_test.rb
|
data/lib/scout_apm/utils/time.rb
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
module ScoutApm
|
|
2
|
-
module Utils
|
|
3
|
-
class Time
|
|
4
|
-
# Handles both integer (unix) time and Time objects
|
|
5
|
-
# example output: "09/10/15 04:34:28 -0600"
|
|
6
|
-
def self.to_s(time)
|
|
7
|
-
return to_s(::Time.at(time)) if time.is_a? Integer
|
|
8
|
-
time.strftime("%m/%d/%y %H:%M:%S %z")
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
File without changes
|