opentelemetry-instrumentation-pg 0.25.2 → 0.26.0

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: a1657a2304d23151ca16abe37e4c10ac189c84d05146f9a9d8802ba164d44598
4
- data.tar.gz: 39b4c371b11b030f09b1054c04da290b0b4f051f138c9ad0e5b43117f77c44d0
3
+ metadata.gz: b1f0cce766de33102b30042a14d65f2e9fd00e0e9bcdc82702cd5b747c146c27
4
+ data.tar.gz: b2e4ecbad38a5556a7ded3508d44bc0bd18d19078d1df9c5ad8efa29e6ab68b1
5
5
  SHA512:
6
- metadata.gz: 8c1bcba9e93214b3537856a094846fd93aac95bca4772849e4a42dae335d2102b444db14a7148f34545a1554c1ec12776854d5d4ca5c245f8ac4190c23a1a346
7
- data.tar.gz: a09b3230505a4e9b4994e035cdc978a8f782a253bdad3c4accffa9ef8619f4f2147a7119d4763c3051dca855f0522f5a2830bb0e9646f48f20fa3b0b06ae79ca
6
+ metadata.gz: b131fc9b5c97da003fecf7252f33dd7ee87e07b7e88974031b6e789f7c5afe29621b76138ce78101d32437c31f50b6c3c0e8c91906155a74d918feebd6fdb8af
7
+ data.tar.gz: d50b7becf091842b581d56aee6d3466eaa51516306f15f120033e2859e1cc5537fc19604100d6b1a7567be1f5cecd34fd0a0f177f1fc396694be013af502f1d5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Release History: opentelemetry-instrumentation-pg
2
2
 
3
+ ### v0.26.0 / 2023-10-16
4
+
5
+ * BREAKING CHANGE: Obfuscation for mysql2, dalli and postgresql as default option for db_statement
6
+
7
+ * ADDED: Obfuscation for mysql2, dalli and postgresql as default option for db_statement
8
+
9
+ ### v0.25.3 / 2023-07-29
10
+
11
+ * FIXED: Pass block explicitly in `define_method` calls for PG instrumentation query methods
12
+
3
13
  ### v0.25.2 / 2023-06-05
4
14
 
5
15
  * FIXED: Base config options
data/README.md CHANGED
@@ -50,9 +50,9 @@ OpenTelemetry::SDK.configure do |c|
50
50
  # will be included on all spans from this instrumentation:
51
51
  peer_service: 'postgres:readonly',
52
52
 
53
- # By default, this instrumentation includes the executed SQL as the `db.statement`
53
+ # By default, this instrumentation obfuscate/sanitize the executed SQL as the `db.statement`
54
54
  # semantic attribute. Optionally, you may disable the inclusion of this attribute entirely by
55
- # setting this option to :omit or sanitize the attribute by setting to :obfuscate
55
+ # setting this option to :omit or disbale sanitization the attribute by setting to :include
56
56
  db_statement: :include,
57
57
  }
58
58
  end
@@ -25,7 +25,7 @@ module OpenTelemetry
25
25
  end
26
26
 
27
27
  option :peer_service, default: nil, validate: :string
28
- option :db_statement, default: :include, validate: %I[omit include obfuscate]
28
+ option :db_statement, default: :obfuscate, validate: %I[omit include obfuscate]
29
29
  option :obfuscation_limit, default: 2000, validate: :integer
30
30
 
31
31
  private
@@ -14,10 +14,14 @@ module OpenTelemetry
14
14
  # Module to prepend to PG::Connection for instrumentation
15
15
  module Connection # rubocop:disable Metrics/ModuleLength
16
16
  PG::Constants::EXEC_ISH_METHODS.each do |method|
17
- define_method method do |*args|
17
+ define_method method do |*args, &block|
18
18
  span_name, attrs = span_attrs(:query, *args)
19
19
  tracer.in_span(span_name, attributes: attrs, kind: :client) do
