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.
Files changed (134) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/test.yml +49 -0
  3. data/.gitignore +1 -1
  4. data/.rubocop.yml +5 -5
  5. data/.travis.yml +19 -14
  6. data/CHANGELOG.markdown +143 -4
  7. data/Gemfile +1 -7
  8. data/README.markdown +13 -4
  9. data/Rakefile +1 -1
  10. data/ext/allocations/allocations.c +2 -0
  11. data/gems/README.md +28 -0
  12. data/gems/octoshark.gemfile +4 -0
  13. data/gems/rails3.gemfile +5 -0
  14. data/gems/rails4.gemfile +4 -0
  15. data/gems/rails5.gemfile +4 -0
  16. data/gems/rails6.gemfile +4 -0
  17. data/lib/scout_apm.rb +39 -9
  18. data/lib/scout_apm/agent.rb +29 -10
  19. data/lib/scout_apm/agent/exit_handler.rb +0 -1
  20. data/lib/scout_apm/agent_context.rb +22 -3
  21. data/lib/scout_apm/app_server_load.rb +7 -2
  22. data/lib/scout_apm/attribute_arranger.rb +0 -2
  23. data/lib/scout_apm/auto_instrument.rb +5 -0
  24. data/lib/scout_apm/auto_instrument/instruction_sequence.rb +31 -0
  25. data/lib/scout_apm/auto_instrument/layer.rb +23 -0
  26. data/lib/scout_apm/auto_instrument/parser.rb +27 -0
  27. data/lib/scout_apm/auto_instrument/rails.rb +175 -0
  28. data/lib/scout_apm/background_job_integrations/legacy_sneakers.rb +55 -0
  29. data/lib/scout_apm/background_job_integrations/que.rb +134 -0
  30. data/lib/scout_apm/background_job_integrations/resque.rb +6 -2
  31. data/lib/scout_apm/background_job_integrations/shoryuken.rb +124 -0
  32. data/lib/scout_apm/background_job_integrations/sidekiq.rb +5 -19
  33. data/lib/scout_apm/background_job_integrations/sneakers.rb +87 -0
  34. data/lib/scout_apm/config.rb +45 -8
  35. data/lib/scout_apm/detailed_trace.rb +217 -0
  36. data/lib/scout_apm/environment.rb +19 -1
  37. data/lib/scout_apm/error.rb +27 -0
  38. data/lib/scout_apm/error_service.rb +32 -0
  39. data/lib/scout_apm/error_service/error_buffer.rb +39 -0
  40. data/lib/scout_apm/error_service/error_record.rb +211 -0
  41. data/lib/scout_apm/error_service/ignored_exceptions.rb +66 -0
  42. data/lib/scout_apm/error_service/middleware.rb +32 -0
  43. data/lib/scout_apm/error_service/notifier.rb +33 -0
  44. data/lib/scout_apm/error_service/payload.rb +47 -0
  45. data/lib/scout_apm/error_service/periodic_work.rb +17 -0
  46. data/lib/scout_apm/error_service/railtie.rb +11 -0
  47. data/lib/scout_apm/error_service/sidekiq.rb +80 -0
  48. data/lib/scout_apm/extensions/transaction_callback_payload.rb +1 -1
  49. data/lib/scout_apm/fake_store.rb +3 -0
  50. data/lib/scout_apm/framework_integrations/rails_2.rb +2 -1
  51. data/lib/scout_apm/framework_integrations/rails_3_or_4.rb +3 -1
  52. data/lib/scout_apm/git_revision.rb +6 -3
  53. data/lib/scout_apm/instant/middleware.rb +2 -1
  54. data/lib/scout_apm/instrument_manager.rb +9 -7
  55. data/lib/scout_apm/instruments/action_controller_rails_2.rb +3 -1
  56. data/lib/scout_apm/instruments/action_controller_rails_3_rails4.rb +56 -55
  57. data/lib/scout_apm/instruments/action_view.rb +126 -26
  58. data/lib/scout_apm/instruments/active_record.rb +66 -18
  59. data/lib/scout_apm/instruments/http.rb +48 -0
  60. data/lib/scout_apm/instruments/memcached.rb +43 -0
  61. data/lib/scout_apm/instruments/mongoid.rb +9 -4
  62. data/lib/scout_apm/instruments/net_http.rb +8 -1
  63. data/lib/scout_apm/instruments/typhoeus.rb +87 -0
  64. data/lib/scout_apm/job_record.rb +4 -2
  65. data/lib/scout_apm/layaway_file.rb +4 -0
  66. data/lib/scout_apm/layer.rb +6 -57
  67. data/lib/scout_apm/layer_children_set.rb +9 -8
  68. data/lib/scout_apm/layer_converters/converter_base.rb +15 -30
  69. data/lib/scout_apm/layer_converters/database_converter.rb +2 -15
  70. data/lib/scout_apm/layer_converters/slow_job_converter.rb +12 -2
  71. data/lib/scout_apm/layer_converters/slow_request_converter.rb +14 -4
  72. data/lib/scout_apm/layer_converters/trace_converter.rb +184 -0
  73. data/lib/scout_apm/limited_layer.rb +0 -7
  74. data/lib/scout_apm/metric_stats.rb +0 -8
  75. data/lib/scout_apm/middleware.rb +1 -1
  76. data/lib/scout_apm/periodic_work.rb +19 -0
  77. data/lib/scout_apm/remote/message.rb +4 -0
  78. data/lib/scout_apm/remote/server.rb +13 -1
  79. data/lib/scout_apm/reporter.rb +8 -3
  80. data/lib/scout_apm/reporting.rb +2 -1
  81. data/lib/scout_apm/request_histograms.rb +8 -0
  82. data/lib/scout_apm/serializers/app_server_load_serializer.rb +4 -0
  83. data/lib/scout_apm/serializers/directive_serializer.rb +4 -0
  84. data/lib/scout_apm/serializers/payload_serializer.rb +2 -2
  85. data/lib/scout_apm/serializers/payload_serializer_to_json.rb +30 -15
  86. data/lib/scout_apm/slow_job_record.rb +5 -1
  87. data/lib/scout_apm/slow_policy/age_policy.rb +33 -0
  88. data/lib/scout_apm/slow_policy/percent_policy.rb +22 -0
  89. data/lib/scout_apm/slow_policy/percentile_policy.rb +24 -0
  90. data/lib/scout_apm/slow_policy/policy.rb +21 -0
  91. data/lib/scout_apm/slow_policy/speed_policy.rb +16 -0
  92. data/lib/scout_apm/slow_request_policy.rb +18 -77
  93. data/lib/scout_apm/slow_transaction.rb +3 -1
  94. data/lib/scout_apm/store.rb +12 -8
  95. data/lib/scout_apm/tracked_request.rb +39 -30
  96. data/lib/scout_apm/utils/active_record_metric_name.rb +16 -3
  97. data/lib/scout_apm/utils/backtrace_parser.rb +3 -0
  98. data/lib/scout_apm/utils/marshal_logging.rb +90 -0
  99. data/lib/scout_apm/utils/sql_sanitizer.rb +10 -1
  100. data/lib/scout_apm/utils/sql_sanitizer_regex.rb +8 -1
  101. data/lib/scout_apm/utils/sql_sanitizer_regex_1_8_7.rb +6 -0
  102. data/lib/scout_apm/utils/unique_id.rb +27 -0
  103. data/lib/scout_apm/version.rb +1 -1
  104. data/scout_apm.gemspec +13 -7
  105. data/test/test_helper.rb +2 -2
  106. data/test/unit/agent_context_test.rb +29 -0
  107. data/test/unit/auto_instrument/assignments-instrumented.rb +31 -0
  108. data/test/unit/auto_instrument/assignments.rb +31 -0
  109. data/test/unit/auto_instrument/controller-ast.txt +57 -0
  110. data/test/unit/auto_instrument/controller-instrumented.rb +49 -0
  111. data/test/unit/auto_instrument/controller.rb +49 -0
  112. data/test/unit/auto_instrument/rescue_from-instrumented.rb +13 -0
  113. data/test/unit/auto_instrument/rescue_from.rb +13 -0
  114. data/test/unit/auto_instrument_test.rb +54 -0
  115. data/test/unit/environment_test.rb +2 -2
  116. data/test/unit/error_service/error_buffer_test.rb +25 -0
  117. data/test/unit/error_service/ignored_exceptions_test.rb +49 -0
  118. data/test/unit/instruments/active_record_test.rb +40 -0
  119. data/test/unit/layer_children_set_test.rb +9 -0
  120. data/test/unit/request_histograms_test.rb +17 -0
  121. data/test/unit/serializers/payload_serializer_test.rb +39 -5
  122. data/test/unit/slow_request_policy_test.rb +41 -13
  123. data/test/unit/sql_sanitizer_test.rb +78 -0
  124. data/test/unit/utils/active_record_metric_name_test.rb +10 -2
  125. metadata +100 -18
  126. data/ext/stacks/extconf.rb +0 -37
  127. data/ext/stacks/scout_atomics.h +0 -86
  128. data/ext/stacks/stacks.c +0 -814
  129. data/lib/scout_apm/slow_job_policy.rb +0 -111
  130. data/lib/scout_apm/trace_compactor.rb +0 -312
  131. data/lib/scout_apm/utils/fake_stacks.rb +0 -88
  132. data/test/unit/instruments/active_record_instruments_test.rb +0 -5
  133. data/test/unit/slow_job_policy_test.rb +0 -6
  134. data/tester.rb +0 -53
