scout_apm 2.3.5 → 2.4.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.markdown +0 -23
  3. data/lib/scout_apm.rb +21 -10
  4. data/lib/scout_apm/agent.rb +98 -336
  5. data/lib/scout_apm/agent/exit_handler.rb +64 -0
  6. data/lib/scout_apm/agent/preconditions.rb +69 -0
  7. data/lib/scout_apm/agent_context.rb +226 -0
  8. data/lib/scout_apm/app_server_load.rb +20 -18
  9. data/lib/scout_apm/background_job_integrations/resque.rb +7 -8
  10. data/lib/scout_apm/background_job_integrations/sidekiq.rb +2 -8
  11. data/lib/scout_apm/background_recorder.rb +8 -3
  12. data/lib/scout_apm/background_worker.rb +14 -7
  13. data/lib/scout_apm/config.rb +35 -29
  14. data/lib/scout_apm/context.rb +11 -4
  15. data/lib/scout_apm/db_query_metric_set.rb +17 -5
  16. data/lib/scout_apm/debug.rb +1 -1
  17. data/lib/scout_apm/environment.rb +10 -14
  18. data/lib/scout_apm/framework_integrations/sinatra.rb +1 -1
  19. data/lib/scout_apm/git_revision.rb +13 -8
  20. data/lib/scout_apm/histogram.rb +1 -1
  21. data/lib/scout_apm/instant/middleware.rb +7 -7
  22. data/lib/scout_apm/instant_reporting.rb +7 -7
  23. data/lib/scout_apm/instrument_manager.rb +87 -0
  24. data/lib/scout_apm/instruments/action_controller_rails_2.rb +12 -7
  25. data/lib/scout_apm/instruments/action_controller_rails_3_rails4.rb +16 -11
  26. data/lib/scout_apm/instruments/action_view.rb +11 -7
  27. data/lib/scout_apm/instruments/active_record.rb +28 -51
  28. data/lib/scout_apm/instruments/elasticsearch.rb +10 -6
  29. data/lib/scout_apm/instruments/grape.rb +12 -8
  30. data/lib/scout_apm/instruments/http_client.rb +11 -10
  31. data/lib/scout_apm/instruments/influxdb.rb +10 -6
  32. data/lib/scout_apm/instruments/middleware_detailed.rb +11 -5
  33. data/lib/scout_apm/instruments/middleware_summary.rb +11 -5
  34. data/lib/scout_apm/instruments/mongoid.rb +10 -5
  35. data/lib/scout_apm/instruments/moped.rb +11 -6
  36. data/lib/scout_apm/instruments/net_http.rb +11 -9
  37. data/lib/scout_apm/instruments/percentile_sampler.rb +8 -6
  38. data/lib/scout_apm/instruments/process/process_cpu.rb +8 -4
  39. data/lib/scout_apm/instruments/process/process_memory.rb +15 -10
  40. data/lib/scout_apm/instruments/rails_router.rb +12 -6
  41. data/lib/scout_apm/instruments/redis.rb +10 -6
  42. data/lib/scout_apm/instruments/samplers.rb +11 -0
  43. data/lib/scout_apm/instruments/sinatra.rb +5 -4
  44. data/lib/scout_apm/layaway.rb +26 -39
  45. data/lib/scout_apm/layaway_file.rb +8 -3
  46. data/lib/scout_apm/layer.rb +1 -1
  47. data/lib/scout_apm/layer_converters/converter_base.rb +4 -2
  48. data/lib/scout_apm/layer_converters/database_converter.rb +1 -1
  49. data/lib/scout_apm/layer_converters/histograms.rb +2 -2
  50. data/lib/scout_apm/layer_converters/slow_job_converter.rb +4 -3
  51. data/lib/scout_apm/layer_converters/slow_request_converter.rb +5 -4
  52. data/lib/scout_apm/logger.rb +143 -0
  53. data/lib/scout_apm/middleware.rb +7 -9
  54. data/lib/scout_apm/periodic_work.rb +28 -0
  55. data/lib/scout_apm/remote/server.rb +0 -2
  56. data/lib/scout_apm/reporter.rb +14 -8
  57. data/lib/scout_apm/reporting.rb +135 -0
  58. data/lib/scout_apm/request_manager.rb +4 -7
  59. data/lib/scout_apm/serializers/payload_serializer.rb +1 -1
  60. data/lib/scout_apm/slow_job_policy.rb +6 -2
  61. data/lib/scout_apm/slow_job_record.rb +5 -5
  62. data/lib/scout_apm/slow_request_policy.rb +6 -2
  63. data/lib/scout_apm/slow_transaction.rb +5 -5
  64. data/lib/scout_apm/store.rb +22 -16
  65. data/lib/scout_apm/synchronous_recorder.rb +7 -3
  66. data/lib/scout_apm/tasks/doctor.rb +75 -0
  67. data/lib/scout_apm/tasks/support.rb +22 -0
  68. data/lib/scout_apm/tracer.rb +5 -5
  69. data/lib/scout_apm/tracked_request.rb +23 -35
  70. data/lib/scout_apm/utils/backtrace_parser.rb +1 -1
  71. data/lib/scout_apm/utils/installed_gems.rb +7 -3
  72. data/lib/scout_apm/utils/klass_helper.rb +8 -2
  73. data/lib/scout_apm/utils/scm.rb +1 -1
  74. data/lib/scout_apm/utils/sql_sanitizer.rb +4 -6
  75. data/lib/scout_apm/version.rb +1 -1
  76. data/lib/tasks/doctor.rake +11 -0
  77. data/test/test_helper.rb +15 -2
  78. data/test/unit/agent_test.rb +1 -54
  79. data/test/unit/config_test.rb +9 -5
  80. data/test/unit/context_test.rb +4 -4
  81. data/test/unit/db_query_metric_set_test.rb +11 -4
  82. data/test/unit/fake_store_test.rb +1 -1
  83. data/test/unit/git_revision_test.rb +3 -3
  84. data/test/unit/instruments/net_http_test.rb +2 -1
  85. data/test/unit/instruments/percentile_sampler_test.rb +5 -9
  86. data/test/unit/layaway_test.rb +10 -5
  87. data/test/unit/layer_converters/metric_converter_test.rb +2 -2
  88. data/test/unit/slow_request_policy_test.rb +7 -3
  89. data/test/unit/sql_sanitizer_test.rb +0 -6
  90. data/test/unit/store_test.rb +11 -8
  91. metadata +15 -7
  92. data/lib/scout_apm/agent/logging.rb +0 -74
  93. data/lib/scout_apm/agent/reporting.rb +0 -129
  94. data/lib/scout_apm/utils/null_logger.rb +0 -13