20
- super(*args)
20
+ if block
21
+ block.call(super(*args))
22
+ else
23
+ super(*args)
24
+ end
21
25
  end
22
26
  end
23
27
  end
@@ -32,10 +36,14 @@ module OpenTelemetry
32
36
  end
33
37
 
34
38
  PG::Constants::EXEC_PREPARED_ISH_METHODS.each do |method|
35
- define_method method do |*args|
39
+ define_method method do |*args, &block|
36
40
  span_name, attrs = span_attrs(:execute, *args)
37
41
  tracer.in_span(span_name, attributes: attrs, kind: :client) do
38
- super(*args)
42
+ if block
43
+ block.call(super(*args))
44
+ else
45
+ super(*args)
46
+ end
39
47
  end
40
48
  end
41
49
  end
@@ -154,7 +162,7 @@ module OpenTelemetry
154
162
  # string when there is only one. Some older versions of libpq allow
155
163
  # multiple without any way to discern which is presently connected.
156
164
  addr = conninfo_hash[:hostaddr]
157
- return addr unless addr&.include?(',')
165
+ addr unless addr&.include?(',')
158
166
  end
159
167
 
160
168
  def transport_attrs
@@ -182,7 +190,7 @@ module OpenTelemetry
182
190
  # As a fallback, we can use the port of the parsed connection
183
191
  # string when there is exactly one.
184
192
  p = conninfo_hash[:port]
185
- return p.to_i unless p.nil? || p.empty? || p.include?(',')
193
+ p.to_i unless p.nil? || p.empty? || p.include?(',')
186
194
  end
187
195
  end
188
196
  end
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module PG
10
- VERSION = '0.25.2'
10
+ VERSION = '0.26.0'
11
11
  end
12
12
  end
13
13
  end
@@ -44,5 +44,5 @@ module OpenTelemetry
44
44
  end
45
45
  end
46
46
 
47
- require_relative './pg/instrumentation'
48
- require_relative './pg/version'
47
+ require_relative 'pg/instrumentation'
48
+ require_relative 'pg/version'
@@ -19,4 +19,4 @@ module OpenTelemetry
19
19
  end
20
20
  end
21
21
 
22
- require_relative './instrumentation/pg'
22
+ require_relative 'instrumentation/pg'
@@ -4,4 +4,4 @@
4
4
  #
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
7
- require_relative './opentelemetry/instrumentation'
7
+ require_relative 'opentelemetry/instrumentation'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-instrumentation-pg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.2
4
+ version: 0.26.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: 2023-06-05 00:00:00.000000000 Z
11
+ date: 2023-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 2.2.0
61
+ version: '2.5'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 2.2.0
68
+ version: '2.5'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 1.50.2
173
+ version: 1.56.1
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 1.50.2
180
+ version: 1.56.1
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: simplecov
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -206,20 +206,6 @@ dependencies:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0.9'
209
- - !ruby/object:Gem::Dependency
210
- name: yard-doctest
211
- requirement: !ruby/object:Gem::Requirement
212
- requirements:
213
- - - "~>"
214
- - !ruby/object:Gem::Version
215
- version: 0.1.6
216
- type: :development
217
- prerelease: false
218
- version_requirements: !ruby/object:Gem::Requirement
219
- requirements:
220
- - - "~>"
221
- - !ruby/object:Gem::Version
222
- version: 0.1.6
223
209
  description: PG (PostgreSQL) instrumentation for the OpenTelemetry framework
224
210
  email:
225
211
  - cncf-opentelemetry-contributors@lists.cncf.io
@@ -243,10 +229,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
243
229
  licenses:
244
230
  - Apache-2.0
245
231
  metadata:
246
- changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-pg/0.25.2/file/CHANGELOG.md
232
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-pg/0.26.0/file/CHANGELOG.md
247
233
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/pg
248
234
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
249
- documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-pg/0.25.2
235
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-pg/0.26.0
250
236
  post_install_message:
251
237
  rdoc_options: []
252
238
  require_paths: