opentelemetry-instrumentation-pg 0.26.1 → 0.27.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a914611c0017f6fa3a8c48070b3de29f14fb25f2555f898fbdeae8081739f039
|
4
|
+
data.tar.gz: 6778c49ceb66ad6835fa70bd158d23d3153ae7155df507d1475d049a313d518c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7b6d739265ac538d593597a929e7798f8923c99ce9fa1c270e3b663f96d6c9c78142c94b9e6b0829921bb73c3add5fe87c3dd27e92fc43f6613c95d9ff1fa80
|
7
|
+
data.tar.gz: e1ce883e4f2c822088ab224c3015bb2467cdd3945a6012d2a1e95666a61e1dd1471b11b5b054c48f6ea97661026023cb9b1257c5b90d0644e5a3725356827a7d
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-pg
|
2
2
|
|
3
|
+
### v0.27.1 / 2024-02-08
|
4
|
+
|
5
|
+
* FIXED: Add missing requires for sql-helpers to mysql, pg, and trilogy instrumentation
|
6
|
+
|
7
|
+
### v0.27.0 / 2024-02-08
|
8
|
+
|
9
|
+
* BREAKING CHANGE: Move shared sql behavior to helper gems
|
10
|
+
|
11
|
+
|
3
12
|
### v0.26.1 / 2023-11-23
|
4
13
|
|
5
14
|
* CHANGED: Applied Rubocop Performance Recommendations [#727](https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/727)
|
@@ -65,29 +65,6 @@ module OpenTelemetry
|
|
65
65
|
VALUES
|
66
66
|
].freeze
|
67
67
|
|
68
|
-
# From: https://github.com/newrelic/newrelic-ruby-agent/blob/9787095d4b5b2d8fcaf2fdbd964ed07c731a8b6b/lib/new_relic/agent/database/obfuscation_helpers.rb#L9-L34
|
69
|
-
COMPONENTS_REGEX_MAP = {
|
70
|
-
single_quotes: /'(?:[^']|'')*?(?:\\'.*|'(?!'))/,
|
71
|
-
dollar_quotes: /(\$(?!\d)[^$]*?\$).*?(?:\1|$)/,
|
72
|
-
uuids: /\{?(?:[0-9a-fA-F]\-*){32}\}?/,
|
73
|
-
numeric_literals: /-?\b(?:[0-9]+\.)?[0-9]+([eE][+-]?[0-9]+)?\b/,
|
74
|
-
boolean_literals: /\b(?:true|false|null)\b/i,
|
75
|
-
comments: /(?:#|--).*?(?=\r|\n|$)/i,
|
76
|
-
multi_line_comments: %r{\/\*(?:[^\/]|\/[^*])*?(?:\*\/|\/\*.*)}
|
77
|
-
}.freeze
|
78
|
-
|
79
|
-
POSTGRES_COMPONENTS = %i[
|
80
|
-
single_quotes
|
81
|
-
dollar_quotes
|
82
|
-
uuids
|
83
|
-
numeric_literals
|
84
|
-
boolean_literals
|
85
|
-
comments
|
86
|
-
multi_line_comments
|
87
|
-
].freeze
|
88
|
-
|
89
|
-
UNMATCHED_PAIRS_REGEX = %r{'|\/\*|\*\/|\$(?!\?)}
|
90
|
-
|
91
68
|
# These are all alike in that they will have a SQL statement as the first parameter.
|
92
69
|
# That statement may possibly be parameterized, but we can still use it - the
|
93
70
|
# obfuscation code will just transform $1 -> $? in that case (which is fine enough).
|
@@ -4,6 +4,7 @@
|
|
4
4
|
#
|
5
5
|
# SPDX-License-Identifier: Apache-2.0
|
6
6
|
|
7
|
+
require 'opentelemetry-helpers-sql-obfuscation'
|
7
8
|
require_relative '../constants'
|
8
9
|
require_relative '../lru_cache'
|
9
10
|
|
@@ -50,6 +51,16 @@ module OpenTelemetry
|
|
50
51
|
|
51
52
|
private
|
52
53
|
|
54
|
+
def obfuscate_sql(sql)
|
55
|
+
return sql unless config[:db_statement] == :obfuscate
|
56
|
+
|
57
|
+
OpenTelemetry::Helpers::SqlObfuscation.obfuscate_sql(
|
58
|
+
sql,
|
59
|
+
obfuscation_limit: config[:obfuscation_limit],
|
60
|
+
adapter: :postgres
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
53
64
|
def tracer
|
54
65
|
PG::Instrumentation.instance.tracer
|
55
66
|
end
|
@@ -112,34 +123,6 @@ module OpenTelemetry
|
|
112
123
|
operation if PG::Constants::SQL_COMMANDS.include?(operation)
|
113
124
|
end
|
114
125
|
|
115
|
-
def obfuscate_sql(sql)
|
116
|
-
return sql unless config[:db_statement] == :obfuscate
|
117
|
-
|
118
|
-
if sql.size > config[:obfuscation_limit]
|
119
|
-
first_match_index = sql.index(generated_postgres_regex)
|
120
|
-
truncation_message = "SQL truncated (> #{config[:obfuscation_limit]} characters)"
|
121
|
-
return truncation_message unless first_match_index
|
122
|
-
|
123
|
-
truncated_sql = sql[..first_match_index - 1]
|
124
|
-
return "#{truncated_sql}...\n#{truncation_message}"
|
125
|
-
end
|
126
|
-
|
127
|
-
# From:
|
128
|
-
# https://github.com/newrelic/newrelic-ruby-agent/blob/9787095d4b5b2d8fcaf2fdbd964ed07c731a8b6b/lib/new_relic/agent/database/obfuscator.rb
|
129
|
-
# https://github.com/newrelic/newrelic-ruby-agent/blob/9787095d4b5b2d8fcaf2fdbd964ed07c731a8b6b/lib/new_relic/agent/database/obfuscation_helpers.rb
|
130
|
-
obfuscated = sql.gsub(generated_postgres_regex, '?')
|
131
|
-
obfuscated = 'Failed to obfuscate SQL query - quote characters remained after obfuscation' if PG::Constants::UNMATCHED_PAIRS_REGEX.match(obfuscated)
|
132
|
-
|
133
|
-
obfuscated
|
134
|
-
rescue StandardError => e
|
135
|
-
OpenTelemetry.handle_error(message: 'Failed to obfuscate SQL', exception: e)
|
136
|
-
'OpenTelemetry error: failed to obfuscate sql'
|
137
|
-
end
|
138
|
-
|
139
|
-
def generated_postgres_regex
|
140
|
-
@generated_postgres_regex ||= Regexp.union(PG::Constants::POSTGRES_COMPONENTS.map { |component| PG::Constants::COMPONENTS_REGEX_MAP[component] })
|
141
|
-
end
|
142
|
-
|
143
126
|
def client_attributes
|
144
127
|
attributes = {
|
145
128
|
'db.system' => 'postgresql',
|
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.
|
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:
|
11
|
+
date: 2024-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: opentelemetry-helpers-sql-obfuscation
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: opentelemetry-instrumentation-base
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,28 +184,28 @@ dependencies:
|
|
170
184
|
requirements:
|
171
185
|
- - "~>"
|
172
186
|
- !ruby/object:Gem::Version
|
173
|
-
version: 1.
|
187
|
+
version: 1.60.1
|
174
188
|
type: :development
|
175
189
|
prerelease: false
|
176
190
|
version_requirements: !ruby/object:Gem::Requirement
|
177
191
|
requirements:
|
178
192
|
- - "~>"
|
179
193
|
- !ruby/object:Gem::Version
|
180
|
-
version: 1.
|
194
|
+
version: 1.60.1
|
181
195
|
- !ruby/object:Gem::Dependency
|
182
196
|
name: rubocop-performance
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|
184
198
|
requirements:
|
185
199
|
- - "~>"
|
186
200
|
- !ruby/object:Gem::Version
|
187
|
-
version: 1.
|
201
|
+
version: '1.20'
|
188
202
|
type: :development
|
189
203
|
prerelease: false
|
190
204
|
version_requirements: !ruby/object:Gem::Requirement
|
191
205
|
requirements:
|
192
206
|
- - "~>"
|
193
207
|
- !ruby/object:Gem::Version
|
194
|
-
version: 1.
|
208
|
+
version: '1.20'
|
195
209
|
- !ruby/object:Gem::Dependency
|
196
210
|
name: simplecov
|
197
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -243,10 +257,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
|
|
243
257
|
licenses:
|
244
258
|
- Apache-2.0
|
245
259
|
metadata:
|
246
|
-
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-pg/0.
|
260
|
+
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-pg/0.27.1/file/CHANGELOG.md
|
247
261
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/pg
|
248
262
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
|
249
|
-
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-pg/0.
|
263
|
+
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-pg/0.27.1
|
250
264
|
post_install_message:
|
251
265
|
rdoc_options: []
|
252
266
|
require_paths:
|