opentelemetry-instrumentation-pg 0.34.1 → 0.36.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: 0f996ad740911dadbeb4e827f62b05f2bd2b57a3cc9a695c7e4e9ece7dadc385
|
|
4
|
+
data.tar.gz: 3caedd663abde4a0bb8d9636bb46621dccc4a0d4c8db101e60cf51cb7c6c790f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5cd52f1d835d96eb26bbfca70ccfb5261f164c8f2d44203f14d780a1df61fe6b196600ad7a0cbfdbfa34b8eea806125f0a1679718d8119cb00e2d6feefcab553
|
|
7
|
+
data.tar.gz: 5ce0ad3fe50cd072497ab0cb040eab2c2bd98a03570872cc94fb3c43a53933f889d379b322541fd089a827d0d656b46bcf43293873c81704187684a6fde7cdcf
|
data/CHANGELOG.md
CHANGED
|
@@ -1,113 +1,121 @@
|
|
|
1
1
|
# Release History: opentelemetry-instrumentation-pg
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## v0.36.0 / 2026-04-14
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- BREAKING CHANGE: Min Ruby Version 3.3 (#2125)
|
|
6
|
+
- ADDED: Min Ruby Version 3.3 (#2125)
|
|
7
|
+
- ADDED: Add release tag into source code url of gem metadata (#1984)
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
## v0.35.0 / 2026-01-13
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
- ADDED: Add SQL Comment Propagator
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
## v0.34.1 / 2025-12-03
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
- FIXED: Update gemspec dependencies to sql-processor
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
## v0.34.0 / 2025-12-02
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
- ADDED: Replace references sql-obfuscation -> sql-processor
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
## v0.33.0 / 2025-11-03
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
- ADDED: Instrument PG connect
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
## v0.32.0 / 2025-10-22
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
- BREAKING CHANGE: Min Ruby Version 3.2
|
|
28
|
+
- ADDED: Min Ruby Version 3.2
|
|
26
29
|
|
|
27
|
-
|
|
30
|
+
## v0.31.1 / 2025-09-30
|
|
28
31
|
|
|
29
|
-
|
|
32
|
+
- FIXED: Min OTel Ruby API 1.7
|
|
30
33
|
|
|
31
|
-
|
|
34
|
+
## v0.31.0 / 2025-09-30
|
|
32
35
|
|
|
33
|
-
|
|
36
|
+
- ADDED: Bump minimum API Version to 1.7
|
|
34
37
|
|
|
35
|
-
|
|
36
|
-
* BREAKING CHANGE: Set minimum supported version to Ruby 3.1
|
|
38
|
+
## v0.30.1 / 2025-04-16
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
* ADDED: Set minimum supported version to Ruby 3.1
|
|
40
|
+
- refactor: Use SQL helpers for context attributes #1271
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
## v0.30.0 / 2025-01-16
|
|
42
43
|
|
|
43
|
-
|
|
44
|
+
- BREAKING CHANGE: Drop Support for EoL Rails 6.1
|
|
45
|
+
- BREAKING CHANGE: Set minimum supported version to Ruby 3.1
|
|
46
|
+
- ADDED: Drop Support for EoL Rails 6.1
|
|
47
|
+
- ADDED: Set minimum supported version to Ruby 3.1
|
|
44
48
|
|
|
45
|
-
|
|
49
|
+
## v0.29.2 / 2025-01-07
|
|
46
50
|
|
|
47
|
-
|
|
51
|
+
- FIXED: Update instrumentation pg to support merge statements
|
|
48
52
|
|
|
49
|
-
|
|
53
|
+
## v0.29.1 / 2024-11-26
|
|
54
|
+
|
|
55
|
+
- FIXED: Get correct table name if table name is quoted
|
|
56
|
+
|
|
57
|
+
## v0.29.0 / 2024-09-12
|
|
50
58
|
|
|
51
59
|
- BREAKING CHANGE: Return message when sql is over the obfuscation limit. Fixes a bug where sql statements with prepended comments that hit the obfuscation limit would be sent raw.
|
|
52
60
|
|
|
53
|
-
|
|
61
|
+
## v0.28.0 / 2024-08-15
|
|
54
62
|
|
|
55
63
|
- ADDED: Collect pg db.collection_name attribute
|
|
56
64
|
- FIXED: Update versions to be tested (includes drop support for pg 1.2)
|
|
57
65
|
|
|
58
|
-
|
|
66
|
+
## v0.27.4 / 2024-07-23
|
|
59
67
|
|
|
60
68
|
- DOCS: Add cspell to CI
|
|
61
69
|
|
|
62
|
-
|
|
70
|
+
## v0.27.3 / 2024-05-11
|
|
63
71
|
|
|
64
72
|
- ADDED: Support prepend SQL comment for PG instrumentation
|
|
65
73
|
|
|
66
|
-
|
|
74
|
+
## v0.27.2 / 2024-04-30
|
|
67
75
|
|
|
68
76
|
- FIXED: Bundler conflict warnings
|
|
69
77
|
|
|
70
|
-
|
|
78
|
+
## v0.27.1 / 2024-02-08
|
|
71
79
|
|
|
72
80
|
- FIXED: Add missing requires for sql-helpers to mysql, pg, and trilogy instrumentation
|
|
73
81
|
|
|
74
|
-
|
|
82
|
+
## v0.27.0 / 2024-02-08
|
|
75
83
|
|
|
76
84
|
- BREAKING CHANGE: Move shared sql behavior to helper gems
|
|
77
85
|
|
|
78
|
-
|
|
86
|
+
## v0.26.1 / 2023-11-23
|
|
79
87
|
|
|
80
88
|
- CHANGED: Applied Rubocop Performance Recommendations [#727](https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/727)
|
|
81
89
|
|
|
82
|
-
|
|
90
|
+
## v0.26.0 / 2023-10-16
|
|
83
91
|
|
|
84
92
|
- BREAKING CHANGE: Obfuscation for mysql2, dalli and postgresql as default option for db_statement
|
|
85
93
|
|
|
86
94
|
- ADDED: Obfuscation for mysql2, dalli and postgresql as default option for db_statement
|
|
87
95
|
|
|
88
|
-
|
|
96
|
+
## v0.25.3 / 2023-07-29
|
|
89
97
|
|
|
90
98
|
- FIXED: Pass block explicitly in `define_method` calls for PG instrumentation query methods
|
|
91
99
|
|
|
92
|
-
|
|
100
|
+
## v0.25.2 / 2023-06-05
|
|
93
101
|
|
|
94
102
|
- FIXED: Base config options
|
|
95
103
|
|
|
96
|
-
|
|
104
|
+
## v0.25.1 / 2023-06-01
|
|
97
105
|
|
|
98
106
|
- FIXED: Regex non-match with obfuscation limit (issue #486)
|
|
99
107
|
|
|
100
|
-
|
|
108
|
+
## v0.25.0 / 2023-05-25
|
|
101
109
|
|
|
102
110
|
- ADDED: Add config[:obfuscation_limit] to pg and mysql2
|
|
103
111
|
|
|
104
|
-
|
|
112
|
+
## v0.24.0 / 2023-04-17
|
|
105
113
|
|
|
106
114
|
- BREAKING CHANGE: Drop support for EoL Ruby 2.7
|
|
107
115
|
|
|
108
116
|
- ADDED: Drop support for EoL Ruby 2.7
|
|
109
117
|
|
|
110
|
-
|
|
118
|
+
## v0.23.0 / 2023-01-14
|
|
111
119
|
|
|
112
120
|
- BREAKING CHANGE: Removed deprecated instrumentation options
|
|
113
121
|
|
|
@@ -116,56 +124,56 @@
|
|
|
116
124
|
- DOCS: Fix gem homepage
|
|
117
125
|
- DOCS: More gem documentation fixes
|
|
118
126
|
|
|
119
|
-
|
|
127
|
+
## v0.22.3 / 2022-12-06
|
|
120
128
|
|
|
121
129
|
- FIXED: Use attributes from the active PG connection
|
|
122
130
|
|
|
123
|
-
|
|
131
|
+
## v0.22.2 / 2022-11-10
|
|
124
132
|
|
|
125
133
|
- FIXED: Safeguard against host being nil
|
|
126
134
|
|
|
127
|
-
|
|
135
|
+
## v0.22.1 / 2022-10-27
|
|
128
136
|
|
|
129
137
|
- FIXED: Only take the first item in a comma-separated list for pg attrs
|
|
130
138
|
|
|
131
|
-
|
|
139
|
+
## v0.22.0 / 2022-10-04
|
|
132
140
|
|
|
133
141
|
- ADDED: Add `with_attributes` context propagation for PG instrumentation
|
|
134
142
|
|
|
135
|
-
|
|
143
|
+
## v0.21.0 / 2022-06-09
|
|
136
144
|
|
|
137
145
|
- Upgrading Base dependency version
|
|
138
146
|
- FIXED: Broken test file requirements
|
|
139
147
|
|
|
140
|
-
|
|
148
|
+
## v0.20.0 / 2022-05-02
|
|
141
149
|
|
|
142
150
|
- ADDED: Validate Using Enums
|
|
143
151
|
- FIXED: Update pg instrumentation to handle non primitive argument
|
|
144
152
|
- FIXED: RubyGems Fallback
|
|
145
153
|
|
|
146
|
-
|
|
154
|
+
## v0.19.2 / 2021-12-02
|
|
147
155
|
|
|
148
156
|
- (No significant changes)
|
|
149
157
|
|
|
150
|
-
|
|
158
|
+
## v0.19.1 / 2021-09-29
|
|
151
159
|
|
|
152
160
|
- (No significant changes)
|
|
153
161
|
|
|
154
|
-
|
|
162
|
+
## v0.19.0 / 2021-08-12
|
|
155
163
|
|
|
156
164
|
- ADDED: Add db_statement toggle for postgres
|
|
157
165
|
- DOCS: Update docs to rely more on environment variable configuration
|
|
158
166
|
|
|
159
|
-
|
|
167
|
+
## v0.18.1 / 2021-06-23
|
|
160
168
|
|
|
161
169
|
- (No significant changes)
|
|
162
170
|
|
|
163
|
-
|
|
171
|
+
## v0.18.0 / 2021-05-21
|
|
164
172
|
|
|
165
173
|
- ADDED: Updated API dependency for 1.0.0.rc1
|
|
166
174
|
- ADDED: Add option to postgres instrumentation to disable db.statement
|
|
167
175
|
|
|
168
|
-
|
|
176
|
+
## v0.17.1 / 2021-04-23
|
|
169
177
|
|
|
170
178
|
- Initial release.
|
|
171
179
|
- ADDED: Initial postgresql instrumentation
|
data/README.md
CHANGED
|
@@ -54,6 +54,11 @@ OpenTelemetry::SDK.configure do |c|
|
|
|
54
54
|
# semantic attribute. Optionally, you may disable the inclusion of this attribute entirely by
|
|
55
55
|
# setting this option to :omit or disable sanitization of the attribute by setting it to :include
|
|
56
56
|
db_statement: :include,
|
|
57
|
+
|
|
58
|
+
# When `db_statement` is enabled, this instrumentation obfuscates SQL queries. By default, it
|
|
59
|
+
# obfuscates queries up to 2000 characters. You can override the default with a different
|
|
60
|
+
# `obfuscation_limit`, but higher values may impact performance.
|
|
61
|
+
obfuscation_limit: 2000
|
|
57
62
|
}
|
|
58
63
|
end
|
|
59
64
|
```
|
|
@@ -80,4 +85,3 @@ The `opentelemetry-instrumentation-pg` gem is distributed under the Apache 2.0 l
|
|
|
80
85
|
[community-meetings]: https://github.com/open-telemetry/community#community-meetings
|
|
81
86
|
[slack-channel]: https://cloud-native.slack.com/archives/C01NWKKMKMY
|
|
82
87
|
[discussions-url]: https://github.com/open-telemetry/opentelemetry-ruby/discussions
|
|
83
|
-
|
|
@@ -11,9 +11,10 @@ module OpenTelemetry
|
|
|
11
11
|
class Instrumentation < OpenTelemetry::Instrumentation::Base
|
|
12
12
|
MINIMUM_VERSION = Gem::Version.new('1.1.0')
|
|
13
13
|
|
|
14
|
-
install do |
|
|
14
|
+
install do |config|
|
|
15
15
|
require_dependencies
|
|
16
16
|
patch_client
|
|
17
|
+
configure_propagator(config)
|
|
17
18
|
end
|
|
18
19
|
|
|
19
20
|
present do
|
|
@@ -27,6 +28,9 @@ module OpenTelemetry
|
|
|
27
28
|
option :peer_service, default: nil, validate: :string
|
|
28
29
|
option :db_statement, default: :obfuscate, validate: %I[omit include obfuscate]
|
|
29
30
|
option :obfuscation_limit, default: 2000, validate: :integer
|
|
31
|
+
option :propagator, default: 'none', validate: %w[none tracecontext]
|
|
32
|
+
|
|
33
|
+
attr_reader :propagator
|
|
30
34
|
|
|
31
35
|
private
|
|
32
36
|
|
|
@@ -42,6 +46,16 @@ module OpenTelemetry
|
|
|
42
46
|
::PG::Connection.prepend(Patches::Connection)
|
|
43
47
|
::PG::Connection.singleton_class.prepend(Patches::Connect)
|
|
44
48
|
end
|
|
49
|
+
|
|
50
|
+
def configure_propagator(config)
|
|
51
|
+
propagator = config[:propagator]
|
|
52
|
+
@propagator = case propagator
|
|
53
|
+
when 'tracecontext' then OpenTelemetry::Helpers::SqlProcessor::SqlCommenter.sql_query_propagator
|
|
54
|
+
when 'none', nil then nil
|
|
55
|
+
else
|
|
56
|
+
OpenTelemetry.logger.warn "The #{propagator} propagator is unknown and cannot be configured"
|
|
57
|
+
end
|
|
58
|
+
end
|
|
45
59
|
end
|
|
46
60
|
end
|
|
47
61
|
end
|
|
@@ -79,7 +79,20 @@ module OpenTelemetry
|
|
|
79
79
|
PG::Constants::EXEC_ISH_METHODS.each do |method|
|
|
80
80
|
define_method method do |*args, &block|
|
|
81
81
|
span_name, attrs = span_attrs(:query, *args)
|
|
82
|
-
tracer.in_span(span_name, attributes: attrs, kind: :client) do
|
|
82
|
+
tracer.in_span(span_name, attributes: attrs, kind: :client) do |_span, context|
|
|
83
|
+
# Inject propagator context into SQL if propagator is configured
|
|
84
|
+
if propagator && args[0].is_a?(String)
|
|
85
|
+
sql = args[0]
|
|
86
|
+
if sql.frozen?
|
|
87
|
+
sql = +sql
|
|
88
|
+
propagator.inject(sql, context: context)
|
|
89
|
+
sql.freeze
|
|
90
|
+
args[0] = sql
|
|
91
|
+
else
|
|
92
|
+
propagator.inject(sql, context: context)
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
83
96
|
if block
|
|
84
97
|
block.call(super(*args))
|
|
85
98
|
else
|
|
@@ -92,7 +105,21 @@ module OpenTelemetry
|
|
|
92
105
|
PG::Constants::PREPARE_ISH_METHODS.each do |method|
|
|
93
106
|
define_method method do |*args|
|
|
94
107
|
span_name, attrs = span_attrs(:prepare, *args)
|
|
95
|
-
tracer.in_span(span_name, attributes: attrs, kind: :client) do
|
|
108
|
+
tracer.in_span(span_name, attributes: attrs, kind: :client) do |_span, context|
|
|
109
|
+
# Inject propagator context into SQL if propagator is configured
|
|
110
|
+
# For prepare, the SQL is in args[1]
|
|
111
|
+
if propagator && args[1].is_a?(String)
|
|
112
|
+
sql = args[1]
|
|
113
|
+
if sql.frozen?
|
|
114
|
+
sql = +sql
|
|
115
|
+
propagator.inject(sql, context: context)
|
|
116
|
+
sql.freeze
|
|
117
|
+
args[1] = sql
|
|
118
|
+
else
|
|
119
|
+
propagator.inject(sql, context: context)
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
96
123
|
super(*args)
|
|
97
124
|
end
|
|
98
125
|
end
|
|
@@ -248,6 +275,10 @@ module OpenTelemetry
|
|
|
248
275
|
p = conninfo_hash[:port]
|
|
249
276
|
p.to_i unless p.nil? || p.empty? || p.include?(',')
|
|
250
277
|
end
|
|
278
|
+
|
|
279
|
+
def propagator
|
|
280
|
+
OpenTelemetry::Instrumentation::PG::Instrumentation.instance.propagator
|
|
281
|
+
end
|
|
251
282
|
end
|
|
252
283
|
end
|
|
253
284
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: opentelemetry-instrumentation-pg
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.36.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OpenTelemetry Authors
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: opentelemetry-helpers-sql
|
|
@@ -75,11 +74,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
|
|
|
75
74
|
licenses:
|
|
76
75
|
- Apache-2.0
|
|
77
76
|
metadata:
|
|
78
|
-
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-pg/0.
|
|
79
|
-
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/
|
|
77
|
+
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-pg/0.36.0/file/CHANGELOG.md
|
|
78
|
+
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/opentelemetry-instrumentation-pg/v0.36.0/instrumentation/pg
|
|
80
79
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
|
|
81
|
-
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-pg/0.
|
|
82
|
-
post_install_message:
|
|
80
|
+
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-pg/0.36.0
|
|
83
81
|
rdoc_options: []
|
|
84
82
|
require_paths:
|
|
85
83
|
- lib
|
|
@@ -87,15 +85,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
87
85
|
requirements:
|
|
88
86
|
- - ">="
|
|
89
87
|
- !ruby/object:Gem::Version
|
|
90
|
-
version: '3.
|
|
88
|
+
version: '3.3'
|
|
91
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
90
|
requirements:
|
|
93
91
|
- - ">="
|
|
94
92
|
- !ruby/object:Gem::Version
|
|
95
93
|
version: '0'
|
|
96
94
|
requirements: []
|
|
97
|
-
rubygems_version:
|
|
98
|
-
signing_key:
|
|
95
|
+
rubygems_version: 4.0.6
|
|
99
96
|
specification_version: 4
|
|
100
97
|
summary: PG (PostgreSQL) instrumentation for the OpenTelemetry framework
|
|
101
98
|
test_files: []
|