scout_apm 2.3.4 → 2.3.5

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: d3550603f596bb60e23a74f36dccd159a6b48caa
4
- data.tar.gz: 08d21a32a9882ddd33d5b622d185223a5dcb02dd
3
+ metadata.gz: 7f02661ce9cf968ffd2fc3efdd96f81a82b49f05
4
+ data.tar.gz: 2f47f1ddebab08773b82679dad0f81a29442c7f3
5
5
  SHA512:
6
- metadata.gz: 5d10e144e4332e959eb5296d6f5420cb3c85a96e0e3520612bf8a8d42e7268939f79c0922ead5b0540917fe04bcde4b982ec3e87e2f59aeb9f1f8cdf3d1faf82
7
- data.tar.gz: baaebcba71a090815eaa1780d3fbff465be893252c94ac88e2f765780f5dca6b9115bf6e5c92b3677d7fb8b0b681d0ce52c12dad9ba8c8f761a5805ccb093479
6
+ metadata.gz: 52a809924c15851078d2f8e3ec820021b6ec018f767d08240d1481975a18747e27442c2742bc72be51692d5c35cf9a0d47188be6d386832bbd8d4bdb473a34d4
7
+ data.tar.gz: 9d4359d4285532afef1e043412459360430e7ec95392f9fa4a705e3b428d8bddcab953425d1cf23335a8cdd9e9ec39d1e4ce79ef1406208b6d62246b975d43d4
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,10 @@
1
+ # 2.3.5
2
+
3
+ * More robust recovery from stale layaway files
4
+ * Quiet logging when hitting unusual layaway file limits
5
+ * Better naming for Sidekiq delayed method jobs
6
+ * Webrick is only required if actually needed
7
+
1
8
  # 2.3.4
2
9
 
3
10
  * Capture 300 characters of a url from net/http and httpclient instruments (up from 100).
@@ -92,10 +92,16 @@ module ScoutApm
92
92
  end
93
93
  elsif job_class == DELAYED_WRAPPER_KLASS
94
94
  begin
95
+ # Extract the info out of the wrapper
95
96
  yml = msg['args'].first
96
97
  deserialized_args = YAML.load(yml)
97
98
  klass, method, *rest = deserialized_args
98
- job_class = [klass,method].map(&:to_s).join(".")
99
+
100
+ # If this is an instance of a class, get the class itself
101
+ # Prevents instances from coming through named like "#<Foo:0x007ffd7a9dd8a0>"
102
+ klass = klass.class unless klass.is_a? Module
103
+
104
+ job_class = [klass, method].map(&:to_s).join(".")
99
105
  rescue
100
106
  DELAYED_WRAPPER_KLASS
101
107
  end
@@ -50,7 +50,8 @@ module ScoutApm
50
50
 
51
51
  def write_reporting_period(reporting_period, files_limit = MAX_FILES_LIMIT)
52
52
  if at_layaway_file_limit?(files_limit)
53
- ScoutApm::Agent.instance.logger.error("Hit layaway file limit. Not writing to layaway file")
53
+ # This will happen constantly once we hit this case, so only log the first time
54
+ @wrote_layaway_limit_error_message ||= ScoutApm::Agent.instance.logger.error("Hit layaway file limit. Not writing to layaway file")
54
55
  return false
55
56
  end
56
57
  filename = file_for(reporting_period.timestamp)
@@ -58,9 +59,22 @@ module ScoutApm
58
59
  layaway_file.write(reporting_period)
59
60
  end
60
61
 
61
- # Claims a given timestamp (getting a lock on a particular filename),
62
- # then yields ReportingPeriods collected up from all the files.
63
- # If the yield returns truthy, delete the layaway files that made it up.
62
+ # Claims a given timestamp by getting an exclusive lock on a timestamped
63
+ # coordinator file. The coordinator file never contains data, it's just a
64
+ # syncronization mechanism.
65
+ #
66
+ # Once the 'claim' is obtained:
67
+ # * load and yield each ReportingPeriod from the layaway files.
68
+ # * if there are reporting periods:
69
+ # * yields any ReportingPeriods collected up from all the files.
70
+ # * deletes all of the layaway files (including the coordinator) for the timestamp
71
+ # * if not
72
+ # * delete the coordinator
73
+ # * remove any stale layaway files that may be hanging around.
74
+ # * Finally unlock and ensure the coordinator file is cleared.
75
+ #
76
+ # If a claim file can't be obtained, return false without doing any work
77
+ # Another process is handling the reporting.
64
78
  def with_claim(timestamp)
65
79
  coordinator_file = glob_pattern(timestamp, :coordinator)
66
80
 
@@ -85,14 +99,14 @@ module ScoutApm
85
99
 
86
100
  ScoutApm::Agent.instance.logger.debug("Deleting the now-reported layaway files for #{timestamp.to_s}")
87
101
  delete_files_for(timestamp) # also removes the coodinator_file
88
-
89
- ScoutApm::Agent.instance.logger.debug("Checking for any Stale layaway files")
90
- delete_stale_files(timestamp.to_time - STALE_AGE)
91
102
  else
92
103
  File.unlink(coordinator_file)
93
104
  ScoutApm::Agent.instance.logger.debug("No layaway files to report")
94
105
  end
95
106
 
107
+ ScoutApm::Agent.instance.logger.debug("Checking for any Stale layaway files")
108
+ delete_stale_files(timestamp.to_time - STALE_AGE)
109
+
96
110
  true
97
111
  rescue Exception => e
98
112
  ScoutApm::Agent.instance.logger.debug("Caught an exception in with_claim, with the coordination file locked: #{e.message}, #{e.backtrace.inspect}")
@@ -17,6 +17,8 @@ module ScoutApm
17
17
  end
18
18
 
19
19
  def start
20
+ require 'webrick'
21
+
20
22
  @server = WEBrick::HTTPServer.new(
21
23
  :BindAddress => bind,
22
24
  :Port => port,
@@ -1,4 +1,4 @@
1
1
  module ScoutApm
2
- VERSION = "2.3.4"
2
+ VERSION = "2.3.5"
3
3
  end
4
4
 
data/lib/scout_apm.rb CHANGED
@@ -14,7 +14,6 @@ require 'socket'
14
14
  require 'thread'
15
15
  require 'time'
16
16
  require 'yaml'
17
- require 'webrick'
18
17
 
19
18
  #####################################
20
19
  # Gem Requires
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.4
4
+ version: 2.3.5
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-12-22 00:00:00.000000000 Z
12
+ date: 2018-01-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest