scout_apm 3.0.0.pre11 → 3.0.0.pre12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.markdown +13 -4
  3. data/Guardfile +1 -0
  4. data/lib/scout_apm.rb +6 -0
  5. data/lib/scout_apm/agent/reporting.rb +2 -1
  6. data/lib/scout_apm/attribute_arranger.rb +14 -1
  7. data/lib/scout_apm/config.rb +12 -0
  8. data/lib/scout_apm/db_query_metric_set.rb +80 -0
  9. data/lib/scout_apm/db_query_metric_stats.rb +102 -0
  10. data/lib/scout_apm/fake_store.rb +6 -0
  11. data/lib/scout_apm/instant/middleware.rb +6 -1
  12. data/lib/scout_apm/instruments/active_record.rb +111 -0
  13. data/lib/scout_apm/layer.rb +4 -0
  14. data/lib/scout_apm/layer_converters/allocation_metric_converter.rb +5 -6
  15. data/lib/scout_apm/layer_converters/converter_base.rb +7 -19
  16. data/lib/scout_apm/layer_converters/database_converter.rb +81 -0
  17. data/lib/scout_apm/layer_converters/depth_first_walker.rb +22 -10
  18. data/lib/scout_apm/layer_converters/error_converter.rb +5 -7
  19. data/lib/scout_apm/layer_converters/find_layer_by_type.rb +34 -0
  20. data/lib/scout_apm/layer_converters/histograms.rb +14 -0
  21. data/lib/scout_apm/layer_converters/job_converter.rb +35 -49
  22. data/lib/scout_apm/layer_converters/metric_converter.rb +16 -18
  23. data/lib/scout_apm/layer_converters/request_queue_time_converter.rb +10 -12
  24. data/lib/scout_apm/layer_converters/slow_job_converter.rb +33 -35
  25. data/lib/scout_apm/layer_converters/slow_request_converter.rb +22 -18
  26. data/lib/scout_apm/limited_layer.rb +4 -0
  27. data/lib/scout_apm/metric_meta.rb +0 -5
  28. data/lib/scout_apm/metric_stats.rb +8 -1
  29. data/lib/scout_apm/serializers/db_query_serializer_to_json.rb +15 -0
  30. data/lib/scout_apm/serializers/payload_serializer.rb +4 -3
  31. data/lib/scout_apm/serializers/payload_serializer_to_json.rb +5 -2
  32. data/lib/scout_apm/slow_job_policy.rb +1 -10
  33. data/lib/scout_apm/slow_request_policy.rb +1 -10
  34. data/lib/scout_apm/store.rb +41 -22
  35. data/lib/scout_apm/tracked_request.rb +28 -40
  36. data/lib/scout_apm/utils/active_record_metric_name.rb +8 -4
  37. data/lib/scout_apm/version.rb +1 -1
  38. data/test/unit/db_query_metric_set_test.rb +56 -0
  39. data/test/unit/db_query_metric_stats_test.rb +113 -0
  40. data/test/unit/fake_store_test.rb +10 -0
  41. data/test/unit/layer_converters/depth_first_walker_test.rb +66 -0
  42. data/test/unit/layer_converters/metric_converter_test.rb +22 -0
  43. data/test/unit/layer_converters/stubs.rb +33 -0
  44. data/test/unit/serializers/payload_serializer_test.rb +3 -12
  45. data/test/unit/store_test.rb +4 -4
  46. data/test/unit/utils/active_record_metric_name_test.rb +8 -0
  47. metadata +20 -2
@@ -14,11 +14,11 @@ class StoreTest < Minitest::Test
14
14
  s = ScoutApm::Store.new
15
15
  s.track_one!("Controller", "user/show", 10)
16
16
 
17
- assert_equal(1, s.reporting_periods.size)
17
+ assert_equal(1, s.instance_variable_get('@reporting_periods').size)
18
18
 
19
19
  s.write_to_layaway(FakeFailingLayaway.new, true)
20
20
 
21
- assert_equal({}, s.reporting_periods)
21
+ assert_equal({}, s.instance_variable_get('@reporting_periods'))
22
22
  end
23
23
 
24
24
  def test_writing_layaway_removes_stale_timestamps
@@ -29,11 +29,11 @@ class StoreTest < Minitest::Test
29
29
  s = ScoutApm::Store.new
30
30
  ScoutApm::Instruments::Process::ProcessMemory.new(Logger.new(StringIO.new)).metrics(stale_rp.timestamp, s)
31
31
  ScoutApm::Instruments::Process::ProcessMemory.new(Logger.new(StringIO.new)).metrics(current_rp.timestamp, s)
32
- assert_equal 2, s.reporting_periods.size
32
+ assert_equal 2, s.instance_variable_get('@reporting_periods').size
33
33
 
34
34
  s.write_to_layaway(FakeFailingLayaway.new, true)
35
35
 
36
- assert_equal({}, s.reporting_periods)
36
+ assert_equal({}, s.instance_variable_get('@reporting_periods'))
37
37
  end
38
38
  end
39
39
 
@@ -47,6 +47,14 @@ class ActiveRecordMetricNameTest < Minitest::Test
47
47
  assert_equal "SQL/Unknown", mn.to_s
