scout_apm 2.6.8 → 2.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.markdown +6 -0
- data/lib/scout_apm/config.rb +3 -1
- data/lib/scout_apm/instruments/action_controller_rails_3_rails4.rb +15 -11
- data/lib/scout_apm/reporter.rb +1 -2
- data/lib/scout_apm/utils/sql_sanitizer.rb +1 -0
- data/lib/scout_apm/utils/sql_sanitizer_regex.rb +1 -1
- data/lib/scout_apm/utils/sql_sanitizer_regex_1_8_7.rb +1 -0
- data/lib/scout_apm/version.rb +1 -1
- data/test/unit/sql_sanitizer_test.rb +7 -0
- metadata +57 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54f1c7e07f92a0d5d67a22354b0273c4894e8408ec00bcdada275457ed2f00f2
|
4
|
+
data.tar.gz: 50cf2d441c948e769b2f2222895c84aadb0a5e3e3f75d16e647a2096a86551e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27a012457a6871cdbed206f2a55914163571e81af1b1f6253079c2fe9954354a9888b59627d832f3635a536ddf3f331c066b2bc4e053956f5135c706ffea1a17
|
7
|
+
data.tar.gz: cfc5d80fb3b0ccebc2e78246a394a23a8e16d52a89868cff024931d6ce5b3539aafc42ef6f491105db43f8c544750b270cbbc7cc1fed556ab543bb0d963f1c75
|
data/CHANGELOG.markdown
CHANGED
data/lib/scout_apm/config.rb
CHANGED
@@ -75,6 +75,7 @@ module ScoutApm
|
|
75
75
|
'revision_sha',
|
76
76
|
'scm_subdirectory',
|
77
77
|
'start_resque_server_instrument',
|
78
|
+
'ssl_cert_file',
|
78
79
|
'uri_reporting',
|
79
80
|
'instrument_http_url_length',
|
80
81
|
'timeline_traces',
|
@@ -284,7 +285,8 @@ module ScoutApm
|
|
284
285
|
'collect_remote_ip' => true,
|
285
286
|
'timeline_traces' => true,
|
286
287
|
'auto_instruments' => false,
|
287
|
-
'auto_instruments_ignore' => []
|
288
|
+
'auto_instruments_ignore' => [],
|
289
|
+
'ssl_cert_file' => File.join( File.dirname(__FILE__), *%w[.. .. data cacert.pem] )
|
288
290
|
}.freeze
|
289
291
|
|
290
292
|
def value(key)
|
@@ -74,6 +74,16 @@ module ScoutApm
|
|
74
74
|
# before_action callbacks
|
75
75
|
def self.build_instrument_module
|
76
76
|
Module.new do
|
77
|
+
# Determine the URI of this request to capture. Overridable by users in their controller.
|
78
|
+
def scout_transaction_uri(config=ScoutApm::Agent.instance.context.config)
|
79
|
+
case config.value("uri_reporting")
|
80
|
+
when 'path'
|
81
|
+
request.path # strips off the query string for more security
|
82
|
+
else # default handles filtered params
|
83
|
+
request.filtered_path
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
77
87
|
def process_action(*args)
|
78
88
|
req = ScoutApm::RequestManager.lookup
|
79
89
|
current_layer = req.current_layer
|
@@ -89,7 +99,11 @@ module ScoutApm
|
|
89
99
|
# Don't start a new layer if ActionController::API or ActionController::Base handled it already.
|
90
100
|
super
|
91
101
|
else
|
92
|
-
|
102
|
+
begin
|
103
|
+
uri = scout_transaction_uri
|
104
|
+
req.annotate_request(:uri => uri)
|
105
|
+
rescue
|
106
|
+
end
|
93
107
|
|
94
108
|
# IP Spoofing Protection can throw an exception, just move on w/o remote ip
|
95
109
|
if agent_context.config.value('collect_remote_ip')
|
@@ -112,16 +126,6 @@ module ScoutApm
|
|
112
126
|
end
|
113
127
|
end
|
114
128
|
|
115
|
-
# Given an +ActionDispatch::Request+, formats the uri based on config settings.
|
116
|
-
# XXX: Don't lookup context like this - find a way to pass it through
|
117
|
-
def self.scout_transaction_uri(request, config=ScoutApm::Agent.instance.context.config)
|
118
|
-
case config.value("uri_reporting")
|
119
|
-
when 'path'
|
120
|
-
request.path # strips off the query string for more security
|
121
|
-
else # default handles filtered params
|
122
|
-
request.filtered_path
|
123
|
-
end
|
124
|
-
end
|
125
129
|
end
|
126
130
|
|
127
131
|
module ActionControllerMetalInstruments
|
data/lib/scout_apm/reporter.rb
CHANGED
@@ -2,7 +2,6 @@ require 'openssl'
|
|
2
2
|
|
3
3
|
module ScoutApm
|
4
4
|
class Reporter
|
5
|
-
CA_FILE = File.join( File.dirname(__FILE__), *%w[.. .. data cacert.pem] )
|
6
5
|
VERIFY_MODE = OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
|
7
6
|
|
8
7
|
attr_reader :type
|
@@ -123,7 +122,7 @@ module ScoutApm
|
|
123
122
|
proxy_uri.password).new(url.host, url.port)
|
124
123
|
if url.is_a?(URI::HTTPS)
|
125
124
|
http.use_ssl = true
|
126
|
-
http.ca_file =
|
125
|
+
http.ca_file = config.value("ssl_cert_file")
|
127
126
|
http.verify_mode = VERIFY_MODE
|
128
127
|
end
|
129
128
|
http
|
@@ -51,6 +51,7 @@ module ScoutApm
|
|
51
51
|
sql.gsub!(PSQL_PLACEHOLDER, '?')
|
52
52
|
sql.gsub!(PSQL_VAR_INTERPOLATION, '')
|
53
53
|
sql.gsub!(PSQL_AFTER_WHERE) {|c| c.gsub(PSQL_REMOVE_STRINGS, '?')}
|
54
|
+
sql.gsub!(PSQL_AFTER_SET) {|c| c.gsub(PSQL_REMOVE_STRINGS, '?')}
|
54
55
|
sql.gsub!(PSQL_REMOVE_INTEGERS, '?')
|
55
56
|
sql.gsub!(PSQL_IN_CLAUSE, 'IN (?)')
|
56
57
|
sql.gsub!(MULTIPLE_SPACES, ' ')
|
@@ -5,13 +5,13 @@ module ScoutApm
|
|
5
5
|
MULTIPLE_SPACES = %r|\s+|.freeze
|
6
6
|
MULTIPLE_QUESTIONS = /\?(,\?)+/.freeze
|
7
7
|
|
8
|
-
|
9
8
|
PSQL_VAR_INTERPOLATION = %r|\[\[.*\]\]\s*$|.freeze
|
10
9
|
PSQL_REMOVE_STRINGS = /'(?:[^']|'')*'/.freeze
|
11
10
|
PSQL_REMOVE_INTEGERS = /(?<!LIMIT )\b\d+\b/.freeze
|
12
11
|
PSQL_PLACEHOLDER = /\$\d+/.freeze
|
13
12
|
PSQL_IN_CLAUSE = /IN\s+\(\?[^\)]*\)/.freeze
|
14
13
|
PSQL_AFTER_WHERE = /(?:WHERE\s+).*?(?:SELECT|$)/i.freeze
|
14
|
+
PSQL_AFTER_SET = /(?:SET\s+).*?(?:WHERE|$)/i.freeze
|
15
15
|
|
16
16
|
MYSQL_VAR_INTERPOLATION = %r|\[\[.*\]\]\s*$|.freeze
|
17
17
|
MYSQL_REMOVE_INTEGERS = /(?<!LIMIT )\b\d+\b/.freeze
|
@@ -11,6 +11,7 @@ module ScoutApm
|
|
11
11
|
PSQL_PLACEHOLDER = /\$\d+/.freeze
|
12
12
|
PSQL_IN_CLAUSE = /IN\s+\(\?[^\)]*\)/.freeze
|
13
13
|
PSQL_AFTER_WHERE = /(?:WHERE\s+).*?(?:SELECT|$)/i.freeze
|
14
|
+
PSQL_AFTER_SET = /(?:SET\s+).*?(?:WHERE|$)/i.freeze
|
14
15
|
|
15
16
|
MYSQL_VAR_INTERPOLATION = %r|\[\[.*\]\]\s*$|.freeze
|
16
17
|
MYSQL_REMOVE_INTEGERS = /\b\d+\b/.freeze
|
data/lib/scout_apm/version.rb
CHANGED
@@ -139,6 +139,13 @@ module ScoutApm
|
|
139
139
|
assert_equal %q|SELECT `blogs`.* FROM `blogs` WHERE (title = ?)|, ss.to_s
|
140
140
|
end
|
141
141
|
|
142
|
+
def test_set_columns
|
143
|
+
sql = %q|UPDATE "mytable" SET "myfield" = 'fieldcontent', "countofthings" = 10 WHERE "user_id" = 10|
|
144
|
+
|
145
|
+
ss = SqlSanitizer.new(sql).tap{ |it| it.database_engine = :postgres }
|
146
|
+
assert_equal %q|UPDATE "mytable" SET "myfield" = ?, "countofthings" = ? WHERE "user_id" = ?|, ss.to_s
|
147
|
+
end
|
148
|
+
|
142
149
|
def assert_faster_than(target_seconds)
|
143
150
|
t1 = ::Time.now
|
144
151
|
yield
|
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.6.
|
4
|
+
version: 2.6.9
|
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: 2020-
|
12
|
+
date: 2020-08-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
@@ -460,8 +460,61 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
460
460
|
- !ruby/object:Gem::Version
|
461
461
|
version: '0'
|
462
462
|
requirements: []
|
463
|
-
rubygems_version: 3.0.
|
463
|
+
rubygems_version: 3.0.6
|
464
464
|
signing_key:
|
465
465
|
specification_version: 4
|
466
466
|
summary: Ruby application performance monitoring
|
467
|
-
test_files:
|
467
|
+
test_files:
|
468
|
+
- test/data/config_test_1.yml
|
469
|
+
- test/test_helper.rb
|
470
|
+
- test/tmp/README.md
|
471
|
+
- test/unit/agent_test.rb
|
472
|
+
- test/unit/auto_instrument/assignments-instrumented.rb
|
473
|
+
- test/unit/auto_instrument/assignments.rb
|
474
|
+
- test/unit/auto_instrument/controller-ast.txt
|
475
|
+
- test/unit/auto_instrument/controller-instrumented.rb
|
476
|
+
- test/unit/auto_instrument/controller.rb
|
477
|
+
- test/unit/auto_instrument/rescue_from-instrumented.rb
|
478
|
+
- test/unit/auto_instrument/rescue_from.rb
|
479
|
+
- test/unit/auto_instrument_test.rb
|
480
|
+
- test/unit/background_job_integrations/sidekiq_test.rb
|
481
|
+
- test/unit/config_test.rb
|
482
|
+
- test/unit/context_test.rb
|
483
|
+
- test/unit/db_query_metric_set_test.rb
|
484
|
+
- test/unit/db_query_metric_stats_test.rb
|
485
|
+
- test/unit/environment_test.rb
|
486
|
+
- test/unit/extensions/periodic_callbacks_test.rb
|
487
|
+
- test/unit/extensions/transaction_callbacks_test.rb
|
488
|
+
- test/unit/fake_store_test.rb
|
489
|
+
- test/unit/git_revision_test.rb
|
490
|
+
- test/unit/histogram_test.rb
|
491
|
+
- test/unit/ignored_uris_test.rb
|
492
|
+
- test/unit/instruments/active_record_test.rb
|
493
|
+
- test/unit/instruments/net_http_test.rb
|
494
|
+
- test/unit/instruments/percentile_sampler_test.rb
|
495
|
+
- test/unit/layaway_test.rb
|
496
|
+
- test/unit/layer_children_set_test.rb
|
497
|
+
- test/unit/layer_converters/depth_first_walker_test.rb
|
498
|
+
- test/unit/layer_converters/metric_converter_test.rb
|
499
|
+
- test/unit/layer_converters/stubs.rb
|
500
|
+
- test/unit/limited_layer_test.rb
|
501
|
+
- test/unit/logger_test.rb
|
502
|
+
- test/unit/metric_set_test.rb
|
503
|
+
- test/unit/remote/test_message.rb
|
504
|
+
- test/unit/remote/test_router.rb
|
505
|
+
- test/unit/remote/test_server.rb
|
506
|
+
- test/unit/request_histograms_test.rb
|
507
|
+
- test/unit/scored_item_set_test.rb
|
508
|
+
- test/unit/serializers/payload_serializer_test.rb
|
509
|
+
- test/unit/slow_job_policy_test.rb
|
510
|
+
- test/unit/slow_request_policy_test.rb
|
511
|
+
- test/unit/sql_sanitizer_test.rb
|
512
|
+
- test/unit/store_test.rb
|
513
|
+
- test/unit/tracer_test.rb
|
514
|
+
- test/unit/tracked_request_test.rb
|
515
|
+
- test/unit/transaction_test.rb
|
516
|
+
- test/unit/transaction_time_consumed_test.rb
|
517
|
+
- test/unit/utils/active_record_metric_name_test.rb
|
518
|
+
- test/unit/utils/backtrace_parser_test.rb
|
519
|
+
- test/unit/utils/numbers_test.rb
|
520
|
+
- test/unit/utils/scm.rb
|