@@ -28,7 +28,23 @@ module ScoutApm
28
28
  sql = %q|SELECT "users".* FROM "users" INNER JOIN "blogs" ON "blogs"."user_id" = "users"."id" WHERE (blogs.title = 'hello world')|
29
29
  ss = SqlSanitizer.new(sql).tap{ |it| it.database_engine = :postgres }
30
30
  assert_equal %q|SELECT "users".* FROM "users" INNER JOIN "blogs" ON "blogs"."user_id" = "users"."id" WHERE (blogs.title = ?)|, ss.to_s
31
+ end
32
+
33
+ def test_postgres_strips_after_where
34
+ raw_sql = %q|SELECT DISTINCT ON (flagged_traces.metric_name) flagged_traces.metric_name, "flagged_traces"."trace_id", "flagged_traces"."trace_type", "flagged_traces"."trace_occurred_at", flagged_traces.details ->> 'uri' as uri, (flagged_traces.details ->> 'n_sum_millis')::float as potential_savings, (flagged_traces.details ->> 'n_count')::float as num_queries FROM "flagged_traces" WHERE "flagged_traces"."app_id" = 5 AND "flagged_traces"."trace_type" = 'Request' AND ("flagged_traces"."trace_occurred_at" BETWEEN '2019-04-17 12:28:00.000000' AND '2019-04-18 12:28:00.000000') AND "flagged_traces"."flag_type" = 'nplusone' ORDER BY "flagged_traces"."metric_name" ASC, potential_savings DESC|
35
+ sanitized_sql = SqlSanitizer.new(raw_sql).tap { |it| it.database_engine = :postgres}
36
+ expected_sql = %q|SELECT DISTINCT ON (flagged_traces.metric_name) flagged_traces.metric_name, "flagged_traces"."trace_id", "flagged_traces"."trace_type", "flagged_traces"."trace_occurred_at", flagged_traces.details ->> 'uri' as uri, (flagged_traces.details ->> 'n_sum_millis')::float as potential_savings, (flagged_traces.details ->> 'n_count')::float as num_queries FROM "flagged_traces" WHERE "flagged_traces"."app_id" = ? AND "flagged_traces"."trace_type" = ? AND ("flagged_traces"."trace_occurred_at" BETWEEN ? AND ?) AND "flagged_traces"."flag_type" = ? ORDER BY "flagged_traces"."metric_name" ASC, potential_savings DESC|
37
+ assert_equal expected_sql, sanitized_sql.to_s
38
+ end
31
39
 
