scout_apm 3.0.0.pre14 → 3.0.0.pre15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.markdown +20 -0
- data/lib/scout_apm/config.rb +3 -0
- data/lib/scout_apm/instruments/active_record.rb +40 -3
- data/lib/scout_apm/instruments/http_client.rb +4 -1
- data/lib/scout_apm/instruments/net_http.rb +3 -1
- data/lib/scout_apm/layer_converters/converter_base.rb +1 -1
- data/lib/scout_apm/utils/sql_sanitizer.rb +3 -1
- data/lib/scout_apm/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8acb94ef4095b224ee2d08a3d5a25410b104447b
|
4
|
+
data.tar.gz: 7d6493404c2dcd0346d6465d240cb428eb1f23ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3f6cd0b3fb6413bc36a18b69a7e24ed6cb65d7f32f0b0d9ce5bef7b71b41640e80a34c8255540b9d8171312bca630bf35d79568ad7976bb6d0e83f7fe8f4253
|
7
|
+
data.tar.gz: 885869be52cb6836df31063bcb2818433511e6001115490e926256de2c70d924452a1feed70ad4a8501155388520ae8efff12a77584f653e6499ae269c2212e5
|
data/CHANGELOG.markdown
CHANGED
@@ -2,6 +2,26 @@
|
|
2
2
|
|
3
3
|
* ScoutProf BETA
|
4
4
|
|
5
|
+
# 2.4.0
|
6
|
+
|
7
|
+
* Rework agent startup sequence
|
8
|
+
|
9
|
+
# 2.3.4
|
10
|
+
|
11
|
+
* Capture 300 characters of a url from net/http and httpclient instruments (up from 100).
|
12
|
+
|
13
|
+
# 2.3.3
|
14
|
+
|
15
|
+
* Capture ActiveRecord calls that generate more complex queries
|
16
|
+
* More aggressively determine names of complex queries (to determine "User/find", "Account/create" and similar)
|
17
|
+
* Increases the maximum size of SQL queries that are sanitized to 16KB from 4 KB
|
18
|
+
* Captures all SQL individual queries generated in a given AR call (previous only a single query was captured)
|
19
|
+
|
20
|
+
# 2.3.2
|
21
|
+
|
22
|
+
* More robust startup sequence when using `rails server` vs. directly launching an app server
|
23
|
+
* Avoid incompatibility with 3rd party gems that aggressively obtain database connections
|
24
|
+
|
5
25
|
# 2.3.1
|
6
26
|
|
7
27
|
* Fix DevTrace bug
|
data/lib/scout_apm/config.rb
CHANGED
@@ -66,6 +66,7 @@ module ScoutApm
|
|
66
66
|
'report_format',
|
67
67
|
'scm_subdirectory',
|
68
68
|
'uri_reporting',
|
69
|
+
'instrument_http_url_length',
|
69
70
|
]
|
70
71
|
|
71
72
|
################################################################################
|
@@ -153,6 +154,7 @@ module ScoutApm
|
|
153
154
|
"monitor" => BooleanCoercion.new,
|
154
155
|
'database_metric_limit' => IntegerCoercion.new,
|
155
156
|
'database_metric_report_limit' => IntegerCoercion.new,
|
157
|
+
'instrument_http_url_length' => IntegerCoercion.new,
|
156
158
|
}
|
157
159
|
|
158
160
|
|
@@ -256,6 +258,7 @@ module ScoutApm
|
|
256
258
|
'remote_agent_port' => 7721, # picked at random
|
257
259
|
'database_metric_limit' => 5000, # The hard limit on db metrics
|
258
260
|
'database_metric_report_limit' => 1000,
|
261
|
+
'instrument_http_url_length' => 300,
|
259
262
|
}.freeze
|
260
263
|
|
261
264
|
def value(key)
|
@@ -1,6 +1,38 @@
|
|
1
1
|
require 'scout_apm/utils/sql_sanitizer'
|
2
2
|
|
3
3
|
module ScoutApm
|
4
|
+
class SqlList
|
5
|
+
attr_reader :sqls
|
6
|
+
|
7
|
+
def initialize(sql=nil)
|
8
|
+
@sqls = []
|
9
|
+
|
10
|
+
if !sql.nil?
|
11
|
+
push(sql)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def <<(sql)
|
16
|
+
push(sql)
|
17
|
+
end
|
18
|
+
|
19
|
+
def push(sql)
|
20
|
+
if !(Utils::SqlSanitizer === sql)
|
21
|
+
sql = Utils::SqlSanitizer.new(sql)
|
22
|
+
end
|
23
|
+
@sqls << sql
|
24
|
+
end
|
25
|
+
|
26
|
+
# All of this one, then all of the other.
|
27
|
+
def merge(other)
|
28
|
+
@sqls += other.sqls
|
29
|
+
end
|
30
|
+
|
31
|
+
def to_s
|
32
|
+
@sqls.map{|s| s.to_s }.join(";\n")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
4
36
|
module Instruments
|
5
37
|
class ActiveRecord
|
6
38
|
attr_reader :context
|
@@ -129,13 +161,12 @@ module ScoutApm
|
|
129
161
|
# Extract data from the arguments
|
130
162
|
sql, name = args
|
131
163
|
metric_name = Utils::ActiveRecordMetricName.new(sql, name)
|
132
|
-
desc =
|
164
|
+
desc = SqlList.new(sql)
|
133
165
|
|
134
166
|
# Get current ScoutApm context
|
135
167
|
req = ScoutApm::RequestManager.lookup
|
136
168
|
current_layer = req.current_layer
|
137
169
|
|
138
|
-
|
139
170
|
# If we call #log, we have a real query to run, and we've already
|
140
171
|
# gotten through the cache gatekeeper. Since we want to only trace real
|
141
172
|
# queries, and not repeated identical queries that just hit cache, we
|
@@ -150,9 +181,13 @@ module ScoutApm
|
|
150
181
|
# TODO: Get rid of call .to_s, need to find this without forcing a previous run of the name logic
|
151
182
|
if current_layer.name.to_s == Utils::ActiveRecordMetricName::DEFAULT_METRIC
|
152
183
|
current_layer.name = metric_name
|
153
|
-
current_layer.desc = desc
|
154
184
|
end
|
155
185
|
|
186
|
+
if current_layer.desc.nil?
|
187
|
+
current_layer.desc = SqlList.new
|
188
|
+
end
|
189
|
+
current_layer.desc.merge(desc)
|
190
|
+
|
156
191
|
log_without_scout_instruments(*args, &block)
|
157
192
|
|
158
193
|
# OR: Start a new layer, we didn't pick up instrumentation earlier in the stack.
|
@@ -229,6 +264,7 @@ module ScoutApm
|
|
229
264
|
req = ScoutApm::RequestManager.lookup
|
230
265
|
layer = ScoutApm::Layer.new("ActiveRecord", Utils::ActiveRecordMetricName::DEFAULT_METRIC)
|
231
266
|
layer.annotate_layer(:ignorable => true)
|
267
|
+
layer.desc = SqlList.new
|
232
268
|
req.start_layer(layer)
|
233
269
|
req.ignore_children!
|
234
270
|
begin
|
@@ -247,6 +283,7 @@ module ScoutApm
|
|
247
283
|
|
248
284
|
req = ScoutApm::RequestManager.lookup
|
249
285
|
layer = ScoutApm::Layer.new("ActiveRecord", Utils::ActiveRecordMetricName.new("", "#{model} #{operation}"))
|
286
|
+
layer.desc = SqlList.new
|
250
287
|
req.start_layer(layer)
|
251
288
|
req.ignore_children!
|
252
289
|
begin
|
@@ -26,9 +26,12 @@ module ScoutApm
|
|
26
26
|
include ScoutApm::Tracer
|
27
27
|
|
28
28
|
def request_with_scout_instruments(*args, &block)
|
29
|
+
|
29
30
|
method = args[0].to_s
|
30
31
|
url = args[1]
|
31
|
-
|
32
|
+
|
33
|
+
max_length = ScoutApm::Agent.instance.context.config.value('instrument_http_url_length')
|
34
|
+
url = url && url.to_s[0..(max_length - 1)]
|
32
35
|
|
33
36
|
self.class.instrument("HTTP", method, :desc => url) do
|
34
37
|
request_without_scout_instruments(*args, &block)
|
@@ -34,7 +34,9 @@ module ScoutApm
|
|
34
34
|
def request_scout_description(req)
|
35
35
|
path = req.path
|
36
36
|
path = path.path if path.respond_to?(:path)
|
37
|
-
|
37
|
+
|
38
|
+
max_length = ScoutApm::Agent.instance.context.config.value('instrument_http_url_length')
|
39
|
+
(@address + path.split('?').first)[0..(max_length - 1)]
|
38
40
|
end
|
39
41
|
|
40
42
|
alias request_without_scout_instruments request
|
@@ -145,7 +145,7 @@ module ScoutApm
|
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
148
|
-
def make_meta_options_desc_hash(layer, max_desc_length=
|
148
|
+
def make_meta_options_desc_hash(layer, max_desc_length=32768)
|
149
149
|
if layer.desc
|
150
150
|
desc_s = layer.desc.to_s
|
151
151
|
trimmed_desc = desc_s[0 .. max_desc_length]
|
@@ -74,8 +74,10 @@ module ScoutApm
|
|
74
74
|
encodings.all?{|enc| Encoding.find(enc) rescue false}
|
75
75
|
end
|
76
76
|
|
77
|
+
MAX_SQL_LENGTH = 16384
|
78
|
+
|
77
79
|
def scrubbed(str)
|
78
|
-
return '' if !str.is_a?(String) || str.length >
|
80
|
+
return '' if !str.is_a?(String) || str.length > MAX_SQL_LENGTH # safeguard - don't sanitize or scrub large SQL statements
|
79
81
|
return str if !str.respond_to?(:encode) # Ruby <= 1.8 doesn't have string encoding
|
80
82
|
return str if str.valid_encoding? # Whatever encoding it is, it is valid and we can operate on it
|
81
83
|
ScoutApm::Agent.instance.context.logger.debug "Scrubbing invalid sql encoding."
|
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: 3.0.0.
|
4
|
+
version: 3.0.0.pre15
|
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:
|
12
|
+
date: 2018-01-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
@@ -372,7 +372,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
372
372
|
version: 1.3.1
|
373
373
|
requirements: []
|
374
374
|
rubyforge_project: scout_apm
|
375
|
-
rubygems_version: 2.
|
375
|
+
rubygems_version: 2.5.2.1
|
376
376
|
signing_key:
|
377
377
|
specification_version: 4
|
378
378
|
summary: Ruby application performance monitoring
|