scout_apm 3.0.0.pre26 → 4.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/test.yml +49 -0
- data/.gitignore +1 -1
- data/.rubocop.yml +5 -5
- data/.travis.yml +19 -14
- data/CHANGELOG.markdown +143 -4
- data/Gemfile +1 -7
- data/README.markdown +13 -4
- data/Rakefile +1 -1
- data/ext/allocations/allocations.c +2 -0
- data/gems/README.md +28 -0
- data/gems/octoshark.gemfile +4 -0
- data/gems/rails3.gemfile +5 -0
- data/gems/rails4.gemfile +4 -0
- data/gems/rails5.gemfile +4 -0
- data/gems/rails6.gemfile +4 -0
- data/lib/scout_apm.rb +39 -9
- data/lib/scout_apm/agent.rb +29 -10
- data/lib/scout_apm/agent/exit_handler.rb +0 -1
- data/lib/scout_apm/agent_context.rb +22 -3
- data/lib/scout_apm/app_server_load.rb +7 -2
- data/lib/scout_apm/attribute_arranger.rb +0 -2
- data/lib/scout_apm/auto_instrument.rb +5 -0
- data/lib/scout_apm/auto_instrument/instruction_sequence.rb +31 -0
- data/lib/scout_apm/auto_instrument/layer.rb +23 -0
- data/lib/scout_apm/auto_instrument/parser.rb +27 -0
- data/lib/scout_apm/auto_instrument/rails.rb +175 -0
- data/lib/scout_apm/background_job_integrations/legacy_sneakers.rb +55 -0
- data/lib/scout_apm/background_job_integrations/que.rb +134 -0
- data/lib/scout_apm/background_job_integrations/resque.rb +6 -2
- data/lib/scout_apm/background_job_integrations/shoryuken.rb +124 -0
- data/lib/scout_apm/background_job_integrations/sidekiq.rb +5 -19
- data/lib/scout_apm/background_job_integrations/sneakers.rb +87 -0
- data/lib/scout_apm/config.rb +45 -8
- data/lib/scout_apm/detailed_trace.rb +217 -0
- data/lib/scout_apm/environment.rb +19 -1
- data/lib/scout_apm/error.rb +27 -0
- data/lib/scout_apm/error_service.rb +32 -0
- data/lib/scout_apm/error_service/error_buffer.rb +39 -0
- data/lib/scout_apm/error_service/error_record.rb +211 -0
- data/lib/scout_apm/error_service/ignored_exceptions.rb +66 -0
- data/lib/scout_apm/error_service/middleware.rb +32 -0
- data/lib/scout_apm/error_service/notifier.rb +33 -0
- data/lib/scout_apm/error_service/payload.rb +47 -0
- data/lib/scout_apm/error_service/periodic_work.rb +17 -0
- data/lib/scout_apm/error_service/railtie.rb +11 -0
- data/lib/scout_apm/error_service/sidekiq.rb +80 -0
- data/lib/scout_apm/extensions/transaction_callback_payload.rb +1 -1
- data/lib/scout_apm/fake_store.rb +3 -0
- data/lib/scout_apm/framework_integrations/rails_2.rb +2 -1
- data/lib/scout_apm/framework_integrations/rails_3_or_4.rb +3 -1
- data/lib/scout_apm/git_revision.rb +6 -3
- data/lib/scout_apm/instant/middleware.rb +2 -1
- data/lib/scout_apm/instrument_manager.rb +9 -7
- data/lib/scout_apm/instruments/action_controller_rails_2.rb +3 -1
- data/lib/scout_apm/instruments/action_controller_rails_3_rails4.rb +56 -55
- data/lib/scout_apm/instruments/action_view.rb +126 -26
- data/lib/scout_apm/instruments/active_record.rb +66 -18
- data/lib/scout_apm/instruments/http.rb +48 -0
- data/lib/scout_apm/instruments/memcached.rb +43 -0
- data/lib/scout_apm/instruments/mongoid.rb +9 -4
- data/lib/scout_apm/instruments/net_http.rb +8 -1
- data/lib/scout_apm/instruments/typhoeus.rb +87 -0
- data/lib/scout_apm/job_record.rb +4 -2
- data/lib/scout_apm/layaway_file.rb +4 -0
- data/lib/scout_apm/layer.rb +6 -57
- data/lib/scout_apm/layer_children_set.rb +9 -8
- data/lib/scout_apm/layer_converters/converter_base.rb +15 -30
- data/lib/scout_apm/layer_converters/database_converter.rb +2 -15
- data/lib/scout_apm/layer_converters/slow_job_converter.rb +12 -2
- data/lib/scout_apm/layer_converters/slow_request_converter.rb +14 -4
- data/lib/scout_apm/layer_converters/trace_converter.rb +184 -0
- data/lib/scout_apm/limited_layer.rb +0 -7
- data/lib/scout_apm/metric_stats.rb +0 -8
- data/lib/scout_apm/middleware.rb +1 -1
- data/lib/scout_apm/periodic_work.rb +19 -0
- data/lib/scout_apm/remote/message.rb +4 -0
- data/lib/scout_apm/remote/server.rb +13 -1
- data/lib/scout_apm/reporter.rb +8 -3
- data/lib/scout_apm/reporting.rb +2 -1
- data/lib/scout_apm/request_histograms.rb +8 -0
- data/lib/scout_apm/serializers/app_server_load_serializer.rb +4 -0
- data/lib/scout_apm/serializers/directive_serializer.rb +4 -0
- data/lib/scout_apm/serializers/payload_serializer.rb +2 -2
- data/lib/scout_apm/serializers/payload_serializer_to_json.rb +30 -15
- data/lib/scout_apm/slow_job_record.rb +5 -1
- data/lib/scout_apm/slow_policy/age_policy.rb +33 -0
- data/lib/scout_apm/slow_policy/percent_policy.rb +22 -0
- data/lib/scout_apm/slow_policy/percentile_policy.rb +24 -0
- data/lib/scout_apm/slow_policy/policy.rb +21 -0
- data/lib/scout_apm/slow_policy/speed_policy.rb +16 -0
- data/lib/scout_apm/slow_request_policy.rb +18 -77
- data/lib/scout_apm/slow_transaction.rb +3 -1
- data/lib/scout_apm/store.rb +12 -8
- data/lib/scout_apm/tracked_request.rb +39 -30
- data/lib/scout_apm/utils/active_record_metric_name.rb +16 -3
- data/lib/scout_apm/utils/backtrace_parser.rb +3 -0
- data/lib/scout_apm/utils/marshal_logging.rb +90 -0
- data/lib/scout_apm/utils/sql_sanitizer.rb +10 -1
- data/lib/scout_apm/utils/sql_sanitizer_regex.rb +8 -1
- data/lib/scout_apm/utils/sql_sanitizer_regex_1_8_7.rb +6 -0
- data/lib/scout_apm/utils/unique_id.rb +27 -0
- data/lib/scout_apm/version.rb +1 -1
- data/scout_apm.gemspec +13 -7
- data/test/test_helper.rb +2 -2
- data/test/unit/agent_context_test.rb +29 -0
- data/test/unit/auto_instrument/assignments-instrumented.rb +31 -0
- data/test/unit/auto_instrument/assignments.rb +31 -0
- data/test/unit/auto_instrument/controller-ast.txt +57 -0
- data/test/unit/auto_instrument/controller-instrumented.rb +49 -0
- data/test/unit/auto_instrument/controller.rb +49 -0
- data/test/unit/auto_instrument/rescue_from-instrumented.rb +13 -0
- data/test/unit/auto_instrument/rescue_from.rb +13 -0
- data/test/unit/auto_instrument_test.rb +54 -0
- data/test/unit/environment_test.rb +2 -2
- data/test/unit/error_service/error_buffer_test.rb +25 -0
- data/test/unit/error_service/ignored_exceptions_test.rb +49 -0
- data/test/unit/instruments/active_record_test.rb +40 -0
- data/test/unit/layer_children_set_test.rb +9 -0
- data/test/unit/request_histograms_test.rb +17 -0
- data/test/unit/serializers/payload_serializer_test.rb +39 -5
- data/test/unit/slow_request_policy_test.rb +41 -13
- data/test/unit/sql_sanitizer_test.rb +78 -0
- data/test/unit/utils/active_record_metric_name_test.rb +10 -2
- metadata +100 -18
- data/ext/stacks/extconf.rb +0 -37
- data/ext/stacks/scout_atomics.h +0 -86
- data/ext/stacks/stacks.c +0 -814
- data/lib/scout_apm/slow_job_policy.rb +0 -111
- data/lib/scout_apm/trace_compactor.rb +0 -312
- data/lib/scout_apm/utils/fake_stacks.rb +0 -88
- data/test/unit/instruments/active_record_instruments_test.rb +0 -5
- data/test/unit/slow_job_policy_test.rb +0 -6
- data/tester.rb +0 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 984d05544e5a2ce1b325c8a27f619f9b7ee54e8d98f614bebd41049c2c162105
|
4
|
+
data.tar.gz: f10c260c2cab2d1f00d6f6267eb643b860f872352edc9fa8ba8bedd0ac392023
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec9bc8174b44664990ffd3ab52fa0b3232f8c000dd69b50cab3d69b467acd74138aaec8d7494ecb1ae4cd50c3a70709db11abe232a9636cb76bb497bbc70341a
|
7
|
+
data.tar.gz: 114715176bcfb080ad8db4cce5fc38d6e3de345e19899352e754dee042bbf6267c983fd8e0dba8a87cb9d6efd4e29af9a047d123c429cac7a86854125e961dc5
|
@@ -0,0 +1,49 @@
|
|
1
|
+
name: Tests
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
lint:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
|
9
|
+
steps:
|
10
|
+
- uses: actions/checkout@v2
|
11
|
+
- uses: ruby/setup-ruby@v1
|
12
|
+
with:
|
13
|
+
bundler-cache: true
|
14
|
+
ruby-version: 2.6
|
15
|
+
- run: bundle exec rubocop
|
16
|
+
|
17
|
+
test:
|
18
|
+
strategy:
|
19
|
+
fail-fast: false
|
20
|
+
matrix:
|
21
|
+
include:
|
22
|
+
- ruby: 2.1
|
23
|
+
gemfile: gems/rails3.gemfile
|
24
|
+
- ruby: 2.2
|
25
|
+
- ruby: 2.3
|
26
|
+
- ruby: 2.4
|
27
|
+
- ruby: 2.5
|
28
|
+
- ruby: 2.6
|
29
|
+
- ruby: 2.6
|
30
|
+
gemfile: gems/octoshark.gemfile
|
31
|
+
- ruby: 2.6
|
32
|
+
gemfile: gems/rails3.gemfile
|
33
|
+
bundler: 1.17.3
|
34
|
+
- ruby: 2.7
|
35
|
+
- ruby: 3.0
|
36
|
+
|
37
|
+
env:
|
38
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
39
|
+
|
40
|
+
runs-on: ubuntu-latest
|
41
|
+
|
42
|
+
steps:
|
43
|
+
- uses: actions/checkout@v2
|
44
|
+
- uses: ruby/setup-ruby@v1
|
45
|
+
with:
|
46
|
+
bundler-cache: true
|
47
|
+
bundler: ${{matrix.bundler}}
|
48
|
+
ruby-version: ${{ matrix.ruby }}
|
49
|
+
- run: bundle exec rake
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# Disable all cops by default
|
2
2
|
AllCops:
|
3
3
|
DisabledByDefault: true
|
4
|
+
Exclude:
|
5
|
+
- 'test/unit/auto_instrument/*'
|
6
|
+
- vendor/bundle/**/*
|
7
|
+
SuggestExtensions: false
|
4
8
|
|
5
9
|
# 80 is stifling, especially with a few levels of nesting before we even start.
|
6
10
|
# So bump it to 100 to keep really long lines from creeping in.
|
7
|
-
|
11
|
+
Layout/LineLength:
|
8
12
|
Enabled: false
|
9
13
|
Max: 100
|
10
|
-
|
11
|
-
Style/HashSyntax:
|
12
|
-
Enabled: true
|
13
|
-
EnforcedStyle: hash_rockets
|
data/.travis.yml
CHANGED
@@ -1,17 +1,22 @@
|
|
1
1
|
language: ruby
|
2
|
-
|
3
|
-
- "1.8.7"
|
4
|
-
- "1.9.3"
|
5
|
-
- "2.0"
|
6
|
-
- "2.2"
|
7
|
-
- "2.4"
|
8
|
-
- "2.5"
|
2
|
+
dist: xenial
|
9
3
|
cache: bundler
|
10
|
-
|
11
|
-
|
12
|
-
- gem install bundler
|
13
|
-
jobs:
|
4
|
+
|
5
|
+
matrix:
|
14
6
|
include:
|
15
|
-
-
|
16
|
-
|
17
|
-
|
7
|
+
- rvm: 2.1
|
8
|
+
gemfile: gems/rails3.gemfile
|
9
|
+
- rvm: 2.2
|
10
|
+
- rvm: 2.3
|
11
|
+
- rvm: 2.4
|
12
|
+
- rvm: 2.5
|
13
|
+
- rvm: 2.6
|
14
|
+
- rvm: 2.7
|
15
|
+
- rvm: 3.0
|
16
|
+
- rvm: 2.6
|
17
|
+
gemfile: gems/octoshark.gemfile
|
18
|
+
- rvm: 2.6
|
19
|
+
name: rubocop yo
|
20
|
+
script: bundle exec rubocop
|
21
|
+
- rvm: 2.6
|
22
|
+
gemfile: gems/rails3.gemfile
|
data/CHANGELOG.markdown
CHANGED
@@ -1,6 +1,145 @@
|
|
1
|
-
#
|
1
|
+
# 4.0.2
|
2
2
|
|
3
|
-
*
|
3
|
+
* Add Typhoeus instrumentation (#376)
|
4
|
+
|
5
|
+
# 4.0.1
|
6
|
+
|
7
|
+
* Add support for Ruby 3.0 (#374)
|
8
|
+
* Use Github Actions for CI (#370)
|
9
|
+
* Fix edge case in sanitization of Postgres SQL (#368)
|
10
|
+
|
11
|
+
# 4.0.0
|
12
|
+
|
13
|
+
* Require Ruby >= 2.1 (#270)
|
14
|
+
* ErrorService reporting. Enable with `errors_enabled` config setting. (#347)
|
15
|
+
* Modular SlowRequestPolicy (#364)
|
16
|
+
* Fix deprecation warnings (#354)
|
17
|
+
|
18
|
+
# 2.6.10
|
19
|
+
|
20
|
+
* Fix an edge case in JSON serialization (#360)
|
21
|
+
|
22
|
+
# 2.6.9
|
23
|
+
|
24
|
+
* Add `ssl_cert_file` config option (#352)
|
25
|
+
* Improve sanitization of Postgres UPDATE SQL (#351)
|
26
|
+
* Allow custom URL sanitization (#341)
|
27
|
+
|
28
|
+
# 2.6.8
|
29
|
+
|
30
|
+
* Lock rake version for 1.8.7 to older version (#329)
|
31
|
+
* Delete unneeded .DS_Store file that snuck in (#334)
|
32
|
+
* Fix typo in "queue_time_ms"
|
33
|
+
* Fix Rails 6 deprecation warning at boot time (#337)
|
34
|
+
* Fix partial naming on Rails 6.0 (#339)
|
35
|
+
* Support Sidekiq 6.1 instrumentation (#340)
|
36
|
+
|
37
|
+
# 2.6.7
|
38
|
+
|
39
|
+
* Remove accidental call to `as_json`
|
40
|
+
|
41
|
+
# 2.6.6
|
42
|
+
|
43
|
+
* Add basic support for parsing Microsoft SQLServer queries (#317)
|
44
|
+
* Refine Postgresql Sanitization with subqueries and JSON operations (#262)
|
45
|
+
|
46
|
+
# 2.6.5
|
47
|
+
|
48
|
+
* Add a tag to any requests that reach maximum number of spans (#316)
|
49
|
+
* Update testing library Mocha (#315)
|
50
|
+
* Fix case sensitivity mismatch in Job renaming (#314)
|
51
|
+
* Add support for Sneakers 2.5 (#313)
|
52
|
+
* Fix edge case with Resque instrumentation (#312)
|
53
|
+
* Fix missing source code when used with BugSnag (#308)
|
54
|
+
|
55
|
+
# 2.6.4
|
56
|
+
|
57
|
+
* Add defensive check against a nil @address in Net/HTTP instruments (#306)
|
58
|
+
|
59
|
+
# 2.6.3
|
60
|
+
|
61
|
+
* Standardize Metadata with other language agents (#302)
|
62
|
+
* Add Mongoid 7.x support (#295)
|
63
|
+
* Add HTTP::Client support (#260)
|
64
|
+
|
65
|
+
# 2.6.2
|
66
|
+
|
67
|
+
* Fix Autoinstruments logging when running without ActiveSupport (#290)
|
68
|
+
* Fix edge-case Autoinstruments syntax error (#287)
|
69
|
+
* Fix invalid syntax for running on Ruby 1.8.7
|
70
|
+
|
71
|
+
# 2.6.1
|
72
|
+
|
73
|
+
* Logging total autoinstrumented spans and the ratio of significant to total spans (#283).
|
74
|
+
* Added `autoinstruments_ignore` option (also #283).
|
75
|
+
|
76
|
+
# 2.6.0
|
77
|
+
|
78
|
+
* Autoinstruments (#247). Disabled by default. Set `auto_instruments: true` to enable.
|
79
|
+
|
80
|
+
# 2.5.3
|
81
|
+
|
82
|
+
* Add Que support (#265)
|
83
|
+
* Add Memcached support (#279)
|
84
|
+
|
85
|
+
# 2.5.2
|
86
|
+
|
87
|
+
* Don't process limited layers in detailed traces (#268)
|
88
|
+
* Fix OctoShark (and other gems which patch ActiveRecord) interaction (#217)
|
89
|
+
* Legacy [Rails 2.3 fix for as_json](https://github.com/scoutapp/scout_apm_ruby/pull/276)
|
90
|
+
|
91
|
+
# 2.5.1
|
92
|
+
|
93
|
+
* Decrease timeline trace span limit to 1,500 to address [this bug](https://github.com/scoutapp/scout_apm_ruby/issues/267).
|
94
|
+
|
95
|
+
# 2.5.0
|
96
|
+
|
97
|
+
* Added timeline traces and an associated `timeline_traces: true` config option.
|
98
|
+
* Increased timeline traces span limit to 2,500 from 500.
|
99
|
+
|
100
|
+
# 2.4.24
|
101
|
+
|
102
|
+
* Fix for prepending view instruments in the case of templates that lack a `virtual_path` (#257).
|
103
|
+
|
104
|
+
# 2.4.23
|
105
|
+
|
106
|
+
* Extend #251 to use prepend on all view instruments (#255)
|
107
|
+
|
108
|
+
# 2.4.22
|
109
|
+
|
110
|
+
* Support Rails 6.0 View Instruments (#251)
|
111
|
+
* Update documentation URLs (#236)
|
112
|
+
|
113
|
+
# 2.4.21
|
114
|
+
|
115
|
+
* App & Background Integrations only install when needed (#228)
|
116
|
+
* New Setting `collect_remote_ip`, to optionally disable automated capture of
|
117
|
+
end-user IP Address. No change to default behavior.
|
118
|
+
* Allow setting `compress_payload` option from ENV var (#234)
|
119
|
+
|
120
|
+
# 2.4.20
|
121
|
+
|
122
|
+
* `start_resque_server_instrument` option to allow disabling the WEBrick server
|
123
|
+
component in custom installation scenarios
|
124
|
+
* Allow setting `revision_sha` setting in YAML
|
125
|
+
|
126
|
+
# 2.4.19
|
127
|
+
|
128
|
+
* Fix disabled_instruments (#220)
|
129
|
+
|
130
|
+
# 2.4.18
|
131
|
+
|
132
|
+
* Add Shoryuken Support (#215)
|
133
|
+
* Add Sneakers Support (#216)
|
134
|
+
|
135
|
+
# 2.4.17
|
136
|
+
|
137
|
+
* Renames SQL `BEGIN` and `COMMIT` statements from `SQL#other` to `SQL#begin` and `SQL#commit`, respectively.
|
138
|
+
* Makes naming between transaction and database metrics consistent. Previously, database metrics lacking a provided ActiveRecord label were named `SQL#other`.
|
139
|
+
|
140
|
+
# 2.4.16
|
141
|
+
|
142
|
+
* Fix synchronization bug in Store (#205, PR #210)
|
4
143
|
|
5
144
|
# 2.4.15
|
6
145
|
|
@@ -187,7 +326,6 @@ reusing that version number to avoid confusion.
|
|
187
326
|
|
188
327
|
* Max layaway file threshold limit
|
189
328
|
|
190
|
-
|
191
329
|
# 2.1.17
|
192
330
|
|
193
331
|
* Additional logging around file system usage
|
@@ -231,6 +369,7 @@ reusing that version number to avoid confusion.
|
|
231
369
|
* Initial Delayed Job support
|
232
370
|
* Limit max metric size of a trace to 500.
|
233
371
|
|
372
|
+
|
234
373
|
# 2.1.8
|
235
374
|
|
236
375
|
* Adds Git revision detection, which is reported on app load and associated with transaction traces
|
@@ -616,7 +755,7 @@ Big set of features getting merged in for this release.
|
|
616
755
|
|
617
756
|
# 0.1.3
|
618
757
|
|
619
|
-
* Adds capacity calculation via "Instance/Capacity" metric.
|
758
|
+
* Adds capacity calculation via "Instance/Capacity" metric.
|
620
759
|
* Tweaks tracing to still count a transaction if it results in a 500 error and includes it in accumulated time.
|
621
760
|
* Adds per-transaction error tracking (ex: Errors/Controller/widgets/index)
|
622
761
|
|
data/Gemfile
CHANGED
@@ -3,10 +3,4 @@ source "https://rubygems.org"
|
|
3
3
|
# Specify your gem's dependencies in scout_apm.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
|
7
|
-
if RUBY_VERSION <= "1.8.7"
|
8
|
-
gem "activesupport", "~> 3.2"
|
9
|
-
gem "i18n", "~> 0.6.11"
|
10
|
-
gem "pry", "~> 0.9.12"
|
11
|
-
gem "rake", "~> 10.5"
|
12
|
-
end
|
6
|
+
gem "rake", ">= 12.3.3"
|
data/README.markdown
CHANGED
@@ -12,8 +12,8 @@ The Scout agent is engineered to do some wonderful things:
|
|
12
12
|
|
13
13
|
* A unique focus on identifying those hard-to-investigate outliers like memory bloat, N+1s, and user-specific problems. [See an example workflow](http://scoutapp.com/newrelic-alternative).
|
14
14
|
* [Low-overhead](http://blog.scoutapp.com/articles/2016/02/07/overhead-benchmarks-new-relic-vs-scout)
|
15
|
-
* View your performance metrics during development with [DevTrace](
|
16
|
-
* Production-Safe profiling of custom code via [ScoutProf](
|
15
|
+
* View your performance metrics during development with [DevTrace](https://docs.scoutapm.com/#devtrace) and in production via [server_timing](https://github.com/scoutapp/ruby_server_timing).
|
16
|
+
* Production-Safe profiling of custom code via [ScoutProf](https://docs.scoutapm.com/#scoutprof) (BETA).
|
17
17
|
|
18
18
|
## Getting Started
|
19
19
|
|
@@ -25,7 +25,7 @@ Update your Gemfile
|
|
25
25
|
|
26
26
|
bundle install
|
27
27
|
|
28
|
-
Signup for a [Scout](https://
|
28
|
+
Signup for a [Scout](https://scoutapm.com) account and put the provided
|
29
29
|
config file at `RAILS_ROOT/config/scout_apm.yml`.
|
30
30
|
|
31
31
|
Your config file should look like:
|
@@ -35,6 +35,9 @@ Your config file should look like:
|
|
35
35
|
key: YOUR_APPLICATION_KEY
|
36
36
|
monitor: true
|
37
37
|
|
38
|
+
test:
|
39
|
+
monitor: false
|
40
|
+
|
38
41
|
production:
|
39
42
|
<<: *defaults
|
40
43
|
|
@@ -55,10 +58,16 @@ gem 'scout_apm'
|
|
55
58
|
SCOUT_DEV_TRACE=true rails server
|
56
59
|
```
|
57
60
|
|
61
|
+
## How to test gem locally
|
62
|
+
|
63
|
+
* Point your gemfile at your local checkout: `gem 'scout_apm', path: '/path/to/scout_apm_ruby`
|
64
|
+
* Compile native code: `cd /path/to/scout_apm_ruby && bundle exec rake compile`
|
65
|
+
|
66
|
+
|
58
67
|
## Docs
|
59
68
|
|
60
69
|
For the complete list of supported frameworks, Rubies, configuration options
|
61
|
-
and more, see our [help site](
|
70
|
+
and more, see our [help site](https://docs.scoutapm.com/).
|
62
71
|
|
63
72
|
## Help
|
64
73
|
|
data/Rakefile
CHANGED
@@ -56,6 +56,7 @@ void Init_allocations()
|
|
56
56
|
mInstruments = rb_define_module_under(mScoutApm, "Instruments");
|
57
57
|
cAllocations = rb_define_class_under(mInstruments, "Allocations", rb_cObject);
|
58
58
|
rb_define_singleton_method(cAllocations, "count", get_allocation_count, 0);
|
59
|
+
rb_define_singleton_method(cAllocations, "count", get_allocation_count, 0);
|
59
60
|
rb_define_const(cAllocations, "ENABLED", Qtrue);
|
60
61
|
Init_hooks(mScoutApm);
|
61
62
|
}
|
@@ -78,6 +79,7 @@ void Init_allocations()
|
|
78
79
|
mInstruments = rb_define_module_under(mScoutApm, "Instruments");
|
79
80
|
cAllocations = rb_define_class_under(mInstruments, "Allocations", rb_cObject);
|
80
81
|
rb_define_singleton_method(cAllocations, "count", get_allocation_count, 0);
|
82
|
+
rb_define_singleton_method(cAllocations, "count", get_allocation_count, 0);
|
81
83
|
rb_define_const(cAllocations, "ENABLED", Qfalse);
|
82
84
|
Init_hooks(mScoutApm);
|
83
85
|
}
|
data/gems/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Gems
|
2
|
+
|
3
|
+
These gemfiles list specific configurations of gems that we use in travis testing.
|
4
|
+
|
5
|
+
## Travis Matrix
|
6
|
+
|
7
|
+
```yaml
|
8
|
+
matrix:
|
9
|
+
include:
|
10
|
+
- rvm: "1.8.7"
|
11
|
+
gemfile: gems/rails3.gemfile
|
12
|
+
```
|
13
|
+
|
14
|
+
Using a gemfile controls the specific versions of the gems that are installed, and can be used to reproduce customer configurations for testing.
|
15
|
+
|
16
|
+
## Local Testing
|
17
|
+
|
18
|
+
To install the gems specified by a specific gemfile:
|
19
|
+
|
20
|
+
```
|
21
|
+
BUNDLE_GEMFILE=gems/rails5.gemfile bundle install
|
22
|
+
```
|
23
|
+
|
24
|
+
Then, to run tests using these gems:
|
25
|
+
|
26
|
+
```
|
27
|
+
BUNDLE_GEMFILE=gems/rails5.gemfile bundle exec rake
|
28
|
+
```
|
data/gems/rails3.gemfile
ADDED
data/gems/rails4.gemfile
ADDED
data/gems/rails5.gemfile
ADDED
data/gems/rails6.gemfile
ADDED
data/lib/scout_apm.rb
CHANGED
@@ -6,6 +6,7 @@ end
|
|
6
6
|
#####################################
|
7
7
|
require 'cgi'
|
8
8
|
require 'logger'
|
9
|
+
require 'monitor'
|
9
10
|
require 'net/http'
|
10
11
|
require 'openssl'
|
11
12
|
require 'pp'
|
@@ -14,7 +15,7 @@ require 'socket'
|
|
14
15
|
require 'thread'
|
15
16
|
require 'time'
|
16
17
|
require 'yaml'
|
17
|
-
require '
|
18
|
+
require 'securerandom'
|
18
19
|
|
19
20
|
#####################################
|
20
21
|
# Gem Requires
|
@@ -44,6 +45,7 @@ require 'scout_apm/layer_converters/database_converter'
|
|
44
45
|
require 'scout_apm/layer_converters/slow_request_converter'
|
45
46
|
require 'scout_apm/layer_converters/request_queue_time_converter'
|
46
47
|
require 'scout_apm/layer_converters/allocation_metric_converter'
|
48
|
+
require 'scout_apm/layer_converters/trace_converter'
|
47
49
|
require 'scout_apm/layer_converters/histograms'
|
48
50
|
require 'scout_apm/layer_converters/find_layer_by_type'
|
49
51
|
|
@@ -58,6 +60,10 @@ require 'scout_apm/server_integrations/null'
|
|
58
60
|
require 'scout_apm/background_job_integrations/sidekiq'
|
59
61
|
require 'scout_apm/background_job_integrations/delayed_job'
|
60
62
|
require 'scout_apm/background_job_integrations/resque'
|
63
|
+
require 'scout_apm/background_job_integrations/shoryuken'
|
64
|
+
require 'scout_apm/background_job_integrations/sneakers'
|
65
|
+
require 'scout_apm/background_job_integrations/que'
|
66
|
+
require 'scout_apm/background_job_integrations/legacy_sneakers'
|
61
67
|
|
62
68
|
require 'scout_apm/framework_integrations/rails_2'
|
63
69
|
require 'scout_apm/framework_integrations/rails_3_or_4'
|
@@ -72,8 +78,10 @@ require 'scout_apm/histogram'
|
|
72
78
|
|
73
79
|
require 'scout_apm/instruments/net_http'
|
74
80
|
require 'scout_apm/instruments/http_client'
|
81
|
+
require 'scout_apm/instruments/typhoeus'
|
75
82
|
require 'scout_apm/instruments/moped'
|
76
83
|
require 'scout_apm/instruments/mongoid'
|
84
|
+
require 'scout_apm/instruments/memcached'
|
77
85
|
require 'scout_apm/instruments/redis'
|
78
86
|
require 'scout_apm/instruments/influxdb'
|
79
87
|
require 'scout_apm/instruments/elasticsearch'
|
@@ -93,12 +101,6 @@ require 'scout_apm/instruments/process/process_memory'
|
|
93
101
|
require 'scout_apm/instruments/percentile_sampler'
|
94
102
|
require 'scout_apm/instruments/samplers'
|
95
103
|
|
96
|
-
begin
|
97
|
-
require 'stacks'
|
98
|
-
rescue LoadError
|
99
|
-
require 'scout_apm/utils/fake_stacks'
|
100
|
-
end
|
101
|
-
|
102
104
|
require 'scout_apm/app_server_load'
|
103
105
|
|
104
106
|
require 'scout_apm/ignored_uris.rb'
|
@@ -112,6 +114,7 @@ require 'scout_apm/utils/time'
|
|
112
114
|
require 'scout_apm/utils/unique_id'
|
113
115
|
require 'scout_apm/utils/numbers'
|
114
116
|
require 'scout_apm/utils/gzip_helper'
|
117
|
+
require 'scout_apm/utils/marshal_logging'
|
115
118
|
|
116
119
|
require 'scout_apm/config'
|
117
120
|
require 'scout_apm/environment'
|
@@ -132,7 +135,6 @@ require 'scout_apm/tracer'
|
|
132
135
|
require 'scout_apm/transaction'
|
133
136
|
require 'scout_apm/context'
|
134
137
|
require 'scout_apm/instant_reporting'
|
135
|
-
require 'scout_apm/trace_compactor'
|
136
138
|
require 'scout_apm/background_recorder'
|
137
139
|
require 'scout_apm/synchronous_recorder'
|
138
140
|
|
@@ -141,9 +143,15 @@ require 'scout_apm/metric_stats'
|
|
141
143
|
require 'scout_apm/db_query_metric_stats'
|
142
144
|
require 'scout_apm/slow_transaction'
|
143
145
|
require 'scout_apm/slow_job_record'
|
146
|
+
require 'scout_apm/detailed_trace'
|
144
147
|
require 'scout_apm/scored_item_set'
|
148
|
+
|
145
149
|
require 'scout_apm/slow_request_policy'
|
146
|
-
require 'scout_apm/
|
150
|
+
require 'scout_apm/slow_policy/age_policy'
|
151
|
+
require 'scout_apm/slow_policy/speed_policy'
|
152
|
+
require 'scout_apm/slow_policy/percent_policy'
|
153
|
+
require 'scout_apm/slow_policy/percentile_policy'
|
154
|
+
|
147
155
|
require 'scout_apm/job_record'
|
148
156
|
require 'scout_apm/request_histograms'
|
149
157
|
require 'scout_apm/transaction_time_consumed'
|
@@ -184,6 +192,16 @@ require 'scout_apm/tasks/support'
|
|
184
192
|
require 'scout_apm/extensions/config'
|
185
193
|
require 'scout_apm/extensions/transaction_callback_payload'
|
186
194
|
|
195
|
+
require 'scout_apm/error_service'
|
196
|
+
require 'scout_apm/error_service/middleware'
|
197
|
+
require 'scout_apm/error_service/notifier'
|
198
|
+
require 'scout_apm/error_service/sidekiq'
|
199
|
+
require 'scout_apm/error_service/ignored_exceptions'
|
200
|
+
require 'scout_apm/error_service/error_buffer'
|
201
|
+
require 'scout_apm/error_service/error_record'
|
202
|
+
require 'scout_apm/error_service/periodic_work'
|
203
|
+
require 'scout_apm/error_service/payload'
|
204
|
+
|
187
205
|
if defined?(Rails) && defined?(Rails::VERSION) && defined?(Rails::VERSION::MAJOR) && Rails::VERSION::MAJOR >= 3 && defined?(Rails::Railtie)
|
188
206
|
module ScoutApm
|
189
207
|
class Railtie < Rails::Railtie
|
@@ -196,6 +214,18 @@ if defined?(Rails) && defined?(Rails::VERSION) && defined?(Rails::VERSION::MAJOR
|
|
196
214
|
# Attempt to start right away, this will work best for preloading apps, Unicorn & Puma & similar
|
197
215
|
ScoutApm::Agent.instance.install
|
198
216
|
|
217
|
+
if ScoutApm::Agent.instance.context.config.value("auto_instruments")
|
218
|
+
ScoutApm::Agent.instance.context.logger.debug("AutoInstruments is enabled.")
|
219
|
+
require 'scout_apm/auto_instrument'
|
220
|
+
else
|
221
|
+
ScoutApm::Agent.instance.context.logger.debug("AutoInstruments is disabled.")
|
222
|
+
end
|
223
|
+
|
224
|
+
if ScoutApm::Agent.instance.context.config.value("errors_enabled")
|
225
|
+
app.config.middleware.insert_after ActionDispatch::DebugExceptions, ScoutApm::ErrorService::Middleware
|
226
|
+
ScoutApm::ErrorService::Sidekiq.new.install
|
227
|
+
end
|
228
|
+
|
199
229
|
# Install the middleware every time in development mode.
|
200
230
|
# The middleware is a noop if dev_trace is not enabled in config
|
201
231
|
if Rails.env.development?
|