40
+ def test_postgres_strips_subquery_strings
41
+ raw_sql = %q|"SELECT 'orgs'.* FROM "orgs" WHERE "orgs"."name" = 'Scout' AND "orgs"."created_by_user_id" IN (SELECT 'users'.'id' FROM "users" WHERE (id > AVG(id)) AND "type" = 'USER' AND "created_at" BETWEEN '2019-04-17 12:28:00.000000' AND '2019-04-18 12:28:00.000000')"|
42
+ sanitized_sql = SqlSanitizer.new(raw_sql).tap { |it| it.database_engine = :postgres}
43
+ expected_sql = %q|"SELECT 'orgs'.* FROM "orgs" WHERE "orgs"."name" = ? AND "orgs"."created_by_user_id" IN (SELECT 'users'.'id' FROM "users" WHERE (id > AVG(id)) AND "type" = ? AND "created_at" BETWEEN ? AND ?)"|
44
+ assert_equal expected_sql, sanitized_sql.to_s
45
+ end
46
+
47
+ def test_postgres_strips_integers
32
48
  # Strip integers
33
49
  sql = %q|SELECT "blogs".* FROM "blogs" WHERE (view_count > 10)|
34
50
  ss = SqlSanitizer.new(sql).tap{ |it| it.database_engine = :postgres }
@@ -89,6 +105,30 @@ module ScoutApm
89
105
  assert_equal %q|INSERT INTO `users` VALUES (?, ?)|, ss.to_s
90
106
  end
91
107
 
