opentelemetry-instrumentation-mysql2 0.23.0 → 0.24.1

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
  SHA256:
3
- metadata.gz: 9ea7871c2d5272a19f91159b2b9f72e07e265fed7dd673c03b3ef2c7506aed62
4
- data.tar.gz: 49579a5b7030b8fd8e19900158ad8438ed91a2f9188e8d1e4ee2799503f72f4a
3
+ metadata.gz: 1f086bc035af9f951109cd4e61e5f4f403c7f066d6c4d5f853465060c6cae2e8
4
+ data.tar.gz: 81bc9f183786bf26cdbdaa44c4d176258b6446e242800ac8543c1d6ff11784c0
5
5
  SHA512:
6
- metadata.gz: d762f5106fd527d7f4dfc43830bb6ad7fc46cb7944e8b2468888fe77078c39a3764836149124760c04a8738c9840ec028f34f54899ab5a33dba99b66cadb02d5
7
- data.tar.gz: 3e55e547de48c4b2132d4a95023627a8d1a96b0a5f7ee38c3bc565548b541c8da8f2f64817cc636b7de830642a931899b47860939e290d3cbcda7e26b244bc06
6
+ metadata.gz: 8013b7edd0e679422859c67e13d29c395d5e767e7d780f83b72cd5e302be7430a785c93edbe4ddb417abae4dffe86adcb566b2d39231cf94e4f26c3e55c625c1
7
+ data.tar.gz: 9312c12a1e1f465a83d2b2617309f91fcfd32d6271ad010b85e934517109e71204ce7796198e68f9e9cada715e7ef8d8a004080a211f4feb1d88db42b3db0fa2
data/CHANGELOG.md CHANGED
@@ -1,29 +1,37 @@
1
1
  # Release History: opentelemetry-instrumentation-mysql2
2
2
 