@@ -1,58 +1,5 @@
1
1
  require 'test_helper'
2
- require 'scout_apm/agent'
3
- require 'scout_apm/slow_transaction'
4
- require 'scout_apm/metric_meta'
5
- require 'scout_apm/metric_stats'
6
- require 'scout_apm/context'
7
- require 'scout_apm/store'
8
2
 
9
3
  class AgentTest < Minitest::Test
10
-
11
- # Safeguard to ensure the main agent thread doesn't have any interaction with the layaway file. Contention on file locks can cause delays.
12
- def test_start_with_lock_on_layaway_file
13
- # setup the file, putting a lock on it.
14
- File.open(DATA_FILE_PATH, "w") {}
15
- f = File.open(DATA_FILE_PATH, File::RDWR | File::CREAT)
16
- f.flock(File::LOCK_EX)
17
-
18
- agent = ScoutApm::Agent.instance
19
-
20
- no_timeout = true
21
- begin
22
- Timeout::timeout(3) { agent.start({:monitor => true, :force => true}) }
23
- rescue Timeout::Error
24
- no_timeout = false
25
- ensure
26
- f.flock(File::LOCK_UN)
27
- f.close
28
- end
29
- assert no_timeout, "Agent took >= 3s to start. Possible file lock issue."
30
- end
31
-
32
- def test_reset_file_with_old_format
33
- File.open(DATA_FILE_PATH, 'w') { |file| file.write(Marshal.dump(OLD_FORMAT)) }
34
- begin
35
- ScoutApm::Agent.instance(:force => true).process_metrics
36
- rescue NoMethodError
37
- # The agent will raise an exception the first time metrics are processed for scout_apm < 1.2.
38
- #
39
- # NoMethodError: undefined method `values' for []:Array
40
- # /Users/dlite/projects/scout_apm_ruby/lib/scout_apm/layaway.rb:46:in `periods_ready_for_delivery'
41
- # /Users/dlite/projects/scout_apm_ruby/lib/scout_apm/agent/reporting.rb:31:in `report_to_server'
42
- # /Users/dlite/projects/scout_apm_ruby/lib/scout_apm/agent/reporting.rb:24:in `process_metrics'
43
- # /Users/dlite/projects/scout_apm_ruby/test/unit/layaway_test.rb:27:in `test_reset_file_with_old_format'
44
- end
45
- # Data will be fine the next go-around
46
- no_error = true
47
- begin
48
- ScoutApm::Agent.instance(:force => true).process_metrics
49
- rescue Exception => e
50
- no_error = false
51
- end
52
- assert no_error, "Error trying to process metrics after upgrading from < 1.2 data format: #{e.message if e}"
53
- end
54
-
55
- ## TODO - adds tests to ensure other potentially long-running things don't sneak in, like HTTP calls.
56
-
57
- OLD_FORMAT = {1452533280 => {:metrics => {}, :slow_transactions => {}} } # Pre 1.2 agents used a different file format to store data.
4
+ # XXX: Write tests around agent startup sequence
58
5
  end