108
+ def test_sqlserver_integers
109
+ skip "SQLServer Support requires Ruby 1.9+ For Regexes"
110
+
111
+ sql = "EXEC sp_executesql N'SELECT [users].* FROM [users] WHERE (age > 50) ORDER BY [users].[id] ASC OFFSET 0 ROWS FETCH NEXT @0 ROWS ONLY', N'@0 int', @0 = 10"
112
+ ss = SqlSanitizer.new(sql).tap{ |it| it.database_engine = :sqlserver }
113
+ assert_equal %q|SELECT [users].* FROM [users] WHERE (age > ?) ORDER BY [users].[id] ASC OFFSET ? ROWS FETCH NEXT @0 ROWS ONLY|, ss.to_s
114
+ end
115
+
116
+ def test_sqlserver_strings
117
+ skip "SQLServer Support requires Ruby 1.9+ For Regexes"
118
+
119
+ sql = "EXEC sp_executesql N'SELECT [users].* FROM [users] WHERE [users].[email] = @0 ORDER BY [users].[id] ASC OFFSET 0 ROWS FETCH NEXT @1 ROWS ONLY', N'@0 nvarchar(4000), @1 int', @0 = N'foo', @1 = 10"
120
+ ss = SqlSanitizer.new(sql).tap{ |it| it.database_engine = :sqlserver }
121
+ assert_equal %q|SELECT [users].* FROM [users] WHERE [users].[email] = @0 ORDER BY [users].[id] ASC OFFSET ? ROWS FETCH NEXT @1 ROWS ONLY|, ss.to_s
122
+ end
123
+
124
+ def test_sqlserver_in_clause
125
+ skip "SQLServer Support requires Ruby 1.9+ For Regexes"
126
+
127
+ sql = "EXEC sp_executesql N'SELECT [users].* FROM [users] WHERE (id IN (1,2,3)) ORDER BY [users].[id] ASC OFFSET 0 ROWS FETCH NEXT @0 ROWS ONLY', N'@0 int', @0 = 10"
128
+ ss = SqlSanitizer.new(sql).tap{ |it| it.database_engine = :sqlserver }
129
+ assert_equal %q|SELECT [users].* FROM [users] WHERE (id IN (?)) ORDER BY [users].[id] ASC OFFSET ? ROWS FETCH NEXT @0 ROWS ONLY|, ss.to_s
130
+ end
131
+
92
132
  def test_scrubs_invalid_encoding
93
133
  skip "Ruby 1.8.7 has no concept of encoding" if RUBY_VERSION.start_with?("1.8.")
94
134
 
@@ -99,6 +139,44 @@ module ScoutApm
99
139
  assert_equal %q|SELECT `blogs`.* FROM `blogs` WHERE (title = ?)|, ss.to_s
100
140
  end
101
141
 
142
+ def test_set_columns
143
+ sql = %q|UPDATE "mytable" SET "myfield" = 'fieldcontent', "countofthings" = 10 WHERE "user_id" = 10|
144
+
145
+ ss = SqlSanitizer.new(sql).tap{ |it| it.database_engine = :postgres }
146
+ assert_equal %q|UPDATE "mytable" SET "myfield" = ?, "countofthings" = ? WHERE "user_id" = ?|, ss.to_s
147
+ end
148
+
149
+ def test_postgres_multiline_sql
150
+ sql = %q|
151
+ SELECT "html_form_payloads".*
152
+ FROM "html_form_payloads"
153
+ INNER JOIN "leads" ON "leads"."payload_id" = "html_form_payloads"."id"
154
+ AND "leads"."payload_type" = ?
155
+ WHERE html_form_payloads.id < 10
156
+ AND "form_type" = 'xyz'
157
+ AND (params::varchar = '{"name":"Chris","resident":"Yes","e-content":"Secret content"}')
158
+ AND (leads.url = 'http://example.com')
159
+ ORDER BY "html_form_payloads"."id" ASC
160
+ LIMIT ?
161
+ |
162
+
163
+ ss = SqlSanitizer.new(sql).tap{ |it| it.database_engine = :postgres }
164
+ assert_equal %q|SELECT "html_form_payloads".* FROM "html_form_payloads" INNER JOIN "leads" ON "leads"."payload_id" = "html_form_payloads"."id" AND "leads"."payload_type" = ? WHERE html_form_payloads.id < ? AND "form_type" = ? AND (params::varchar = ?) AND (leads.url = ?) ORDER BY "html_form_payloads"."id" ASC LIMIT ?|, ss.to_s
165
+ end
166
+
167
+ def test_mysql_multiline
168
+ sql = %q|
169
+ SELECT `blogs`.*
170
+ FROM `blogs`
171
+ WHERE (title = 'abc')
172
+ |
173
+
174
+ ss = SqlSanitizer.new(sql).tap{ |it| it.database_engine = :mysql }
175
+ assert_equal %q|SELECT `blogs`.*
176
+ FROM `blogs`
177
+ WHERE (title = ?)|, ss.to_s
178
+ end
179
+
102
180
  def assert_faster_than(target_seconds)
103
181
  t1 = ::Time.now
104
182
  yield
@@ -64,6 +64,16 @@ class ActiveRecordMetricNameTest < Minitest::Test
64
64
  assert_equal "User/find", mn.to_s
65
65
  end
66
66
 
