opentelemetry-instrumentation-mysql2 0.21.1 → 0.22.0

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: 72d506d7b5ea829dc35ee0f90a02a0ed2231b895204016a806e45a9561f4bce1
4
- data.tar.gz: 41d0788f8de74f287a736cf4e70fa106d6963391bb5561a82bd48bb2432e1041
3
+ metadata.gz: 139dddefaff180304528b83c6fe468bc16334d8d79b9f3ce3008a341aec4c7fc
4
+ data.tar.gz: 22b7924ecb2b9e33404865a13bb755ecfda62ee2e90a5a62fc24df0530a971ac
5
5
  SHA512:
6
- metadata.gz: 13c5fad74e52b3865b6d9366820be142ac778326cd8e6156ad9899b8f3ba92964797bc727fb2504f654ed4cb37c38472496958dfd4647d1b0ef6be55a8834c63
7
- data.tar.gz: 13837ce27d7519f1671a74539faa7b9fa13faea8a36bb96b48af806f9b9c8d6f7ce03b7dbb00fb4ab3d4dee120e655457176f1ba001dbba57e8aaa3f7f96c209
6
+ metadata.gz: b632dd330fd5846e6d500990a8e38629e62b91040ab2f39f1d52d10a145af92076ee4ef6d2e8d10fb5decace8858d02cc070b256212f70cbb6d858bfa062b50a
7
+ data.tar.gz: b71616e71765cc3d1fcdb8a987db447e6f58511ef53a491fe7b377746d62880a8e178b93d01d10a6b01c3d7c4d1d955d48fb6e8cdec1b0371ed7b02348c4a47a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Release History: opentelemetry-instrumentation-mysql2
2
2
 
3
+ ### v0.22.0 / 2023-01-14
4
+
5
+ * BREAKING CHANGE: Removed deprecated instrumentation options
6
+
7
+ * ADDED: Add option to configure span name
8
+ * ADDED: Removed deprecated instrumentation options
9
+ * DOCS: Fix gem homepage
10
+ * DOCS: More gem documentation fixes
11
+
3
12
  ### v0.21.1 / 2022-10-26
4
13
 
5
14
  * FIXED: Handle encoding errors in mysql obfuscation
@@ -10,15 +10,7 @@ module OpenTelemetry
10
10
  # The Instrumentation class contains logic to detect and install the Mysql2
11
11
  # instrumentation
12
12
  class Instrumentation < OpenTelemetry::Instrumentation::Base
13
- install do |config|
14
- if config[:enable_sql_obfuscation]
15
- config[:db_statement] = :obfuscate
16
- OpenTelemetry.logger.warn(
17
- 'Instrumentation mysql2 configuration option enable_sql_obfuscation has been deprecated,' \
18
- 'use db_statement option instead'
19
- )
20
- end
21
-
13
+ install do |_config|
22
14
  require_dependencies
23
15
  patch_client
24
16
  end
@@ -28,8 +20,8 @@ module OpenTelemetry
28
20
  end
29
21
 
30
22
  option :peer_service, default: nil, validate: :string
31
- option :enable_sql_obfuscation, default: false, validate: :boolean
32
23
  option :db_statement, default: :include, validate: %I[omit include obfuscate]
24
+ option :span_name, default: :statement_type, validate: %I[statement_type db_name db_operation_and_name]
33
25
 
34
26
  private
35
27
 
@@ -95,20 +95,23 @@ module OpenTelemetry
95
95
  %r{'|"|\/\*|\*\/}.match(obfuscated)
96
96
  end
97
97
 
98
- def database_span_name(sql)
99
- # Setting span name to the SQL query without obfuscation would
100
- # result in PII + cardinality issues.
101
- # First attempt to infer the statement type then fallback to
102
- # current Otel approach {database.component_name}.{database_instance_name}
103
- # https://github.com/open-telemetry/opentelemetry-python/blob/39fa078312e6f41c403aa8cad1868264011f7546/ext/opentelemetry-ext-dbapi/tests/test_dbapi_integration.py#L53
104
- # This creates span names like mysql.default, mysql.replica, postgresql.staging etc.
105
-
106
- statement_type = extract_statement_type(sql)
107
-
108
- return statement_type unless statement_type.nil?
109
-
110
- # fallback
111
- database_name ? "mysql.#{database_name}" : 'mysql'
98
+ def database_span_name(sql) # rubocop:disable Metrics/CyclomaticComplexity
99
+ case config[:span_name]
100
+ when :statement_type
101
+ extract_statement_type(sql)
102
+ when :db_name
103
+ database_name
104
+ when :db_operation_and_name
105
+ op = OpenTelemetry::Instrumentation::Mysql2.attributes['db.operation']
106
+ name = database_name
107
+ if op && name
108
+ "#{op} #{name}"
109
+ elsif op
110
+ op
111
+ elsif name
112
+ name
113
+ end
114
+ end || 'mysql'
112
115
  end
113
116
 
114
117
  def database_name
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module Mysql2
10
- VERSION = '0.21.1'
10
+ VERSION = '0.22.0'
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.21.1
4
+ version: 0.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-26 00:00:00.000000000 Z
11
+ date: 2023-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.17'
61
+ version: '2.4'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.17'
68
+ version: '2.4'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: minitest
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 1.3.0
159
+ version: 1.41.1
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.3.0
166
+ version: 1.41.1
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: simplecov
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -223,14 +223,14 @@ files:
223
223
  - lib/opentelemetry/instrumentation/mysql2/instrumentation.rb
224
224
  - lib/opentelemetry/instrumentation/mysql2/patches/client.rb
225
225
  - lib/opentelemetry/instrumentation/mysql2/version.rb
226
- homepage: https://github.com/open-telemetry/opentelemetry-contrib
226
+ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
227
227
  licenses:
228
228
  - Apache-2.0
229
229
  metadata:
230
- changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby-contrib/opentelemetry-instrumentation-mysql2/v0.21.1/file.CHANGELOG.html
230
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-mysql2/0.22.0/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://open-telemetry.github.io/opentelemetry-ruby-contrib/opentelemetry-instrumentation-mysql2/v0.21.1
233
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-mysql2/0.22.0
234
234
  post_install_message:
235
235
  rdoc_options: []
236
236
  require_paths: