scout_apm 3.0.0.pre18 → 3.0.0.pre19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cbd90a42f996c3061f49d47dab8030bd68da59bd
4
- data.tar.gz: 05dd5875bc492ce4e8bcca1f590c20b0c39a7f03
3
+ metadata.gz: 0393ebae36fc959586f76135f0772c9353b2fb82
4
+ data.tar.gz: d64a6fc7477a274b1a4712895ad62066b2653e4d
5
5
  SHA512:
6
- metadata.gz: 62b89c1e2b9220e5e3e3f5ae008e2b858deaafce0b5119eff73ade0dd3b5c5f1447092057605819314dfef7fffd755b3e4a646b11ee5858e4ecaac090f6e2183
7
- data.tar.gz: 9fc7f24849744a01258da4e8927e1bc0804d42b6dcb5d5b467a33042e7c89df245d8b67b75a2c03cb91d02a93a9b6566e6e3b1a5d2d006e90e77a5768209ff6f
6
+ metadata.gz: c9281d472ab3df97780f5518a28c7e059c2e031693a47f91ad96d61b955a07678eb5960ee108a18a1b95d09355bd01f70f9aef3d9a9cbea09468c51ea77812ca
7
+ data.tar.gz: ff8d0ea6114d2de8052780d029dc2c7451ff2e8ee40248e4912959f9fca0308fa0719066ec2e93e391d2c98dfb2ec3353b1883dd0854f084c89f6d6531554b25
data/CHANGELOG.markdown CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  * ScoutProf BETA
4
4
 
5
+ # 2.4.5
6
+
7
+ * More robust installation of instruments at startup
8
+ * Several (very) minor bug fixes
9
+
5
10
  # 2.4.4
6
11
 
7
12
  * Prevent agent from starting when monitor=false
