opentelemetry-instrumentation-mysql2 0.32.0 → 0.33.0
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: 2135692bfbdd0cca5ed9f3183b27c27764a707e1de9fbb5a40490b1ee17673a5
|
|
4
|
+
data.tar.gz: 17ec5c108d11bd9408b4deedd4cd287fb4d449999a9fe1a0adbc053803c55a2a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0ba2b068bb15df851e78ae523d8cd09e04e0d18d9294c37cf2edf24cdfc382d675fa877b594ae144359e4eba1a470caa11f61e504be61bffe513e701f6282dbd
|
|
7
|
+
data.tar.gz: b93bfc55a087ab7ce59fecb96271d6f601a16fdc4959782c1a534709dea8d65c45dfb81c8ba8f422ada48a1614c1f8e0ad20663b46fdb8606fe3d7e04365642c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Release History: opentelemetry-instrumentation-mysql2
|
|
2
2
|
|
|
3
|
+
### v0.33.0 / 2026-01-13
|
|
4
|
+
|
|
5
|
+
* ADDED: Add SQL Comment Propagator
|
|
6
|
+
|
|
7
|
+
### v0.32.1 / 2025-12-03
|
|
8
|
+
|
|
9
|
+
* FIXED: Update gemspec dependencies to sql-processor
|
|
10
|
+
|
|
3
11
|
### v0.32.0 / 2025-12-02
|
|
4
12
|
|
|
5
13
|
* ADDED: Replace references sql-obfuscation -> sql-processor
|
|
@@ -10,9 +10,10 @@ 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
14
|
require_dependencies
|
|
15
15
|
patch_client
|
|
16
|
+
configure_propagator(config)
|
|
16
17
|
end
|
|
17
18
|
|
|
18
19
|
present do
|
|
@@ -23,6 +24,9 @@ module OpenTelemetry
|
|
|
23
24
|
option :db_statement, default: :obfuscate, validate: %I[omit include obfuscate]
|
|
24
25
|
option :span_name, default: :statement_type, validate: %I[statement_type db_name db_operation_and_name]
|
|
25
26
|
option :obfuscation_limit, default: 2000, validate: :integer
|
|
27
|
+
option :propagator, default: 'none', validate: %w[none tracecontext vitess]
|
|
28
|
+
|
|
29
|
+
attr_reader :propagator
|
|
26
30
|
|
|
27
31
|
private
|
|
28
32
|
|
|
@@ -33,6 +37,24 @@ module OpenTelemetry
|
|
|
33
37
|
def patch_client
|
|
34
38
|
::Mysql2::Client.prepend(Patches::Client)
|
|
35
39
|
end
|
|
40
|
+
|
|
41
|
+
def configure_propagator(config)
|
|
42
|
+
propagator = config[:propagator]
|
|
43
|
+
@propagator = case propagator
|
|
44
|
+
when 'tracecontext' then OpenTelemetry::Helpers::SqlProcessor::SqlCommenter.sql_query_propagator
|
|
45
|
+
when 'vitess' then fetch_propagator(propagator, 'OpenTelemetry::Propagator::Vitess')
|
|
46
|
+
when 'none', nil then nil
|
|
47
|
+
else
|
|
48
|
+
OpenTelemetry.logger.warn "The #{propagator} propagator is unknown and cannot be configured"
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def fetch_propagator(name, class_name, gem_suffix = name)
|
|
53
|
+
Kernel.const_get(class_name).sql_query_propagator
|
|
54
|
+
rescue NameError
|
|
55
|
+
OpenTelemetry.logger.warn "The #{name} propagator cannot be configured - please add opentelemetry-helpers-#{gem_suffix} to your Gemfile"
|
|
56
|
+
nil
|
|
57
|
+
end
|
|
36
58
|
end
|
|
37
59
|
end
|
|
38
60
|
end
|
|
@@ -18,8 +18,16 @@ module OpenTelemetry
|
|
|
18
18
|
_otel_span_name(sql),
|
|
19
19
|
attributes: _otel_span_attributes(sql),
|
|
20
20
|
kind: :client
|
|
21
|
-
) do
|
|
22
|
-
|
|
21
|
+
) do |_span, context|
|
|
22
|
+
if propagator && sql.frozen?
|
|
23
|
+
sql = +sql
|
|
24
|
+
propagator.inject(sql, context: context)
|
|
25
|
+
sql.freeze
|
|
26
|
+
elsif propagator
|
|
27
|
+
propagator.inject(sql, context: context)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
super(sql, options)
|
|
23
31
|
end
|
|
24
32
|
end
|
|
25
33
|
|
|
@@ -28,8 +36,16 @@ module OpenTelemetry
|
|
|
28
36
|
_otel_span_name(sql),
|
|
29
37
|
attributes: _otel_span_attributes(sql),
|
|
30
38
|
kind: :client
|
|
31
|
-
) do
|
|
32
|
-
|
|
39
|
+
) do |_span, context|
|
|
40
|
+
if propagator && sql.frozen?
|
|
41
|
+
sql = +sql
|
|
42
|
+
propagator.inject(sql, context: context)
|
|
43
|
+
sql.freeze
|
|
44
|
+
elsif propagator
|
|
45
|
+
propagator.inject(sql, context: context)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
super(sql)
|
|
33
49
|
end
|
|
34
50
|
end
|
|
35
51
|
|
|
@@ -93,6 +109,10 @@ module OpenTelemetry
|
|
|
93
109
|
def config
|
|
94
110
|
Mysql2::Instrumentation.instance.config
|
|
95
111
|
end
|
|
112
|
+
|
|
113
|
+
def propagator
|
|
114
|
+
Mysql2::Instrumentation.instance.propagator
|
|
115
|
+
end
|
|
96
116
|
end
|
|
97
117
|
end
|
|
98
118
|
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.33.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:
|
|
11
|
+
date: 2026-01-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: opentelemetry-helpers-mysql
|
|
@@ -39,7 +39,7 @@ dependencies:
|
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '0'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: opentelemetry-helpers-sql-
|
|
42
|
+
name: opentelemetry-helpers-sql-processor
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
45
|
- - ">="
|
|
@@ -87,10 +87,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
|
|
|
87
87
|
licenses:
|
|
88
88
|
- Apache-2.0
|
|
89
89
|
metadata:
|
|
90
|
-
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-mysql2/0.
|
|
90
|
+
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-mysql2/0.33.0/file/CHANGELOG.md
|
|
91
91
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/mysql2
|
|
92
92
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
|
|
93
|
-
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-mysql2/0.
|
|
93
|
+
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-mysql2/0.33.0
|
|
94
94
|
post_install_message:
|
|
95
95
|
rdoc_options: []
|
|
96
96
|
require_paths:
|