@@ -3,8 +3,12 @@ require 'test_helper'
3
3
  require 'scout_apm/config'
4
4
 
5
5
  class ConfigTest < Minitest::Test
6
+ def setup
7
+ @context = ScoutApm::AgentContext.new
8
+ end
9
+
6
10
  def test_initalize_without_a_config
7
- conf = ScoutApm::Config.without_file
11
+ conf = ScoutApm::Config.without_file(@context)
8
12
 
9
13
  # nil for random keys
10
14
  assert_nil conf.value('log_file_path')
@@ -21,7 +25,7 @@ class ConfigTest < Minitest::Test
21
25
  set_rack_env('production')
22
26
 
23
27
  conf_file = File.expand_path('../../data/config_test_1.yml', __FILE__)
24
- conf = ScoutApm::Config.with_file(conf_file)
28
+ conf = ScoutApm::Config.with_file(@context, conf_file)
25
29
 
26
30
  assert_equal 'debug', conf.value('log_level')
27
31
  assert_equal 'APM Test Conf (Production)', conf.value('name')
@@ -29,7 +33,7 @@ class ConfigTest < Minitest::Test
29
33
 
30
34
  def test_loading_file_without_env_in_file
31
35
  conf_file = File.expand_path("../../data/config_test_1.yml", __FILE__)
32
- conf = ScoutApm::Config.with_file(conf_file, environment: "staging")
36
+ conf = ScoutApm::Config.with_file(@context, conf_file, environment: "staging")
33
37
 
34
38
  assert_equal "info", conf.value('log_level') # the default value
35
39
  assert_nil nil, conf.value('name') # the default value
@@ -71,11 +75,11 @@ class ConfigTest < Minitest::Test
71
75
  def test_any_keys_found
72
76
  ENV.stubs(:has_key?).returns(nil)
73
77
 
74
- conf = ScoutApm::Config.with_file("a_file_that_doesnt_exist.yml")
78
+ conf = ScoutApm::Config.with_file(@context, "a_file_that_doesnt_exist.yml")
75
79
  assert ! conf.any_keys_found?
76
80
 
77
81
  ENV.stubs(:has_key?).with("SCOUT_MONITOR").returns("true")
78
- conf = ScoutApm::Config.with_file("a_file_that_doesnt_exist.yml")
82
+ conf = ScoutApm::Config.with_file(@context, "a_file_that_doesnt_exist.yml")
79
83
  assert conf.any_keys_found?
80
84
  end
81
85
  end
@@ -4,25 +4,25 @@ require 'scout_apm/context'
4
4
 
5
5
  class ContextText < Minitest::Test
6
6
  def test_ignore_nil_value
7
- context = ScoutApm::Context.new
7
+ context = ScoutApm::Context.new(ScoutApm::AgentContext.new)
8
8
  assert hash = context.add(:nil_key => nil, :org => 'org')
9
9
  assert_equal ({:org => 'org'}), hash
10
10
  end
11
11
 
12
12
  def test_ignore_nil_key
13
- context = ScoutApm::Context.new
13
+ context = ScoutApm::Context.new(ScoutApm::AgentContext.new)
14
14
  assert hash = context.add(nil => nil, :org => 'org')
15
15
  assert_equal ({:org => 'org'}), hash
16
16
  end
17
17
 
18
18
  def test_ignore_unsupported_value_type
19
- context = ScoutApm::Context.new
19
+ context = ScoutApm::Context.new(ScoutApm::AgentContext.new)
20
20
  assert hash = context.add(:array => [1,2,3,4], :org => 'org')
21
21
  assert_equal ({:org => 'org'}), hash
22
22
  end
23
23
 
24
24
  def test_ignore_unsupported_key_type
25
- context = ScoutApm::Context.new
25
+ context = ScoutApm::Context.new(ScoutApm::AgentContext.new)
26
26
  assert hash = context.add([1,2,3,4] => 'hey', :org => 'org')
27
27
  assert_equal ({:org => 'org'}), hash
28
28
  end
@@ -8,7 +8,9 @@ class DbQueryMetricSetTest < Minitest::Test
8
8
  config = make_fake_config(
9
9
  'database_metric_limit' => 5, # The hard limit on db metrics
10
10
  'database_metric_report_limit' => 2,)
11
- set = DbQueryMetricSet.new(config)
11
+ context = ScoutApm::AgentContext.new().tap{|c| c.config = config }
12
+ set = DbQueryMetricSet.new(context)
13
+
12
14
  set << fake_stat("a", 10)
13
15
  set << fake_stat("b", 20)
14
16
  set << fake_stat("c", 30)
@@ -23,7 +25,8 @@ class DbQueryMetricSetTest < Minitest::Test
23
25
  config = make_fake_config(
24
26
  'database_metric_limit' => 50, # much larger max, uninterested in hitting it.
25
27
  'database_metric_report_limit' => 2,)
26
- set = DbQueryMetricSet.new(config)
28
+ context = ScoutApm::AgentContext.new().tap{|c| c.config = config }
29
+ set = DbQueryMetricSet.new(context)
27
30
  set << fake_stat("a", 10)
28
31
  set << fake_stat("b", 20)
29
32
  set << fake_stat("c", 30)
@@ -36,10 +39,14 @@ class DbQueryMetricSetTest < Minitest::Test
36
39
  end
37
40
 
38
41
  def test_combine
39
- set1 = DbQueryMetricSet.new
42
+ config = make_fake_config(
43
+ 'database_metric_limit' => 5, # The hard limit on db metrics
44
+ 'database_metric_report_limit' => 2,)
45
+ context = ScoutApm::AgentContext.new().tap{|c| c.config = config }
46
+ set1 = DbQueryMetricSet.new(context)
40
47
  set1 << fake_stat("a", 10)
41
48
  set1 << fake_stat("b", 20)
42
- set2 = DbQueryMetricSet.new
49
+ set2 = DbQueryMetricSet.new(context)
43
50
  set2 << fake_stat("c", 10)
44
51
  set2 << fake_stat("d", 20)
45
52
 
@@ -3,7 +3,7 @@ require 'test_helper'
3
3
  class FakeStoreTest < Minitest::Test
4
4
  def test_responds_to_same_instance_methods_as_store