data/lib/scout_apm.rb CHANGED
@@ -204,5 +204,5 @@ if defined?(Rails) && defined?(Rails::VERSION) && defined?(Rails::VERSION::MAJOR
204
204
  end
205
205
  end
206
206
  else
207
- ScoutApm::Agent.instance.start
207
+ ScoutApm::Agent.instance.install
208
208
  end
@@ -35,15 +35,14 @@ module ScoutApm
35
35
  def install(force=false)
36
36
  context.config = ScoutApm::Config.with_file(context, context.config.value("config_file"))
37
37
 
38
- context.logger.info "Scout Agent [#{ScoutApm::VERSION}] Initialized"
38
+ logger.info "Scout Agent [#{ScoutApm::VERSION}] Initialized"
39
39
 
40
- @instrument_manager = ScoutApm::InstrumentManager.new(context)
41
- @instrument_manager.install! if should_load_instruments? || force
40
+ instrument_manager.install! if should_load_instruments? || force
42
41
 
43
42
  install_background_job_integrations
44
43
  install_app_server_integration
45
44
 
46
- logger.info "Scout Agent [#{ScoutApm::VERSION}] installed"
45
+ logger.info "Scout Agent [#{ScoutApm::VERSION}] Installed"
47
46
 
48
47
  context.installed!
49
48
 
@@ -69,6 +68,8 @@ module ScoutApm
69
68
 
70
69
  install unless context.installed?
71
70
 
71
+ instrument_manager.install! if should_load_instruments?
72
+
72
73
  context.started!
73
74
 
74
75
  log_environment
@@ -79,6 +80,10 @@ module ScoutApm
79
80
  start_background_worker
80
81
  end
81
82
 
83
+ def instrument_manager
84
+ @instrument_manager ||= ScoutApm::InstrumentManager.new(context)
85
+ end
86
+
82
87
  def log_environment
83
88
  bg_names = context.environment.background_job_integrations.map{|bg| bg.name }.join(", ")
84
89
 
@@ -123,10 +128,13 @@ module ScoutApm
123
128
  return !context.environment.forking?
124
129
  end
125
130
 
131
+ # monitor is the key configuration here. If it is true, then we want the
132
+ # instruments. If it is false, we mostly don't want them, unless you're
133
+ # asking for devtrace (ie. not reporting to apm servers as a real app, but
134
+ # only for local browsers).
126
135
  def should_load_instruments?
127
136
  return true if context.config.value('dev_trace')
128
- return false unless context.config.value('monitor')
129
- context.environment.app_server_integration.found? || context.environment.background_job_integrations.any?
137
+ context.config.value('monitor')
130
138
  end
131
139
 
132
140
  #################################
@@ -37,5 +37,8 @@ module ScoutApm
37
37
 
38
38
  def add_sampler(sampler)
39
39
  end
40
+
41
+ def tick!
42
+ end
40
43
  end
41
44
  end
@@ -52,12 +52,16 @@ module ScoutApm
52
52
  def write_reporting_period(reporting_period, files_limit = MAX_FILES_LIMIT)
53
53
  if at_layaway_file_limit?(files_limit)
54
54
  # This will happen constantly once we hit this case, so only log the first time
55
- @wrote_layaway_limit_error_message ||= logger.error("Hit layaway file limit. Not writing to layaway file")
55
+ @wrote_layaway_limit_error_message ||= logger.error("Layaway: Hit layaway file limit. Not writing to layaway file")
56
56
  return false
57
57
  end
58
+ logger.debug("Layaway: wrote time period: #{reporting_period.timestamp}")
58
59
  filename = file_for(reporting_period.timestamp)
59
60
  layaway_file = LayawayFile.new(context, filename)
60
61
  layaway_file.write(reporting_period)
62
+ rescue => e
63
+ logger.debug("Layaway: error writing: #{e.message}, #{e.backtrace.inspect}")
64
+ raise e
61
65
  end
62
66
 
63
67
  # Claims a given timestamp by getting an exclusive lock on a timestamped
@@ -98,19 +102,19 @@ module ScoutApm
98
102
  if rps.any?
99
103
  yield rps
100
104
 
101
- logger.debug("Deleting the now-reported layaway files for #{timestamp.to_s}")
105
+ logger.debug("Layaway: Deleting the now-reported files for #{timestamp.to_s}")
102
106
  delete_files_for(timestamp) # also removes the coodinator_file
103
107
  else
104
108
  File.unlink(coordinator_file)
105
- logger.debug("No layaway files to report")
109
+ logger.debug("Layaway: No files to report")
106
110
  end
107
111
 
108
- logger.debug("Checking for any Stale layaway files")
112
+ logger.debug("Layaway: Checking for any stale files")
109
113
  delete_stale_files(timestamp.to_time - STALE_AGE)
110
114
 
111
115
  true
112
116
  rescue Exception => e
113
- logger.debug("Caught an exception in with_claim, with the coordination file locked: #{e.message}, #{e.backtrace.inspect}")
117
+ logger.debug("Layaway: Caught an exception in with_claim, with the coordination file locked: #{e.message}, #{e.backtrace.inspect}")
114
118
  raise
115
119
  ensure
116
120
  # Unlock the file when done!
@@ -126,7 +130,7 @@ module ScoutApm
126
130
 
127
131
  def delete_files_for(timestamp)
128
132
  all_files_for(timestamp).each { |layaway|
129
- logger.debug("Deleting layaway file: #{layaway}")
133
+ logger.debug("Layaway: Deleting file: #{layaway}")
130
134
  File.unlink(layaway)
131
135
  }
132
136
  end
@@ -137,10 +141,10 @@ module ScoutApm
137
141
  compact.
138
142
  uniq.
139
143
  select { |timestamp| timestamp.to_i < older_than.strftime(TIME_FORMAT).to_i }.
140
- tap { |timestamps| logger.debug("Deleting stale layaway files with timestamps: #{timestamps.inspect}") }.
144
+ tap { |timestamps| logger.debug("Layaway: Deleting stale files with timestamps: #{timestamps.inspect}") }.
141
145
  map { |timestamp| delete_files_for(timestamp) }
142
146
  rescue => e
143
- logger.debug("Problem deleting stale files: #{e.message}, #{e.backtrace.inspect}")
147
+ logger.debug("Layaway: Problem deleting stale files: #{e.message}, #{e.backtrace.inspect}")
144
148
  end
145
149
 
146
150
  private
@@ -206,8 +210,7 @@ module ScoutApm
206
210
  map{ |timestamp, list| [timestamp, list.length] }
207
211
  ]
208
212
 
209
-
210
- logger.debug("Total in #{directory}: #{files_in_temp}. Total Layaway Files: #{all_filenames.size}. By Timestamp: #{count_per_timestamp.inspect}")
213
+ logger.debug("Layaway: Total Files in #{directory}: #{files_in_temp}. Total Layaway Files: #{all_filenames.size}. By Timestamp: #{count_per_timestamp.inspect}")
211
214
  end
212
215
  end
213
216
  end
@@ -6,6 +6,7 @@ module ScoutApm
6
6
 
7
7
  def initialize(context, path)
8
8
  @path = path
9
+ @context = context
9
10
  end
10
11
 
11
12
  def logger
@@ -17,7 +18,7 @@ module ScoutApm
17
18
  deserialize(data)
18
19
  rescue NameError, ArgumentError, TypeError => e
19
20
  # Marshal error
