scout_apm 2.4.4 → 2.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.markdown +5 -0
- data/lib/scout_apm.rb +1 -1
- data/lib/scout_apm/agent.rb +14 -6
- data/lib/scout_apm/fake_store.rb +3 -0
- data/lib/scout_apm/layaway.rb +13 -10
- data/lib/scout_apm/layaway_file.rb +2 -1
- data/lib/scout_apm/reporting.rb +3 -0
- data/lib/scout_apm/store.rb +6 -1
- data/lib/scout_apm/tracked_request.rb +0 -4
- data/lib/scout_apm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7cca5bcac3a1e0003177c2278f946cc8f91162e
|
4
|
+
data.tar.gz: 1019c41baada305983347b46a89d201959fd6a0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e82600c59d5214af9f3e4eea0c41c9c5a2d3fffda05d6fa33f38cf65e410728bd82a789f39150a76b4569f9631a85af65cc8e6b84ceb1630b4f7eb96393cb14
|
7
|
+
data.tar.gz: 5a50add27950b1ee9080a6f803feed0ee8cfe05ac730dc19fc47980e5ec15729663f41c7b3889feca87380602f7a284005d6f4f821ebb9dd8f25a5c42dea947f
|
data/CHANGELOG.markdown
CHANGED
data/lib/scout_apm.rb
CHANGED
data/lib/scout_apm/agent.rb
CHANGED
@@ -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
|
-
|
38
|
+
logger.info "Scout Agent [#{ScoutApm::VERSION}] Initialized"
|
39
39
|
|
40
|
-
|
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}]
|
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
|
-
|
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
|
#################################
|
data/lib/scout_apm/fake_store.rb
CHANGED
data/lib/scout_apm/layaway.rb
CHANGED
@@ -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
|
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
|
109
|
+
logger.debug("Layaway: No files to report")
|
106
110
|
end
|
107
111
|
|
108
|
-
logger.debug("Checking for any
|
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
|
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
|
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
|
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
|
data/lib/scout_apm/reporting.rb
CHANGED
@@ -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
|
|
data/lib/scout_apm/store.rb
CHANGED
@@ -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)
|
data/lib/scout_apm/version.rb
CHANGED
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.4.
|
4
|
+
version: 2.4.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: 2018-01-
|
12
|
+
date: 2018-01-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|