5
5
  fs = ScoutApm::FakeStore.new
6
- s = ScoutApm::Store.new
6
+ s = ScoutApm::Store.new(ScoutApm::AgentContext.new)
7
7
 
8
8
  assert_equal [], s.methods - fs.methods
9
9
  end
@@ -6,10 +6,10 @@ class GitRevisionTest < Minitest::Test
6
6
  # TODO - other tests that would be nice:
7
7
  # * ensure we only detect once, on initialize.
8
8
  # * tests for reading cap files
9
-
9
+
10
10
  def test_sha_from_heroku
11
11
  ENV['HEROKU_SLUG_COMMIT'] = 'heroku_slug'
12
- revision = ScoutApm::GitRevision.new
12
+ revision = ScoutApm::GitRevision.new(ScoutApm::AgentContext.new)
13
13
  assert_equal 'heroku_slug', revision.sha
14
14
  end
15
- end
15
+ end
@@ -6,7 +6,8 @@ require 'addressable'
6
6
 
7
7
  class NetHttpTest < Minitest::Test
8
8
  def setup
9
- ScoutApm::Instruments::NetHttp.new.install
9
+ @context = ScoutApm::AgentContext.new
10
+ ScoutApm::Instruments::NetHttp.new(@context).install
10
11
  end
11
12
 
12
13
  def test_request_scout_description_for_uri
@@ -9,13 +9,13 @@ class PercentileSamplerTest < Minitest::Test
9
9
  attr_reader :subject
10
10
 
11
11
  def setup
12
- @subject = PercentileSampler.new(logger, histograms)
12
+ @context = ScoutApm::AgentContext.new
13
+ @subject = PercentileSampler.new(@context)
13
14
  end
14
15
 
15
-
16
16
  def test_initialize_with_logger_and_histogram_set
17
- assert_equal subject.logger, logger
18
- assert_equal subject.histograms, histograms
17
+ assert_equal subject.logger, @context.logger
18
+ assert_equal subject.histograms, @context.request_histograms_by_time
19
19
  end
20
20
 
21
21
  def test_implements_instrument_interface
@@ -113,11 +113,7 @@ class PercentileSamplerTest < Minitest::Test
113
113
  end
114
114
 
115
115
  def histograms
116
- @histograms ||= begin
117
- @request_histograms_by_time = Hash.new { |hash, key|
118
- hash[key] = ScoutApm::RequestHistograms.new
119
- }
120
- end
116
+ @context.request_histograms_by_time
121
117
  end
122
118
 
123
119
  def histogram
@@ -10,27 +10,32 @@ class LayawayTest < Minitest::Test
10
10
  def test_directory_uses_DATA_FILE_option
11
11
  FileUtils.mkdir_p '/tmp/scout_apm_test/data_file_option'
12
12
  config = make_fake_config("data_file" => "/tmp/scout_apm_test/data_file_option")
13
+ context = ScoutApm::AgentContext.new().tap{|c| c.config = config }
14
+ layaway = ScoutApm::Layaway.new(context)
13
15
 
14
- assert_equal Pathname.new("/tmp/scout_apm_test/data_file_option"), ScoutApm::Layaway.new(config, ScoutApm::Agent.instance.environment).directory
16
+ assert_equal Pathname.new("/tmp/scout_apm_test/data_file_option"), layaway.directory
15
17
  end
16
18
 
17
19
  def test_directory_looks_for_root_slash_tmp
18
20
  FileUtils.mkdir_p '/tmp/scout_apm_test/tmp'
19
21
  config = make_fake_config({})
20
22
  env = make_fake_environment(:root => "/tmp/scout_apm_test")
23
+ context = ScoutApm::AgentContext.new().tap{|c| c.config = config; c.environment = env }
21
24
 
22
- assert_equal Pathname.new("/tmp/scout_apm_test/tmp"), ScoutApm::Layaway.new(config, env).directory
25
+ assert_equal Pathname.new("/tmp/scout_apm_test/tmp"), ScoutApm::Layaway.new(context).directory
23
26
  end
24
27
 
25
28
  def test_layaway_file_limit_prevents_new_writes
26
29
  FileUtils.mkdir_p '/tmp/scout_apm_test/layaway_limit'
27
30
  config = make_fake_config("data_file" => "/tmp/scout_apm_test/layaway_limit")
28
- layaway = ScoutApm::Layaway.new(config, ScoutApm::Agent.instance.environment)
31
+ context = ScoutApm::AgentContext.new().tap{|c| c.config = config }
32
+ layaway = ScoutApm::Layaway.new(context)
29
33
  layaway.delete_files_for(:all)
30
34
 
35
+ context = ScoutApm::AgentContext.new
31
36
  current_time = Time.now.utc
32
- current_rp = ScoutApm::StoreReportingPeriod.new(current_time)
33
- stale_rp = ScoutApm::StoreReportingPeriod.new(current_time - current_time.sec - 120)
37
+ current_rp = ScoutApm::StoreReportingPeriod.new(current_time, context)
38
+ stale_rp = ScoutApm::StoreReportingPeriod.new(current_time - current_time.sec - 120, context)
34
39
 
35
40
  # layaway.write_reporting_period returns nil on successful write
36
41
  # It should probably be changed to return true or the number of bytes written
@@ -7,13 +7,13 @@ class MetricConverterTest < Minitest::Test
7
7
  include Stubs
8
8
 
9
9
  def test_register_adds_hooks
10
- mc = MetricConverter.new(faux_request, faux_layer_finder, faux_store)
10
+ mc = MetricConverter.new(agent_context, faux_request, faux_layer_finder, faux_store)
11
11
  faux_walker.expects(:on)
12
12
  mc.register_hooks(faux_walker)
13
13
  end
14
14
 
15
15
  def test_record
16
- mc = MetricConverter.new(faux_request, faux_layer_finder, faux_store)
16
+ mc = MetricConverter.new(agent_context, faux_request, faux_layer_finder, faux_store)
17
17
  faux_store.expects(:track!)
18
18
  mc.record!
19
19
  end
@@ -17,9 +17,13 @@ class FakeRequest
17
17
  end
18
18
 
19
19
  class SlowRequestPolicyTest < Minitest::Test
20
+ def setup
21
+ @context = ScoutApm::AgentContext.new
22
+ end
23
+
20
24
  def test_stored_records_current_time
21
25
  test_start = Time.now
22
- policy = ScoutApm::SlowRequestPolicy.new
26
+ policy = ScoutApm::SlowRequestPolicy.new(@context)
23
27
  request = FakeRequest.new("users/index")
24
28
 
25
29
  policy.stored!(request)
@@ -27,12 +31,12 @@ class SlowRequestPolicyTest < Minitest::Test
27
31
  end
28
32
 
29
33
  def test_score
30
- policy = ScoutApm::SlowRequestPolicy.new
34
+ policy = ScoutApm::SlowRequestPolicy.new(@context)
31
35
  request = FakeRequest.new("users/index")
32
36
 
33
37
  request.set_duration(10) # 10 seconds
34
38
  policy.last_seen[request.unique_name] = Time.now - 120 # 2 minutes since last seen
35
- ScoutApm::Agent.instance.request_histograms.add(request.unique_name, 1)
39
+ @context.request_histograms.add(request.unique_name, 1)
36
40
 
37
41
  # Actual value I have in console is 1.499
38
42
  assert policy.score(request) > 1.45
@@ -1,14 +1,8 @@
1
1
  require 'test_helper'
2
2
 
3
- require 'scout_apm/utils/sql_sanitizer'
4
-
5
3
  module ScoutApm
6
4
  module Utils
7
5
  class SqlSanitizerTest < Minitest::Test
8
- def setup
9
- ScoutApm::Agent.instance.init_logger
10
- end
11
-
12
6
  # Too long, and we just bail out to prevent long running instrumentation
13
7
  def test_long_sql
14
8
  sql = " " * 1001