67
+ def test_begin_statement
68
+ mn = ScoutApm::Utils::ActiveRecordMetricName.new("BEGIN", nil)
69
+ assert_equal "SQL/begin", mn.to_s
70
+ end
71
+
72
+ def test_commit
73
+ mn = ScoutApm::Utils::ActiveRecordMetricName.new("COMMIT", nil)
74
+ assert_equal "SQL/commit", mn.to_s
75
+ end
76
+
67
77
 
68
78
  # Regex test cases, pass these in w/ "SQL" as the AR provided name field
69
79
  [
@@ -89,8 +99,6 @@ class ActiveRecordMetricNameTest < Minitest::Test
89
99
  # Stuff we don't care about in SQL
90
100
  ["SQL/other", 'SET SESSION statement_timeout = ?'],
91
101
  ["SQL/other", 'SHOW TIME ZONE'],
92
- ["SQL/other", 'BEGIN'],
93
- ["SQL/other", 'COMMIT'],
94
102
 
95
103
  # Empty strings, or invalid SQL
96
104
  ["SQL/other", ''],
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: 3.0.0.pre26
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derek Haynes
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-08-07 00:00:00.000000000 Z
12
+ date: 2021-01-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
@@ -109,6 +109,48 @@ dependencies:
109
109
  - - ">="
110
110
  - !ruby/object:Gem::Version
111
111
  version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: parser
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :runtime
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: activerecord
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ - !ruby/object:Gem::Dependency
141
+ name: sqlite3
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: '0'
112
154
  - !ruby/object:Gem::Dependency
113
155
  name: rubocop
114
156
  requirement: !ruby/object:Gem::Requirement
@@ -171,10 +213,10 @@ email:
171
213
  executables: []
172
214
  extensions:
173
215
  - ext/allocations/extconf.rb
174
- - ext/stacks/extconf.rb
175
216
  - ext/rusage/extconf.rb
176
217
  extra_rdoc_files: []
177
218
  files:
219
+ - ".github/workflows/test.yml"
178
220
  - ".gitignore"
179
221
  - ".rubocop.yml"
180
222
  - ".travis.yml"
@@ -190,9 +232,12 @@ files:
190
232
  - ext/rusage/README.md
191
233
  - ext/rusage/extconf.rb
192
234
  - ext/rusage/rusage.c
193
- - ext/stacks/extconf.rb
194
- - ext/stacks/scout_atomics.h
195
- - ext/stacks/stacks.c
235
+ - gems/README.md
236
+ - gems/octoshark.gemfile
237
+ - gems/rails3.gemfile
238
+ - gems/rails4.gemfile
239
+ - gems/rails5.gemfile
240
+ - gems/rails6.gemfile
196
241
  - lib/scout_apm.rb
197
242
  - lib/scout_apm/agent.rb
198
243
  - lib/scout_apm/agent/exit_handler.rb
@@ -200,9 +245,18 @@ files:
200
245
  - lib/scout_apm/agent_context.rb
201
246
  - lib/scout_apm/app_server_load.rb
202
247
  - lib/scout_apm/attribute_arranger.rb
248
+ - lib/scout_apm/auto_instrument.rb
249
+ - lib/scout_apm/auto_instrument/instruction_sequence.rb
250
+ - lib/scout_apm/auto_instrument/layer.rb
251
+ - lib/scout_apm/auto_instrument/parser.rb
252
+ - lib/scout_apm/auto_instrument/rails.rb
203
253
  - lib/scout_apm/background_job_integrations/delayed_job.rb
254
+ - lib/scout_apm/background_job_integrations/legacy_sneakers.rb
255
+ - lib/scout_apm/background_job_integrations/que.rb
204
256
  - lib/scout_apm/background_job_integrations/resque.rb
257
+ - lib/scout_apm/background_job_integrations/shoryuken.rb
205
258
  - lib/scout_apm/background_job_integrations/sidekiq.rb
259
+ - lib/scout_apm/background_job_integrations/sneakers.rb
206
260
  - lib/scout_apm/background_recorder.rb
207
261
  - lib/scout_apm/background_worker.rb
208
262
  - lib/scout_apm/bucket_name_splitter.rb
@@ -212,7 +266,19 @@ files:
212
266
  - lib/scout_apm/db_query_metric_set.rb
213
267
  - lib/scout_apm/db_query_metric_stats.rb
214
268
  - lib/scout_apm/debug.rb
269
+ - lib/scout_apm/detailed_trace.rb
215
270
  - lib/scout_apm/environment.rb
271
+ - lib/scout_apm/error.rb
272
+ - lib/scout_apm/error_service.rb
273
+ - lib/scout_apm/error_service/error_buffer.rb
274
+ - lib/scout_apm/error_service/error_record.rb
275
+ - lib/scout_apm/error_service/ignored_exceptions.rb
276
+ - lib/scout_apm/error_service/middleware.rb
277
+ - lib/scout_apm/error_service/notifier.rb
278
+ - lib/scout_apm/error_service/payload.rb
279
+ - lib/scout_apm/error_service/periodic_work.rb
280
+ - lib/scout_apm/error_service/railtie.rb
281
+ - lib/scout_apm/error_service/sidekiq.rb
216
282
  - lib/scout_apm/extensions/config.rb
217
283
  - lib/scout_apm/extensions/transaction_callback_payload.rb
218
284
  - lib/scout_apm/fake_store.rb
@@ -227,15 +293,16 @@ files:
227
293
  - lib/scout_apm/instant/middleware.rb
228
294
  - lib/scout_apm/instant_reporting.rb
229
295
  - lib/scout_apm/instrument_manager.rb
230
- - lib/scout_apm/instruments/.DS_Store
231
296
  - lib/scout_apm/instruments/action_controller_rails_2.rb
232
297
  - lib/scout_apm/instruments/action_controller_rails_3_rails4.rb
233
298
  - lib/scout_apm/instruments/action_view.rb
234
299
  - lib/scout_apm/instruments/active_record.rb
235
300
  - lib/scout_apm/instruments/elasticsearch.rb
236
301
  - lib/scout_apm/instruments/grape.rb
302
+ - lib/scout_apm/instruments/http.rb
237
303
  - lib/scout_apm/instruments/http_client.rb
238
304
  - lib/scout_apm/instruments/influxdb.rb
305
+ - lib/scout_apm/instruments/memcached.rb
239
306
  - lib/scout_apm/instruments/middleware_detailed.rb
240
307
  - lib/scout_apm/instruments/middleware_summary.rb
241
308
  - lib/scout_apm/instruments/mongoid.rb
@@ -249,6 +316,7 @@ files:
249
316
  - lib/scout_apm/instruments/resque.rb
250
317
  - lib/scout_apm/instruments/samplers.rb
251
318
  - lib/scout_apm/instruments/sinatra.rb
319
+ - lib/scout_apm/instruments/typhoeus.rb
252
320
  - lib/scout_apm/job_record.rb
253
321
  - lib/scout_apm/layaway.rb
254
322
  - lib/scout_apm/layaway_file.rb
@@ -266,6 +334,7 @@ files:
266
334
  - lib/scout_apm/layer_converters/request_queue_time_converter.rb
267
335
  - lib/scout_apm/layer_converters/slow_job_converter.rb
268
336
  - lib/scout_apm/layer_converters/slow_request_converter.rb
337
+ - lib/scout_apm/layer_converters/trace_converter.rb
269
338
  - lib/scout_apm/limited_layer.rb
270
339
  - lib/scout_apm/logger.rb
271
340
  - lib/scout_apm/metric_meta.rb
@@ -302,8 +371,12 @@ files:
302
371
  - lib/scout_apm/server_integrations/thin.rb
303
372
  - lib/scout_apm/server_integrations/unicorn.rb
304
373
  - lib/scout_apm/server_integrations/webrick.rb
305
- - lib/scout_apm/slow_job_policy.rb
306
374
  - lib/scout_apm/slow_job_record.rb
375
+ - lib/scout_apm/slow_policy/age_policy.rb
376
+ - lib/scout_apm/slow_policy/percent_policy.rb
377
+ - lib/scout_apm/slow_policy/percentile_policy.rb
378
+ - lib/scout_apm/slow_policy/policy.rb
379
+ - lib/scout_apm/slow_policy/speed_policy.rb
307
380
  - lib/scout_apm/slow_request_policy.rb
308
381
  - lib/scout_apm/slow_transaction.rb
309
382
  - lib/scout_apm/stack_item.rb
@@ -311,17 +384,16 @@ files:
311
384
  - lib/scout_apm/synchronous_recorder.rb
312
385
  - lib/scout_apm/tasks/doctor.rb
313
386
  - lib/scout_apm/tasks/support.rb
314
- - lib/scout_apm/trace_compactor.rb
315
387
  - lib/scout_apm/tracer.rb
316
388
  - lib/scout_apm/tracked_request.rb
317
389
  - lib/scout_apm/transaction.rb
318
390
  - lib/scout_apm/transaction_time_consumed.rb
319
391
  - lib/scout_apm/utils/active_record_metric_name.rb
320
392
  - lib/scout_apm/utils/backtrace_parser.rb
321
- - lib/scout_apm/utils/fake_stacks.rb
322
393
  - lib/scout_apm/utils/gzip_helper.rb
323
394
  - lib/scout_apm/utils/installed_gems.rb
324
395
  - lib/scout_apm/utils/klass_helper.rb
396
+ - lib/scout_apm/utils/marshal_logging.rb
325
397
  - lib/scout_apm/utils/numbers.rb
326
398
  - lib/scout_apm/utils/scm.rb
327
399
  - lib/scout_apm/utils/sql_sanitizer.rb
@@ -334,20 +406,32 @@ files:
334
406
  - scout_apm.gemspec
335
407
  - test/data/config_test_1.yml
336
408
  - test/test_helper.rb
409
+ - test/tmp/README.md
410
+ - test/unit/agent_context_test.rb
337
411
  - test/unit/agent_test.rb
412
+ - test/unit/auto_instrument/assignments-instrumented.rb
413
+ - test/unit/auto_instrument/assignments.rb
414
+ - test/unit/auto_instrument/controller-ast.txt
415
+ - test/unit/auto_instrument/controller-instrumented.rb
416
+ - test/unit/auto_instrument/controller.rb
417
+ - test/unit/auto_instrument/rescue_from-instrumented.rb
418
+ - test/unit/auto_instrument/rescue_from.rb
419
+ - test/unit/auto_instrument_test.rb
338
420
  - test/unit/background_job_integrations/sidekiq_test.rb
339
421
  - test/unit/config_test.rb
340
422
  - test/unit/context_test.rb
341
423
  - test/unit/db_query_metric_set_test.rb
342
424
  - test/unit/db_query_metric_stats_test.rb
343
425
  - test/unit/environment_test.rb
426
+ - test/unit/error_service/error_buffer_test.rb
427
+ - test/unit/error_service/ignored_exceptions_test.rb
344
428
  - test/unit/extensions/periodic_callbacks_test.rb
345
429
  - test/unit/extensions/transaction_callbacks_test.rb
346
430
  - test/unit/fake_store_test.rb
347
431
  - test/unit/git_revision_test.rb
348
432
  - test/unit/histogram_test.rb
349
433
  - test/unit/ignored_uris_test.rb
350
- - test/unit/instruments/active_record_instruments_test.rb
434
+ - test/unit/instruments/active_record_test.rb
351
435
  - test/unit/instruments/net_http_test.rb
352
436
  - test/unit/instruments/percentile_sampler_test.rb
353
437
  - test/unit/layaway_test.rb
@@ -361,9 +445,9 @@ files:
361
445
  - test/unit/remote/test_message.rb
362
446
  - test/unit/remote/test_router.rb
363
447
  - test/unit/remote/test_server.rb
448
+ - test/unit/request_histograms_test.rb
364
449
  - test/unit/scored_item_set_test.rb
365
450
  - test/unit/serializers/payload_serializer_test.rb
366
- - test/unit/slow_job_policy_test.rb
367
451
  - test/unit/slow_request_policy_test.rb
368
452
  - test/unit/sql_sanitizer_test.rb
369
453
  - test/unit/store_test.rb
@@ -375,7 +459,6 @@ files:
375
459
  - test/unit/utils/backtrace_parser_test.rb
376
460
  - test/unit/utils/numbers_test.rb
377
461
  - test/unit/utils/scm.rb
378
- - tester.rb
379
462
  homepage: https://github.com/scoutapp/scout_apm_ruby
380
463
  licenses:
381
464
  - Proprietary (See LICENSE.md)
@@ -389,15 +472,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
389
472
  requirements:
390
473
  - - ">="
391
474
  - !ruby/object:Gem::Version
392
- version: '0'
475
+ version: '2.1'
393
476
  required_rubygems_version: !ruby/object:Gem::Requirement
394
477
  requirements:
395
- - - ">"
478
+ - - ">="
396
479
  - !ruby/object:Gem::Version
397
- version: 1.3.1
480
+ version: '0'
398
481
  requirements: []
399
- rubyforge_project: scout_apm
400
- rubygems_version: 2.4.5.5
482
+ rubygems_version: 3.0.8
401
483
  signing_key:
402
484
  specification_version: 4
403
485
  summary: Ruby application performance monitoring
@@ -1,37 +0,0 @@
1
- begin
2
- require 'mkmf'
3
- can_compile = true
4
- rescue Exception
5
- # This will appear only in verbose mode.
6
- $stderr.puts "Could not require 'mkmf'. Not fatal, the Stacks extension is optional."
7
- end
8
-
9
- can_compile &&= have_func('rb_postponed_job_register_one')
10
- can_compile &&= have_func('rb_profile_frames')
11
- can_compile &&= have_func('rb_profile_frame_absolute_path')
12
- can_compile &&= have_func('rb_profile_frame_label')
13
- can_compile &&= have_func('rb_profile_frame_classpath')
14
-
15
- # Explicitly link against librt
16
- if have_macro('__linux__')
17
- can_compile &&= have_library('rt') # for timer_create, timer_settime
18
- end
19
-
20
- # Pick the atomics implementation
21
- has_atomics_header = have_header("stdatomic.h")
22
- if has_atomics_header
23
- $defs.push "-DSCOUT_USE_NEW_ATOMICS"
24
- else
25
- $defs.push "-DSCOUT_USE_OLD_ATOMICS"
26
- end
27
-
28
- if can_compile
29
- create_makefile('stacks')
30
- else
31
- # Create a dummy Makefile, to satisfy Gem::Installer#install
32
- mfile = open("Makefile", "wb")
33
- mfile.puts '.PHONY: install'
34
- mfile.puts 'install:'
35
- mfile.puts "\t" + '@echo "Stack extension not installed, skipping."'
36
- mfile.close
37
- end
@@ -1,86 +0,0 @@
1
- /////////////////////////////////////////////////////////////////////////////////
2
- // ATOMIC DEFS
3
- //
4
- // GCC added C11 atomics in 4.9, which is after ubuntu 14.04's version. Provide
5
- // typedefs around what we really use to allow compatibility
6
- //
7
- /////////////////////////////////////////////////////////////////////////////////
8
-
9
-
10
- /////////////////////////////////////////////////////////////////////////////////
11
- // Build system MUST set either SCOUT_USE_OLD_ATOMICS or SCOUT_USE_NEW_ATOMICS,
12
- // but not both
13
- /////////////////////////////////////////////////////////////////////////////////
14
-
15
-
16
- #ifdef SCOUT_USE_OLD_ATOMICS
17
-
18
- typedef bool atomic_bool_t;
19
- typedef uint16_t atomic_uint16_t;
20
- typedef uint32_t atomic_uint32_t;
21
-
22
- // Function which abuses compare&swap to set the value to what you want.
23
- void scout_macro_fn_atomic_store_bool(bool* p_ai, bool val)
24
- {
25
- bool ai_was;
26
- ai_was = *p_ai;
27
-
28
- do {
29
- ai_was = __sync_val_compare_and_swap (p_ai, ai_was, val);
30
- } while (ai_was != *p_ai);
31
- }
32
-
33
- // Function which abuses compare&swap to set the value to what you want.
34
- void scout_macro_fn_atomic_store_int16(atomic_uint16_t* p_ai, atomic_uint16_t val)
35
- {
36
- atomic_uint16_t ai_was;
37
- ai_was = *p_ai;
38
-
39
- do {
40
- ai_was = __sync_val_compare_and_swap (p_ai, ai_was, val);
41
- } while (ai_was != *p_ai);
42
- }
43
-
44
- // Function which abuses compare&swap to set the value to what you want.
45
- void scout_macro_fn_atomic_store_int32(atomic_uint32_t* p_ai, atomic_uint32_t val)
46
- {
47
- atomic_uint32_t ai_was;
48
- ai_was = *p_ai;
49
-
50
- do {
51
- ai_was = __sync_val_compare_and_swap (p_ai, ai_was, val);
52
- } while (ai_was != *p_ai);
53
- }
54
-
55
-
56
- #define ATOMIC_STORE_BOOL(var, value) scout_macro_fn_atomic_store_bool(var, value)
57
- #define ATOMIC_STORE_INT16(var, value) scout_macro_fn_atomic_store_int16(var, value)
58
- #define ATOMIC_STORE_INT32(var, value) scout_macro_fn_atomic_store_int32(var, value)
59
- #define ATOMIC_LOAD(var) __sync_fetch_and_add((var),0)
60
- #define ATOMIC_ADD(var, value) __sync_fetch_and_add((var), value)
61
- #define ATOMIC_INIT(value) value
62
-
63
- #endif
64
-
65
-
66
- /////////////////////////////////////////////////////////////////////////////////
67
-
68
-
69
- #ifdef SCOUT_USE_NEW_ATOMICS
70
-
71
- // We have c11 atomics
72
- #include <stdatomic.h>
73
- #define ATOMIC_STORE_BOOL(var, value) atomic_store(var, value)
74
- #define ATOMIC_STORE_INT16(var, value) atomic_store(var, value)
75
- #define ATOMIC_STORE_INT32(var, value) atomic_store(var, value)
76
- #define ATOMIC_LOAD(var) atomic_load(var)
77
- #define ATOMIC_ADD(var, value) atomic_fetch_add(var, value)
78
- #define ATOMIC_INIT(value) ATOMIC_VAR_INIT(value)
79
-
80
- typedef atomic_bool atomic_bool_t;
81
- typedef atomic_uint_fast16_t atomic_uint16_t;
82
- typedef atomic_uint_fast32_t atomic_uint32_t;
83
-
84
- #endif
85
-
86
-