opentelemetry-instrumentation-mysql2 0.17.0 → 0.19.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: 8046ef05a5deaaf15de879528829ffd2afcc3249a902e7c101134082efcf2213
4
- data.tar.gz: 137b5d091131f449d0f796e3af7fe10ede9d2a8db81a14534fb5313f3be1e446
3
+ metadata.gz: 12b6b5712065c1bd63b04766999270aed5e6feb68f30becc97f453d23ccfffb9
4
+ data.tar.gz: dc7d19ddd48df92d5463df04b265dfcc8a98366a2ef62199e032a68c6d4193f2
5
5
  SHA512:
6
- metadata.gz: 9c7fa062c32f5dbac9166cd4ca99267b4be29b6eab23d040b5271b32be43d84acb8448e210a9108dff435cba5e67c15479a7901b014c5575b51874d2dd89b480
7
- data.tar.gz: ca613f5aac7bf981ee4ac26033b0312c211deab8fc1e251204f4f576d9a99be1457b87899383186c6e22c37e2c9bc3f1a0dfa21ea29834d7d7de2b3bf3116c5e
6
+ metadata.gz: 1f5ed045c7a312ee4487b064ca810fedff9cac72e86d7b7b851db5d411df19a61feb6bd71cf83b5c7b081eb9ac2edfecfd544d7c62324a741a3c113959ba7a36
7
+ data.tar.gz: 37944cd8d1e6b40a0c95e8c40b2b6dfbb20a2a36ef956a2b8c710a346b4c1bfa87431be9b07d167472365b641899c6995ca29be692696b35b1034a8116b66217
data/CHANGELOG.md CHANGED
@@ -1,18 +1,39 @@
1
1
  # Release History: opentelemetry-instrumentation-mysql2
2
2
 
3
+ ### v0.19.1 / 2021-09-29
4
+
5
+ * (No significant changes)
6
+
7
+ ### v0.19.0 / 2021-08-12
8
+
9
+ * BREAKING CHANGE: Add option for db.statement
10
+
11
+ * ADDED: Add option for db.statement
12
+ * DOCS: Update docs to rely more on environment variable configuration
13
+ * DOCS: Move to using new db_statement
14
+
15
+ ### v0.18.1 / 2021-06-23
16
+
17
+ * (No significant changes)
18
+
19
+ ### v0.18.0 / 2021-05-21
20
+
21
+ * ADDED: Updated API depedency for 1.0.0.rc1
22
+ * Fix: Nil value for db.name attribute #744
23
+
3
24
  ### v0.17.0 / 2021-04-22
4
25
 
5
26
  * (No significant changes)
6
27
 
7
28
  ### v0.16.0 / 2021-03-17
8
29
 
9
- * FIXED: Update DB semantic conventions
10
- * FIXED: Example scripts now reference local common lib
30
+ * FIXED: Update DB semantic conventions
31
+ * FIXED: Example scripts now reference local common lib
11
32
  * ADDED: Configurable obfuscation of sql in mysql2 instrumentation to avoid logging sensitive data
12
33
 
13
34
  ### v0.15.0 / 2021-02-18
14
35
 
15
- * ADDED: Add instrumentation config validation
36
+ * ADDED: Add instrumentation config validation
16
37
 
17
38
  ### v0.14.0 / 2021-02-03
18
39
 
@@ -28,12 +49,12 @@
28
49
 
29
50
  ### v0.11.0 / 2020-12-11
30
51
 
31
- * ADDED: Add peer service config to mysql
32
- * FIXED: Copyright comments to not reference year
52
+ * ADDED: Add peer service config to mysql
53
+ * FIXED: Copyright comments to not reference year
33
54
 
34
55
  ### v0.10.1 / 2020-12-09
35
56
 
36
- * FIXED: Semantic conventions db.type -> db.system
57
+ * FIXED: Semantic conventions db.type -> db.system
37
58
 
38
59
  ### v0.10.0 / 2020-12-03
39
60
 
@@ -41,19 +62,19 @@
41
62
 
42
63
  ### v0.9.0 / 2020-11-27
43
64
 
44
- * BREAKING CHANGE: Add timeout for force_flush and shutdown
65
+ * BREAKING CHANGE: Add timeout for force_flush and shutdown
45
66
 
46
- * ADDED: Add timeout for force_flush and shutdown
67
+ * ADDED: Add timeout for force_flush and shutdown
47
68
 
