opentelemetry-instrumentation-mysql2 0.26.1 → 0.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a68fd97fe9d02dc68d6451315ec27980fc9db7484778e646631897be3da2d5c
|
4
|
+
data.tar.gz: 8419c5fd4fe63fc5c709cf39a52aa7d3584d162d64780e5bada5a71e8df1e63a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 429d4ba8a52467a5b9a88b9cb9ebb5919349fb8822ac82837ad6084a2d77cca1dfd066c76470223f86d2059bf72feeecc3261c1649c43c66cc674e7b8547bd44
|
7
|
+
data.tar.gz: e2fa0302ae098d0f7e4fb6089f4362d1765aa5bfc71ccc5c519124c0b147c9eff0ae3b75b1b7a4dd485a1037992f3b13db4cddb5d55644d6c650ce356ce61a2b
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-mysql2
|
2
2
|
|
3
|
+
### v0.27.1 / 2024-04-30
|
4
|
+
|
5
|
+
* FIXED: Bundler conflict warnings
|
6
|
+
|
7
|
+
### v0.27.0 / 2024-02-15
|
8
|
+
|
9
|
+
* ADDED: Instrument mysql2 prepare statement
|
10
|
+
|
3
11
|
### v0.26.1 / 2024-02-08
|
4
12
|
|
5
13
|
* FIXED: Add missing requires for sql-helpers to mysql, pg, and trilogy instrumentation
|
@@ -14,7 +14,40 @@ module OpenTelemetry
|
|
14
14
|
# Module to prepend to Mysql2::Client for instrumentation
|
15
15
|
module Client
|
16
16
|
def query(sql, options = {})
|
17
|
-
|
17
|
+
tracer.in_span(
|
18
|
+
_otel_span_name(sql),
|
19
|
+
attributes: _otel_span_attributes(sql),
|
20
|
+
kind: :client
|
21
|
+
) do
|
22
|
+
super(sql, options)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def prepare(sql)
|
27
|
+
tracer.in_span(
|
28
|
+
_otel_span_name(sql),
|
29
|
+
attributes: _otel_span_attributes(sql),
|
30
|
+
kind: :client
|
31
|
+
) do
|
32
|
+
super(sql)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def _otel_span_name(sql)
|
39
|
+
OpenTelemetry::Helpers::MySQL.database_span_name(
|
40
|
+
sql,
|
41
|
+
OpenTelemetry::Instrumentation::Mysql2.attributes[
|
42
|
+
SemanticConventions::Trace::DB_OPERATION
|
43
|
+
],
|
44
|
+
_otel_database_name,
|
45
|
+
config
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
def _otel_span_attributes(sql)
|
50
|
+
attributes = _otel_client_attributes
|
18
51
|
case config[:db_statement]
|
19
52
|
when :include
|
20
53
|
attributes[SemanticConventions::Trace::DB_STATEMENT] = sql
|
@@ -24,30 +57,18 @@ module OpenTelemetry
|
|
24
57
|
sql, obfuscation_limit: config[:obfuscation_limit], adapter: :mysql
|
25
58
|
)
|
26
59
|
end
|
27
|
-
tracer.in_span(
|
28
|
-
OpenTelemetry::Helpers::MySQL.database_span_name(
|
29
|
-
sql,
|
30
|
-
OpenTelemetry::Instrumentation::Mysql2.attributes[
|
31
|
-
SemanticConventions::Trace::DB_OPERATION
|
32
|
-
],
|
33
|
-
database_name,
|
34
|
-
config
|
35
|
-
),
|
36
|
-
attributes: attributes.merge!(OpenTelemetry::Instrumentation::Mysql2.attributes),
|
37
|
-
kind: :client
|
38
|
-
) do
|
39
|
-
super(sql, options)
|
40
|
-
end
|
41
|
-
end
|
42
60
|
|
43
|
-
|
61
|
+
attributes.merge!(OpenTelemetry::Instrumentation::Mysql2.attributes)
|
62
|
+
attributes.compact!
|
63
|
+
attributes
|
64
|
+
end
|
44
65
|
|
45
|
-
def
|
66
|
+
def _otel_database_name
|
46
67
|
# https://github.com/brianmario/mysql2/blob/ca08712c6c8ea672df658bb25b931fea22555f27/lib/mysql2/client.rb#L78
|
47
68
|
(query_options[:database] || query_options[:dbname] || query_options[:db])&.to_s
|
48
69
|
end
|
49
70
|
|
50
|
-
def
|
71
|
+
def _otel_client_attributes
|
51
72
|
# The client specific attributes can be found via the query_options instance variable
|
52
73
|
# exposed on the mysql2 Client
|
53
74
|
# https://github.com/brianmario/mysql2/blob/ca08712c6c8ea672df658bb25b931fea22555f27/lib/mysql2/client.rb#L25-L26
|
@@ -59,8 +80,9 @@ module OpenTelemetry
|
|
59
80
|
SemanticConventions::Trace::NET_PEER_NAME => host,
|
60
81
|
SemanticConventions::Trace::NET_PEER_PORT => port
|
61
82
|
}
|
62
|
-
|
63
|
-
attributes[SemanticConventions::Trace::
|
83
|
+
|
84
|
+
attributes[SemanticConventions::Trace::DB_NAME] = _otel_database_name
|
85
|
+
attributes[SemanticConventions::Trace::PEER_SERVICE] = config[:peer_service]
|
64
86
|
attributes
|
65
87
|
end
|
66
88
|
|
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.27.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: 2024-
|
11
|
+
date: 2024-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -108,20 +108,6 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '5.0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: mysql2
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 0.4.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.4.0
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
112
|
name: opentelemetry-sdk
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,14 +170,14 @@ dependencies:
|
|
184
170
|
requirements:
|
185
171
|
- - "~>"
|
186
172
|
- !ruby/object:Gem::Version
|
187
|
-
version: 1.
|
173
|
+
version: '1.62'
|
188
174
|
type: :development
|
189
175
|
prerelease: false
|
190
176
|
version_requirements: !ruby/object:Gem::Requirement
|
191
177
|
requirements:
|
192
178
|
- - "~>"
|
193
179
|
- !ruby/object:Gem::Version
|
194
|
-
version: 1.
|
180
|
+
version: '1.62'
|
195
181
|
- !ruby/object:Gem::Dependency
|
196
182
|
name: rubocop-performance
|
197
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -255,10 +241,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
|
|
255
241
|
licenses:
|
256
242
|
- Apache-2.0
|
257
243
|
metadata:
|
258
|
-
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-mysql2/0.
|
244
|
+
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-mysql2/0.27.1/file/CHANGELOG.md
|
259
245
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/mysql2
|
260
246
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
|
261
|
-
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-mysql2/0.
|
247
|
+
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-mysql2/0.27.1
|
262
248
|
post_install_message:
|
263
249
|
rdoc_options: []
|
264
250
|
require_paths:
|