@@ -3,15 +3,17 @@ require 'test_helper'
3
3
  require 'scout_apm/store'
4
4
 
5
5
  class FakeFailingLayaway
6
+ attr_reader :rps_written
6
7
  def write_reporting_period(rp)
7
- raise "Always fails. Sucks."
8
+ @rps_written ||= []
9
+ @rps_written << rp
8
10
  end
9
11
  end
10
12
 
11
13
  class StoreTest < Minitest::Test
12
14
  # TODO: Introduce a clock object to avoid having to use 'force'
13
15
  def test_writing_layaway_removes_timestamps
14
- s = ScoutApm::Store.new
16
+ s = ScoutApm::Store.new(ScoutApm::AgentContext.new)
15
17
  s.track_one!("Controller", "user/show", 10)
16
18
 
17
19
  assert_equal(1, s.instance_variable_get('@reporting_periods').size)
@@ -22,13 +24,14 @@ class StoreTest < Minitest::Test
22
24
  end
23
25
 
24
26
  def test_writing_layaway_removes_stale_timestamps
27
+ context = ScoutApm::AgentContext.new
25
28
  current_time = Time.now.utc
26
- current_rp = ScoutApm::StoreReportingPeriod.new(current_time)
27
- stale_rp = ScoutApm::StoreReportingPeriod.new(current_time - current_time.sec - 120)
29
+ current_rp = ScoutApm::StoreReportingPeriod.new(current_time, context)
30
+ stale_rp = ScoutApm::StoreReportingPeriod.new(current_time - current_time.sec - 120, context)
28
31
 
29
- s = ScoutApm::Store.new
30
- ScoutApm::Instruments::Process::ProcessMemory.new(Logger.new(StringIO.new)).metrics(stale_rp.timestamp, s)
31
- ScoutApm::Instruments::Process::ProcessMemory.new(Logger.new(StringIO.new)).metrics(current_rp.timestamp, s)
32
+ s = ScoutApm::Store.new(context)
33
+ ScoutApm::Instruments::Process::ProcessMemory.new(context).metrics(stale_rp.timestamp, s)
34
+ ScoutApm::Instruments::Process::ProcessMemory.new(context).metrics(current_rp.timestamp, s)
32
35
  assert_equal 2, s.instance_variable_get('@reporting_periods').size
33
36
 
34
37
  s.write_to_layaway(FakeFailingLayaway.new, true)
@@ -43,7 +46,7 @@ class StoreReportingPeriodTest < Minitest::Test
43
46
  attr_reader :subject
44
47
 
45
48
  def setup
46
- @subject = ScoutApm::StoreReportingPeriod.new(ScoutApm::StoreReportingPeriodTimestamp.new)
49
+ @subject = ScoutApm::StoreReportingPeriod.new(ScoutApm::StoreReportingPeriodTimestamp.new(Time.now), ScoutApm::AgentContext.new)
47
50
  end
48
51
 
49
52
  # Check default values at creation time
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: 2.3.5
4
+ version: 2.4.0.pre
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-01-04 00:00:00.000000000 Z
12
+ date: 2017-12-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
@@ -176,8 +176,9 @@ files:
176
176
  - ext/rusage/rusage.c
177
177
  - lib/scout_apm.rb
178
178
  - lib/scout_apm/agent.rb
179
- - lib/scout_apm/agent/logging.rb
180
- - lib/scout_apm/agent/reporting.rb
179
+ - lib/scout_apm/agent/exit_handler.rb
180
+ - lib/scout_apm/agent/preconditions.rb
181
+ - lib/scout_apm/agent_context.rb
181
182
  - lib/scout_apm/app_server_load.rb
182
183
  - lib/scout_apm/attribute_arranger.rb
183
184
  - lib/scout_apm/background_job_integrations/delayed_job.rb
@@ -204,6 +205,7 @@ files:
204
205
  - lib/scout_apm/instant/assets/xmlhttp_instrumentation.html
205
206
  - lib/scout_apm/instant/middleware.rb
206
207
  - lib/scout_apm/instant_reporting.rb
208
+ - lib/scout_apm/instrument_manager.rb
207
209
  - lib/scout_apm/instruments/.DS_Store
208
210
  - lib/scout_apm/instruments/action_controller_rails_2.rb
209
211
  - lib/scout_apm/instruments/action_controller_rails_3_rails4.rb
@@ -224,6 +226,7 @@ files:
224
226
  - lib/scout_apm/instruments/rails_router.rb
225
227
  - lib/scout_apm/instruments/redis.rb
226
228
  - lib/scout_apm/instruments/resque.rb
229
+ - lib/scout_apm/instruments/samplers.rb
227
230
  - lib/scout_apm/instruments/sinatra.rb
228
231
  - lib/scout_apm/job_record.rb
229
232
  - lib/scout_apm/layaway.rb
@@ -243,10 +246,12 @@ files:
243
246
  - lib/scout_apm/layer_converters/slow_job_converter.rb
244
247
  - lib/scout_apm/layer_converters/slow_request_converter.rb
245
248
  - lib/scout_apm/limited_layer.rb
249
+ - lib/scout_apm/logger.rb
246
250
  - lib/scout_apm/metric_meta.rb
247
251
  - lib/scout_apm/metric_set.rb
248
252
  - lib/scout_apm/metric_stats.rb
249
253
  - lib/scout_apm/middleware.rb
254
+ - lib/scout_apm/periodic_work.rb
250
255
  - lib/scout_apm/platform_integrations/cloud_foundry.rb
251
256
  - lib/scout_apm/platform_integrations/heroku.rb
252
257
  - lib/scout_apm/platform_integrations/server.rb
@@ -256,6 +261,7 @@ files:
256
261
  - lib/scout_apm/remote/router.rb
257
262
  - lib/scout_apm/remote/server.rb
258
263
  - lib/scout_apm/reporter.rb
264
+ - lib/scout_apm/reporting.rb
259
265
  - lib/scout_apm/request_histograms.rb
260
266
  - lib/scout_apm/request_manager.rb
261
267
  - lib/scout_apm/scored_item_set.rb
@@ -282,6 +288,8 @@ files:
282
288
  - lib/scout_apm/stack_item.rb
283
289
  - lib/scout_apm/store.rb
284
290
  - lib/scout_apm/synchronous_recorder.rb
291
+ - lib/scout_apm/tasks/doctor.rb
292
+ - lib/scout_apm/tasks/support.rb
285
293
  - lib/scout_apm/tracer.rb
286
294
  - lib/scout_apm/tracked_request.rb
287
295
  - lib/scout_apm/utils/active_record_metric_name.rb
@@ -289,7 +297,6 @@ files:
289
297
  - lib/scout_apm/utils/gzip_helper.rb
290
298
  - lib/scout_apm/utils/installed_gems.rb
291
299
  - lib/scout_apm/utils/klass_helper.rb
292
- - lib/scout_apm/utils/null_logger.rb
293
300
  - lib/scout_apm/utils/numbers.rb
294
301
  - lib/scout_apm/utils/scm.rb
295
302
  - lib/scout_apm/utils/sql_sanitizer.rb
@@ -298,6 +305,7 @@ files:
298
305
  - lib/scout_apm/utils/time.rb
299
306
  - lib/scout_apm/utils/unique_id.rb
300
307
  - lib/scout_apm/version.rb
308
+ - lib/tasks/doctor.rake
301
309
  - scout_apm.gemspec
302
310
  - test/data/config_test_1.yml
303
311
  - test/test_helper.rb
@@ -352,9 +360,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
352
360
  version: '0'
353
361
  required_rubygems_version: !ruby/object:Gem::Requirement
354
362
  requirements:
355
- - - ">="
363
+ - - ">"
356
364
  - !ruby/object:Gem::Version
357
- version: '0'
365
+ version: 1.3.1
358
366
  requirements: []
359
367
  rubyforge_project: scout_apm
360
368
  rubygems_version: 2.4.5.2