48
69
  ### v0.8.0 / 2020-10-27
49
70
 
50
- * BREAKING CHANGE: Remove 'canonical' from status codes
71
+ * BREAKING CHANGE: Remove 'canonical' from status codes
51
72
 
52
- * FIXED: Remove 'canonical' from status codes
73
+ * FIXED: Remove 'canonical' from status codes
53
74
 
54
75
  ### v0.7.0 / 2020-10-07
55
76
 
56
- * DOCS: Standardize toplevel docs structure and readme
77
+ * DOCS: Standardize toplevel docs structure and readme
57
78
 
58
79
  ### v0.6.0 / 2020-09-10
59
80
 
data/README.md CHANGED
@@ -36,8 +36,8 @@ end
36
36
  OpenTelemetry::SDK.configure do |c|
37
37
  c.use 'OpenTelemetry::Instrumentation::Mysql2', {
38
38
  # The obfuscation of SQL in the db.statement attribute is disabled by default.
39
- # To enable, set enable_sql_obfuscation to true.
40
- enable_sql_obfuscation: false,
39
+ # To enable, set db_statement to :obfuscate.
40
+ db_statement: :obfuscate,
41
41
  }
42
42
  end
43
43
  ```
@@ -10,7 +10,15 @@ 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|
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
+
14
22
  require_dependencies
15
23
  patch_client
16
24
  end
@@ -21,6 +29,7 @@ module OpenTelemetry
21
29
 
22
30
  option :peer_service, default: nil, validate: :string
23
31
  option :enable_sql_obfuscation, default: false, validate: :boolean
32
+ option :db_statement, default: :include, validate: ->(opt) { %I[omit include obfuscate].include?(opt) }
24
33
 
25
34
  private
26
35
 
@@ -51,11 +51,16 @@ module OpenTelemetry
51
51
  ].freeze
52
52
 
53
53
  def query(sql, options = {})
54
+ attributes = client_attributes
55
+ case config[:db_statement]
56
+ when :include
57
+ attributes['db.statement'] = sql
58
+ when :obfuscate
59
+ attributes['db.statement'] = obfuscate_sql(sql)
60
+ end
54
61
  tracer.in_span(
55
62
  database_span_name(sql),
56
- attributes: client_attributes.merge(
57
- 'db.statement' => obfuscate_sql(sql)
58
- ),
63
+ attributes: attributes,
59
64
  kind: :client
60
65
  ) do
61
66
  super(sql, options)
@@ -65,8 +70,6 @@ module OpenTelemetry
65
70
  private
66
71
 
67
72
  def obfuscate_sql(sql)
68
- return sql unless config[:enable_sql_obfuscation]
69
-
70
73
  if sql.size > 2000
71
74
  'SQL query too large to remove sensitive data ...'
72
75
  else
@@ -119,10 +122,10 @@ module OpenTelemetry
119
122
 
120
123
  attributes = {
121
124
  'db.system' => 'mysql',
122
- 'db.name' => database_name,
123
125
  'net.peer.name' => host,
124
126
  'net.peer.port' => port
125
127
  }
128
+ attributes['db.name'] = database_name if database_name
126
129
  attributes['peer.service'] = config[:peer_service] if config[:peer_service]
127
130
  attributes
128
131
  end
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module Mysql2
10
- VERSION = '0.17.0'
10
+ VERSION = '0.19.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.17.0
4
+ version: 0.19.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: 2021-04-23 00:00:00.000000000 Z
11
+ date: 2021-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.17.0
19
+ version: '1.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.17.0
26
+ version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: opentelemetry-instrumentation-base
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.17.0
33
+ version: 0.18.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.17.0
40
+ version: 0.18.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: appraisal
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,42 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0.0'
103
+ version: '1.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0.0'
110
+ version: '1.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry-byebug
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
111
139
  - !ruby/object:Gem::Dependency
112
140
  name: rubocop
113
141
  requirement: !ruby/object:Gem::Requirement
@@ -185,10 +213,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
185
213
  licenses:
186
214
  - Apache-2.0
187
215
  metadata:
188
- changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-mysql2/v0.17.0/file.CHANGELOG.html
216
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-mysql2/v0.19.1/file.CHANGELOG.html
189
217
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/instrumentation/mysql2
190
218
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
191
- documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-mysql2/v0.17.0
219
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-mysql2/v0.19.1
192
220
  post_install_message:
193
221
  rdoc_options: []
194
222
  require_paths: