scout_apm 0.1.5 → 0.1.6

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: da3e8194a4123e62f0a2ecc81cdcd0e34a8c59f8
4
- data.tar.gz: 3f1b5006c5b01ff013237bd3d1049e94e2aea2d8
3
+ metadata.gz: e79b5f288da544777712971294bf8c37adf7bf64
4
+ data.tar.gz: 5ca3cb606fee63ad83d31b48458c815024d10a91
5
5
  SHA512:
6
- metadata.gz: 23a1b46036c8b7597f148b1a48b57c6015bb6ba6b95ec99fd4c83f0c76aad186989a12ee8a5a24ab56d02aa02f33a5a5dff7dfd382c87a1b5e771fa105f415d7
7
- data.tar.gz: 5f0e06ed2699252ff6eb07581e76cf5e2283b5f459521249b29546caa9c58271257766f6d320b8087c171983d5f8da09e91bc97d6101181a90ce0ab3ff66145f
6
+ metadata.gz: 388a1865dbcd8dd8be6a93d8a6229ac1560e8b235af4599f58a6c75f69815b186dff72ebbb5d3ad60cac25a59bb7e88827e7e820e703ef6ebd7ece760ac96e68
7
+ data.tar.gz: 57785a9a9027acbbb5c6c6c6b4a8b7659dd3df47ded3b29705d3b215fb27dcf0613a6880a8f98a6247c165e3b60b8b044e2b676a0a2f4d019c5d2489797901ef
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.1.6
2
+
3
+ * Fix issues with Ruby 1.8.7 regexes
4
+
1
5
  # 0.1.5
2
6
 
3
7
  * SQL sanitization now collapses IN (?,?,?) to a single (?)
@@ -165,6 +165,10 @@ module ScoutApm
165
165
  defined?(RUBY_ENGINE) && RUBY_ENGINE == "ruby" && RUBY_VERSION.match(/^1\.9/)
166
166
  end
167
167
 
168
+ def ruby_187?
169
+ defined?(RUBY_VERSION) && RUBY_VERSION.match(/^1\.8\.7/)
170
+ end
171
+
168
172
  ### framework checks
169
173
 
170
174
  def sinatra?
@@ -5,6 +5,13 @@ require 'scout_apm/environment'
5
5
  module ScoutApm
6
6
  module Utils
7
7
  class SqlSanitizer
8
+ if ScoutApm::Environment.new.ruby_187?
9
+ require 'scout_apm/utils/sql_sanitizer_regex_1_8_7'
10
+ else
11
+ require 'scout_apm/utils/sql_sanitizer_regex'
12
+ end
13
+ include ScoutApm::Utils::SqlRegex
14
+
8
15
  attr_reader :sql
9
16
  attr_accessor :database_engine
10
17
 
@@ -24,16 +31,6 @@ module ScoutApm
24
31
 
25
32
  private
26
33
 
27
- MULTIPLE_SPACES = %r|\s+|.freeze
28
- MULTIPLE_QUESTIONS = /\?(,\?)+/.freeze
29
- TRAILING_SPACES = /\s+$/.freeze
30
-
31
- PSQL_VAR_INTERPOLATION = %r|\[\[.*\]\]\s*$|.freeze
32
- PSQL_REMOVE_STRINGS = /'(?:[^']|'')*'/.freeze
33
- PSQL_REMOVE_INTEGERS = /(?<!LIMIT )\b\d+\b/.freeze
34
- PSQL_PLACEHOLDER = /\$\d+/.freeze
35
- PSQL_IN_CLAUSE = /IN\s+\((\s*\?,?\s*)*\)/.freeze
36
-
37
34
  def to_s_postgres
38
35
  sql.gsub!(PSQL_PLACEHOLDER, '?')
39
36
  sql.gsub!(PSQL_VAR_INTERPOLATION, '')
@@ -45,12 +42,6 @@ module ScoutApm
45
42
  sql
46
43
  end
47
44
 
48
- MYSQL_VAR_INTERPOLATION = %r|\[\[.*\]\]\s*$|.freeze
49
- MYSQL_REMOVE_INTEGERS = /(?<!LIMIT )\b\d+\b/.freeze
50
- MYSQL_REMOVE_SINGLE_QUOTE_STRINGS = /'(?:[^']|'')*'/.freeze
51
- MYSQL_REMOVE_DOUBLE_QUOTE_STRINGS = /"(?:[^"]|"")*"/.freeze
52
- MYSQL_IN_CLAUSE = /IN\s+\((\s*\?,?\s*)*\)/.freeze
53
-
54
45
  def to_s_mysql
55
46
  sql.gsub!(MYSQL_VAR_INTERPOLATION, '')
56
47
  sql.gsub!(MYSQL_REMOVE_SINGLE_QUOTE_STRINGS, '?')
@@ -62,10 +53,6 @@ module ScoutApm
62
53
  sql
63
54
  end
64
55
 
