opentelemetry-instrumentation-mysql2 0.16.0 → 0.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +32 -11
- data/README.md +2 -2
- data/lib/opentelemetry/instrumentation/mysql2.rb +1 -0
- data/lib/opentelemetry/instrumentation/mysql2/instrumentation.rb +10 -1
- data/lib/opentelemetry/instrumentation/mysql2/patches/client.rb +9 -6
- data/lib/opentelemetry/instrumentation/mysql2/version.rb +1 -1
- metadata +51 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4c336dee4ea731b92e4546a72fc047e1daaccbfdc45b2771844a71b937283b6
|
4
|
+
data.tar.gz: ce856296ab136a054567fdd5c180af35ea1538f71eeac10255e47adc6f8e9046
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a0c027bb105697ba6c564a32ca3fa1db695ad374302e98b89d59d030fdc2ba63a8c2beb794033687c0a88f9ac00e65b6b6dcd152bbac379ddcdb07b2b7e5f79
|
7
|
+
data.tar.gz: 8b31ee410ba0364068f3dde580728618cd9db21c09daaae7827d9a023b01ce1ad079c603e976d100c4c2ba0b4e2f93ac1952fe3d4c439a8fa607980eba586ba9
|
data/CHANGELOG.md
CHANGED
@@ -1,14 +1,35 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-mysql2
|
2
2
|
|
3
|
+
### v0.19.0 / 2021-08-12
|
4
|
+
|
5
|
+
* BREAKING CHANGE: Add option for db.statement
|
6
|
+
|
7
|
+
* ADDED: Add option for db.statement
|
8
|
+
* DOCS: Update docs to rely more on environment variable configuration
|
9
|
+
* DOCS: Move to using new db_statement
|
10
|
+
|
11
|
+
### v0.18.1 / 2021-06-23
|
12
|
+
|
13
|
+
* (No significant changes)
|
14
|
+
|
15
|
+
### v0.18.0 / 2021-05-21
|
16
|
+
|
17
|
+
* ADDED: Updated API depedency for 1.0.0.rc1
|
18
|
+
* Fix: Nil value for db.name attribute #744
|
19
|
+
|
20
|
+
### v0.17.0 / 2021-04-22
|
21
|
+
|
22
|
+
* (No significant changes)
|
23
|
+
|
3
24
|
### v0.16.0 / 2021-03-17
|
4
25
|
|
5
|
-
* FIXED: Update DB semantic conventions
|
6
|
-
* FIXED: Example scripts now reference local common lib
|
26
|
+
* FIXED: Update DB semantic conventions
|
27
|
+
* FIXED: Example scripts now reference local common lib
|
7
28
|
* ADDED: Configurable obfuscation of sql in mysql2 instrumentation to avoid logging sensitive data
|
8
29
|
|
9
30
|
### v0.15.0 / 2021-02-18
|
10
31
|
|
11
|
-
* ADDED: Add instrumentation config validation
|
32
|
+
* ADDED: Add instrumentation config validation
|
12
33
|
|
13
34
|
### v0.14.0 / 2021-02-03
|
14
35
|
|
@@ -24,12 +45,12 @@
|
|
24
45
|
|
25
46
|
### v0.11.0 / 2020-12-11
|
26
47
|
|
27
|
-
* ADDED: Add peer service config to mysql
|
28
|
-
* FIXED: Copyright comments to not reference year
|
48
|
+
* ADDED: Add peer service config to mysql
|
49
|
+
* FIXED: Copyright comments to not reference year
|
29
50
|
|
30
51
|
### v0.10.1 / 2020-12-09
|
31
52
|
|
32
|
-
* FIXED: Semantic conventions db.type -> db.system
|
53
|
+
* FIXED: Semantic conventions db.type -> db.system
|
33
54
|
|
34
55
|
### v0.10.0 / 2020-12-03
|
35
56
|
|
@@ -37,19 +58,19 @@
|
|
37
58
|
|
38
59
|
### v0.9.0 / 2020-11-27
|
39
60
|
|
40
|
-
* BREAKING CHANGE: Add timeout for force_flush and shutdown
|
61
|
+
* BREAKING CHANGE: Add timeout for force_flush and shutdown
|
41
62
|
|
42
|
-
* ADDED: Add timeout for force_flush and shutdown
|
63
|
+
* ADDED: Add timeout for force_flush and shutdown
|
43
64
|
|
44
65
|
### v0.8.0 / 2020-10-27
|
45
66
|
|
46
|
-
* BREAKING CHANGE: Remove 'canonical' from status codes
|
67
|
+
* BREAKING CHANGE: Remove 'canonical' from status codes
|
47
68
|
|
48
|
-
* FIXED: Remove 'canonical' from status codes
|
69
|
+
* FIXED: Remove 'canonical' from status codes
|
49
70
|
|
50
71
|
### v0.7.0 / 2020-10-07
|
51
72
|
|
52
|
-
* DOCS: Standardize toplevel docs structure and readme
|
73
|
+
* DOCS: Standardize toplevel docs structure and readme
|
53
74
|
|
54
75
|
### v0.6.0 / 2020-09-10
|
55
76
|
|
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
|
40
|
-
|
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 |
|
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:
|
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
|
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.
|
4
|
+
version: 0.19.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: 2021-
|
11
|
+
date: 2021-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 1.0.0.rc3
|
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.
|
26
|
+
version: 1.0.0.rc3
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: opentelemetry-instrumentation-base
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.18.2
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.18.2
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: appraisal
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +100,42 @@ dependencies:
|
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
103
|
+
version: 1.0.0.rc1
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
110
|
+
version: 1.0.0.rc1
|
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'
|
97
139
|
- !ruby/object:Gem::Dependency
|
98
140
|
name: rubocop
|
99
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,10 +213,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
|
171
213
|
licenses:
|
172
214
|
- Apache-2.0
|
173
215
|
metadata:
|
174
|
-
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-mysql2/v0.
|
216
|
+
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-mysql2/v0.19.0/file.CHANGELOG.html
|
175
217
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/instrumentation/mysql2
|
176
218
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
177
|
-
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-mysql2/v0.
|
219
|
+
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-mysql2/v0.19.0
|
178
220
|
post_install_message:
|
179
221
|
rdoc_options: []
|
180
222
|
require_paths:
|
@@ -190,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
232
|
- !ruby/object:Gem::Version
|
191
233
|
version: '0'
|
192
234
|
requirements: []
|
193
|
-
rubygems_version: 3.1.
|
235
|
+
rubygems_version: 3.1.6
|
194
236
|
signing_key:
|
195
237
|
specification_version: 4
|
196
238
|
summary: Mysql2 instrumentation for the OpenTelemetry framework
|