48
48
  end
49
49
 
50
+ def test_with_sql_name
51
+ sql = %q|INSERT INTO "users".* VALUES (1,2,3)|
52
+ name = "SQL"
53
+
54
+ mn = ScoutApm::Utils::ActiveRecordMetricName.new(sql, name)
55
+ assert_equal "SQL/Unknown", mn.to_s
56
+ end
57
+
50
58
  # TODO: Determine if there should be a distinction between Unknown and Other.
51
59
  def test_with_custom_name
52
60
  sql = %q|SELECT "users".* FROM "users" /*application:Testapp,controller:public,action:index*/|
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.pre11
4
+ version: 3.0.0.pre12
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: 2017-09-26 00:00:00.000000000 Z
12
+ date: 2017-10-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
@@ -179,6 +179,8 @@ files:
179
179
  - lib/scout_apm/call_set.rb
180
180
  - lib/scout_apm/config.rb
181
181
  - lib/scout_apm/context.rb
182
+ - lib/scout_apm/db_query_metric_set.rb
183
+ - lib/scout_apm/db_query_metric_stats.rb
182
184
  - lib/scout_apm/debug.rb
183
185
  - lib/scout_apm/environment.rb
184
186
  - lib/scout_apm/fake_store.rb
@@ -220,8 +222,11 @@ files:
220
222
  - lib/scout_apm/layer_children_set.rb
221
223
  - lib/scout_apm/layer_converters/allocation_metric_converter.rb
222
224
  - lib/scout_apm/layer_converters/converter_base.rb
225
+ - lib/scout_apm/layer_converters/database_converter.rb
223
226
  - lib/scout_apm/layer_converters/depth_first_walker.rb
224
227
  - lib/scout_apm/layer_converters/error_converter.rb
228
+ - lib/scout_apm/layer_converters/find_layer_by_type.rb
229
+ - lib/scout_apm/layer_converters/histograms.rb
225
230
  - lib/scout_apm/layer_converters/job_converter.rb
226
231
  - lib/scout_apm/layer_converters/metric_converter.rb
227
232
  - lib/scout_apm/layer_converters/request_queue_time_converter.rb
@@ -245,6 +250,7 @@ files:
245
250
  - lib/scout_apm/request_manager.rb
246
251
  - lib/scout_apm/scored_item_set.rb
247
252
  - lib/scout_apm/serializers/app_server_load_serializer.rb
253
+ - lib/scout_apm/serializers/db_query_serializer_to_json.rb
248
254
  - lib/scout_apm/serializers/directive_serializer.rb
249
255
  - lib/scout_apm/serializers/histograms_serializer_to_json.rb
250
256
  - lib/scout_apm/serializers/jobs_serializer_to_json.rb
@@ -291,7 +297,10 @@ files:
291
297
  - test/unit/background_job_integrations/sidekiq_test.rb
292
298
  - test/unit/config_test.rb
293
299
  - test/unit/context_test.rb
300
+ - test/unit/db_query_metric_set_test.rb
301
+ - test/unit/db_query_metric_stats_test.rb
294
302
  - test/unit/environment_test.rb
303
+ - test/unit/fake_store_test.rb
295
304
  - test/unit/git_revision_test.rb
296
305
  - test/unit/histogram_test.rb
297
306
  - test/unit/ignored_uris_test.rb
@@ -300,6 +309,9 @@ files:
300
309
  - test/unit/instruments/percentile_sampler_test.rb
301
310
  - test/unit/layaway_test.rb
302
311
  - test/unit/layer_children_set_test.rb
312
+ - test/unit/layer_converters/depth_first_walker_test.rb
313
+ - test/unit/layer_converters/metric_converter_test.rb
314
+ - test/unit/layer_converters/stubs.rb
303
315
  - test/unit/limited_layer_test.rb
304
316
  - test/unit/metric_set_test.rb
305
317
  - test/unit/remote/test_message.rb
@@ -349,7 +361,10 @@ test_files:
349
361
  - test/unit/background_job_integrations/sidekiq_test.rb
350
362
  - test/unit/config_test.rb
351
363
  - test/unit/context_test.rb
364
+ - test/unit/db_query_metric_set_test.rb
365
+ - test/unit/db_query_metric_stats_test.rb
352
366
  - test/unit/environment_test.rb
367
+ - test/unit/fake_store_test.rb
353
368
  - test/unit/git_revision_test.rb
354
369
  - test/unit/histogram_test.rb
355
370
  - test/unit/ignored_uris_test.rb
@@ -358,6 +373,9 @@ test_files:
358
373
  - test/unit/instruments/percentile_sampler_test.rb
359
374
  - test/unit/layaway_test.rb
360
375
  - test/unit/layer_children_set_test.rb
376
+ - test/unit/layer_converters/depth_first_walker_test.rb
377
+ - test/unit/layer_converters/metric_converter_test.rb
378
+ - test/unit/layer_converters/stubs.rb
361
379
  - test/unit/limited_layer_test.rb
362
380
  - test/unit/metric_set_test.rb
363
381
  - test/unit/remote/test_message.rb