65
- SQLITE_VAR_INTERPOLATION = %r|\[\[.*\]\]\s*$|.freeze
66
- SQLITE_REMOVE_STRINGS = /'(?:[^']|'')*'/.freeze
67
- SQLITE_REMOVE_INTEGERS = /(?<!LIMIT )\b\d+\b/.freeze
68
-
69
56
  def to_s_sqlite
70
57
  sql.gsub!(SQLITE_VAR_INTERPOLATION, '')
71
58
  sql.gsub!(SQLITE_REMOVE_STRINGS, '?')
@@ -0,0 +1,28 @@
1
+
2
+ module ScoutApm
3
+ module Utils
4
+ module SqlRegex
5
+ MULTIPLE_SPACES = %r|\s+|.freeze
6
+ MULTIPLE_QUESTIONS = /\?(,\?)+/.freeze
7
+ TRAILING_SPACES = /\s+$/.freeze
8
+
9
+ PSQL_VAR_INTERPOLATION = %r|\[\[.*\]\]\s*$|.freeze
10
+ PSQL_REMOVE_STRINGS = /'(?:[^']|'')*'/.freeze
11
+
12
+ PSQL_REMOVE_INTEGERS = /(?<!LIMIT )\b\d+\b/.freeze
13
+
14
+ PSQL_PLACEHOLDER = /\$\d+/.freeze
15
+ PSQL_IN_CLAUSE = /IN\s+\((\s*\?,?\s*)*\)/.freeze
16
+
17
+ MYSQL_VAR_INTERPOLATION = %r|\[\[.*\]\]\s*$|.freeze
18
+ MYSQL_REMOVE_INTEGERS = /(?<!LIMIT )\b\d+\b/.freeze
19
+ MYSQL_REMOVE_SINGLE_QUOTE_STRINGS = /'(?:[^']|'')*'/.freeze
20
+ MYSQL_REMOVE_DOUBLE_QUOTE_STRINGS = /"(?:[^"]|"")*"/.freeze
21
+ MYSQL_IN_CLAUSE = /IN\s+\((\s*\?,?\s*)*\)/.freeze
22
+
23
+ SQLITE_VAR_INTERPOLATION = %r|\[\[.*\]\]\s*$|.freeze
24
+ SQLITE_REMOVE_STRINGS = /'(?:[^']|'')*'/.freeze
25
+ SQLITE_REMOVE_INTEGERS = /(?<!LIMIT )\b\d+\b/.freeze
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,27 @@
1
+
2
+ module ScoutApm
3
+ module Utils
4
+ module SqlRegex
5
+ MULTIPLE_SPACES = %r|\s+|.freeze
6
+ MULTIPLE_QUESTIONS = /\?(,\?)+/.freeze
7
+ TRAILING_SPACES = /\s+$/.freeze
8
+
9
+ PSQL_VAR_INTERPOLATION = %r|\[\[.*\]\]\s*$|.freeze
10
+ PSQL_REMOVE_STRINGS = /'(?:[^']|'')*'/.freeze
11
+ PSQL_REMOVE_INTEGERS = /\b\d+\b/.freeze
12
+ PSQL_PLACEHOLDER = /\$\d+/.freeze
13
+ PSQL_IN_CLAUSE = /IN\s+\((\s*\?,?\s*)*\)/.freeze
14
+
15
+ MYSQL_VAR_INTERPOLATION = %r|\[\[.*\]\]\s*$|.freeze
16
+ MYSQL_REMOVE_INTEGERS = /\b\d+\b/.freeze
17
+ MYSQL_REMOVE_SINGLE_QUOTE_STRINGS = /'(?:[^']|'')*'/.freeze
18
+ MYSQL_REMOVE_DOUBLE_QUOTE_STRINGS = /"(?:[^"]|"")*"/.freeze
19
+ MYSQL_IN_CLAUSE = /IN\s+\((\s*\?,?\s*)*\)/.freeze
20
+
21
+ SQLITE_VAR_INTERPOLATION = %r|\[\[.*\]\]\s*$|.freeze
22
+ SQLITE_REMOVE_STRINGS = /'(?:[^']|'')*'/.freeze
23
+ SQLITE_REMOVE_INTEGERS = /\b\d+\b/.freeze
24
+
25
+ end
26
+ end
27
+ end
@@ -1,3 +1,3 @@
1
1
  module ScoutApm
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
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: 0.1.5
4
+ version: 0.1.6
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: 2015-08-18 00:00:00.000000000 Z
12
+ date: 2015-08-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
@@ -93,6 +93,8 @@ files:
93
93
  - lib/scout_apm/tracer.rb
94
94
  - lib/scout_apm/utils/null_logger.rb
95
95
  - lib/scout_apm/utils/sql_sanitizer.rb
96
+ - lib/scout_apm/utils/sql_sanitizer_regex.rb
97
+ - lib/scout_apm/utils/sql_sanitizer_regex_1_8_7.rb
96
98
  - lib/scout_apm/version.rb
97
99
  - scout_apm.gemspec
98
100
  - test/data/config_test_1.yml