20
- logger.info("Unable to load data from Layaway file, resetting.")
21
+ logger.info("LayawayFile: Unable to load data")
21
22
  logger.debug("#{e.message}, #{e.backtrace.join("\n\t")}")
22
23
  nil
23
24
  end
@@ -24,6 +24,9 @@ module ScoutApm
24
24
  #
25
25
  # At any given point, there is data in each of those steps, moving its way through the process
26
26
  def process_metrics
27
+ # Do any per-minute work necessary for the store
28
+ context.store.tick!
29
+
27
30
  # Write the previous minute's data to the shared-across-process layaway file.
28
31
  context.store.write_to_layaway(context.layaway)
29
32
 
@@ -88,10 +88,15 @@ module ScoutApm
88
88
  logger.debug("Writing to layaway#{" (Forced)" if force}")
89
89
 
90
90
  @reporting_periods.select { |time, rp| force || (time.timestamp < current_timestamp.timestamp) }.
91
- each { |time, rp| collect_samplers(rp) }.
92
91
  each { |time, rp| write_reporting_period(layaway, time, rp) }
93
92
  end
94
93
 
94
+ # For each tick (minute), be sure we have a reporting period, and that samplers are run for it.
95
+ def tick!
96
+ rp = current_period
97
+ collect_samplers(rp)
98
+ end
99
+
95
100
  def write_reporting_period(layaway, time, rp)
96
101
  @mutex.synchronize {
97
102
  layaway.write_reporting_period(rp)
@@ -326,10 +326,6 @@ module ScoutApm
326
326
  def ensure_background_worker
327
327
  agent = ScoutApm::Agent.instance
328
328
  agent.start
329
-
330
- if agent.start_background_worker(:quiet)
331
- agent.logger.info("Force Started BG Worker")
332
- end
333
329
  rescue => e
334
330
  true
335
331
  end
@@ -1,3 +1,3 @@
1
1
  module ScoutApm
2
- VERSION = "3.0.0.pre18"
2
+ VERSION = "3.0.0.pre19"
3
3
  end
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.pre18
4
+ version: 3.0.0.pre19
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-23 00:00:00.000000000 Z
12
+ date: 2018-01-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
@@ -373,8 +373,46 @@ required_rubygems_version: !ruby/object:Gem::Requirement
373
373
  version: 1.3.1
374
374
  requirements: []
375
375
  rubyforge_project: scout_apm
376
- rubygems_version: 2.2.2
376
+ rubygems_version: 2.4.5.2
377
377
  signing_key:
378
378
  specification_version: 4
379
379
  summary: Ruby application performance monitoring
380
- test_files: []
380
+ test_files:
381
+ - test/data/config_test_1.yml
382
+ - test/test_helper.rb
383
+ - test/unit/agent_test.rb
384
+ - test/unit/background_job_integrations/sidekiq_test.rb
385
+ - test/unit/config_test.rb
386
+ - test/unit/context_test.rb
387
+ - test/unit/db_query_metric_set_test.rb
388
+ - test/unit/db_query_metric_stats_test.rb
389
+ - test/unit/environment_test.rb
390
+ - test/unit/fake_store_test.rb
391
+ - test/unit/git_revision_test.rb
392
+ - test/unit/histogram_test.rb
393
+ - test/unit/ignored_uris_test.rb
394
+ - test/unit/instruments/active_record_instruments_test.rb
395
+ - test/unit/instruments/net_http_test.rb
396
+ - test/unit/instruments/percentile_sampler_test.rb
397
+ - test/unit/layaway_test.rb
398
+ - test/unit/layer_children_set_test.rb
399
+ - test/unit/layer_converters/depth_first_walker_test.rb
400
+ - test/unit/layer_converters/metric_converter_test.rb
401
+ - test/unit/layer_converters/stubs.rb
402
+ - test/unit/limited_layer_test.rb
403
+ - test/unit/logger_test.rb
404
+ - test/unit/metric_set_test.rb
405
+ - test/unit/remote/test_message.rb
406
+ - test/unit/remote/test_router.rb
407
+ - test/unit/remote/test_server.rb
408
+ - test/unit/scored_item_set_test.rb
409
+ - test/unit/serializers/payload_serializer_test.rb
410
+ - test/unit/slow_job_policy_test.rb
411
+ - test/unit/slow_request_policy_test.rb
412
+ - test/unit/sql_sanitizer_test.rb
413
+ - test/unit/store_test.rb
414
+ - test/unit/test_tracked_request.rb
415
+ - test/unit/utils/active_record_metric_name_test.rb
416
+ - test/unit/utils/backtrace_parser_test.rb
417
+ - test/unit/utils/numbers_test.rb
418
+ - test/unit/utils/scm.rb