3
+ ### v0.24.1 / 2023-06-01
4
+
5
+ * FIXED: Regex non-match with obfuscation limit (issue #486)
6
+
7
+ ### v0.24.0 / 2023-05-25
8
+
9
+ * ADDED: Add config[:obfuscation_limit] to pg and mysql2
10
+
3
11
  ### v0.23.0 / 2023-04-17
4
12
 
5
- * BREAKING CHANGE: Drop support for EoL Ruby 2.7
13
+ * BREAKING CHANGE: Drop support for EoL Ruby 2.7
6
14
 
7
- * ADDED: Drop support for EoL Ruby 2.7
8
- * FIXED: Ensure encoding errors handled during SQL obfuscation for Trilogy
15
+ * ADDED: Drop support for EoL Ruby 2.7
16
+ * FIXED: Ensure encoding errors handled during SQL obfuscation for Trilogy
9
17
 
10
18
  ### v0.22.0 / 2023-01-14
11
19
 
12
- * BREAKING CHANGE: Removed deprecated instrumentation options
20
+ * BREAKING CHANGE: Removed deprecated instrumentation options
13
21
 
14
- * ADDED: Add option to configure span name
15
- * ADDED: Removed deprecated instrumentation options
16
- * DOCS: Fix gem homepage
17
- * DOCS: More gem documentation fixes
22
+ * ADDED: Add option to configure span name
23
+ * ADDED: Removed deprecated instrumentation options
24
+ * DOCS: Fix gem homepage
25
+ * DOCS: More gem documentation fixes
18
26
 
19
27
  ### v0.21.1 / 2022-10-26
20
28
 
21
- * FIXED: Handle encoding errors in mysql obfuscation
29
+ * FIXED: Handle encoding errors in mysql obfuscation
22
30
 
23
31
  ### v0.21.0 / 2022-06-09
24
32
 
25
33
  * Upgrading Base dependency version
26
- * FIXED: Broken test file requirements
34
+ * FIXED: Broken test file requirements
27
35
 
28
36
  ### v0.20.1 / 2022-05-03
29
37
 
@@ -31,7 +39,7 @@
31
39
 
32
40
  ### v0.20.0 / 2021-12-01
33
41
 
34
- * ADDED: Add default options config helper + env var config option support
42
+ * ADDED: Add default options config helper + env var config option support
35
43
 
36
44
  ### v0.19.1 / 2021-09-29
37
45
 
@@ -39,11 +47,11 @@
39
47
 
40
48
  ### v0.19.0 / 2021-08-12
41
49
 
42
- * BREAKING CHANGE: Add option for db.statement
50
+ * BREAKING CHANGE: Add option for db.statement
43
51
 
44
- * ADDED: Add option for db.statement
45
- * DOCS: Update docs to rely more on environment variable configuration
46
- * DOCS: Move to using new db_statement
52
+ * ADDED: Add option for db.statement
53
+ * DOCS: Update docs to rely more on environment variable configuration
54
+ * DOCS: Move to using new db_statement
47
55
 
48
56
  ### v0.18.1 / 2021-06-23
49
57
 
@@ -22,6 +22,7 @@ module OpenTelemetry
22
22
  option :peer_service, default: nil, validate: :string
23
23
  option :db_statement, default: :include, validate: %I[omit include obfuscate]
24
24
  option :span_name, default: :statement_type, validate: %I[statement_type db_name db_operation_and_name]
25
+ option :obfuscation_limit, default: 2000, validate: :integer
25
26
 
26
27
  private
27
28
 
@@ -30,6 +30,7 @@ module OpenTelemetry
30
30
 
31
31
  QUERY_NAME_RE = Regexp.new("^(#{QUERY_NAMES.join('|')})", Regexp::IGNORECASE)
32
32
 
33
+ # From: https://github.com/newrelic/newrelic-ruby-agent/blob/0235b288d85b8bc795bdc1a24621dd9f84cfef45/lib/new_relic/agent/database/obfuscation_helpers.rb#L9-L34
33
34
  COMPONENTS_REGEX_MAP = {
34
35
  single_quotes: /'(?:[^']|'')*?(?:\\'.*|'(?!'))/,
35
36
  double_quotes: /"(?:[^"]|"")*?(?:\\".*|"(?!"))/,
@@ -70,8 +71,13 @@ module OpenTelemetry
70
71
  private
71
72
 
72
73
  def obfuscate_sql(sql)
73
- if sql.size > 2000
74
- 'SQL query too large to remove sensitive data ...'
74
+ if sql.size > config[:obfuscation_limit]
75
+ first_match_index = sql.index(generated_mysql_regex)
76
+ truncation_message = "SQL truncated (> #{config[:obfuscation_limit]} characters)"
77
+ return truncation_message unless first_match_index
78
+
79
+ truncated_sql = sql[..first_match_index - 1]
80
+ "#{truncated_sql}...\n#{truncation_message}"
75
81
  else
76
82
  obfuscated = OpenTelemetry::Common::Utilities.utf8_encode(sql, binary: true)
77
83
  obfuscated = obfuscated.gsub(generated_mysql_regex, '?')
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module Mysql2
10
- VERSION = '0.23.0'
10
+ VERSION = '0.24.1'
11
11
  end
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-instrumentation-mysql2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.0
4
+ version: 0.24.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-17 00:00:00.000000000 Z
11
+ date: 2023-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 1.48.1
159
+ version: 1.50.2
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 1.48.1
166
+ version: 1.50.2
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: simplecov
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -227,10 +227,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
227
227
  licenses:
228
228
  - Apache-2.0
229
229
  metadata:
230
- changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-mysql2/0.23.0/file/CHANGELOG.md
230
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-mysql2/0.24.1/file/CHANGELOG.md
231
231
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/mysql2
232
232
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
233
- documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-mysql2/0.23.0
233
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-mysql2/0.24.1
234
234
  post_install_message:
235
235
  rdoc_options: []
236
236
  require_paths: