opentelemetry-instrumentation-pg 0.27.4 → 0.29.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +46 -38
- data/README.md +5 -3
- data/lib/opentelemetry/instrumentation/pg/patches/connection.rb +15 -3
- data/lib/opentelemetry/instrumentation/pg/version.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbd4b5e3db4cf1c343418ffe7121c94565f238c59d6ba85f063b1ef1b0e71f17
|
4
|
+
data.tar.gz: 149ea8294e6817584074e096bfc457ef6983c2cbd649fddabcbed0c9d1ac2972
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65613566f733495499b510c2679c3271778d4af51513db01b381fe606c08059cb9d474adaa0d09378658c6f6adfa86dbbe6d684026d0a3ebdff118ca188be046
|
7
|
+
data.tar.gz: d500d2cfd32952525f330d2ced9227f14c6c9ba2bd4619e5fb995cf88606fcc6704bae716633dcc2f5136ee41d286acd0f8869de99b3aa97f9eea0736e6f6340
|
data/CHANGELOG.md
CHANGED
@@ -1,117 +1,125 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-pg
|
2
2
|
|
3
|
+
### v0.29.0 / 2024-09-12
|
4
|
+
|
5
|
+
- 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.
|
6
|
+
|
7
|
+
### v0.28.0 / 2024-08-15
|
8
|
+
|
9
|
+
- ADDED: Collect pg db.collection_name attribute
|
10
|
+
- FIXED: Update versions to be tested (includes drop support for pg 1.2)
|
11
|
+
|
3
12
|
### v0.27.4 / 2024-07-23
|
4
13
|
|
5
|
-
|
14
|
+
- DOCS: Add cspell to CI
|
6
15
|
|
7
16
|
### v0.27.3 / 2024-05-11
|
8
17
|
|
9
|
-
|
18
|
+
- ADDED: Support prepend SQL comment for PG instrumentation
|
10
19
|
|
11
20
|
### v0.27.2 / 2024-04-30
|
12
21
|
|
13
|
-
|
22
|
+
- FIXED: Bundler conflict warnings
|
14
23
|
|
15
24
|
### v0.27.1 / 2024-02-08
|
16
25
|
|
17
|
-
|
26
|
+
- FIXED: Add missing requires for sql-helpers to mysql, pg, and trilogy instrumentation
|
18
27
|
|
19
28
|
### v0.27.0 / 2024-02-08
|
20
29
|
|
21
|
-
|
22
|
-
|
30
|
+
- BREAKING CHANGE: Move shared sql behavior to helper gems
|
23
31
|
|
24
32
|
### v0.26.1 / 2023-11-23
|
25
33
|
|
26
|
-
|
34
|
+
- CHANGED: Applied Rubocop Performance Recommendations [#727](https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/727)
|
27
35
|
|
28
36
|
### v0.26.0 / 2023-10-16
|
29
37
|
|
30
|
-
|
38
|
+
- BREAKING CHANGE: Obfuscation for mysql2, dalli and postgresql as default option for db_statement
|
31
39
|
|
32
|
-
|
40
|
+
- ADDED: Obfuscation for mysql2, dalli and postgresql as default option for db_statement
|
33
41
|
|
34
42
|
### v0.25.3 / 2023-07-29
|
35
43
|
|
36
|
-
|
44
|
+
- FIXED: Pass block explicitly in `define_method` calls for PG instrumentation query methods
|
37
45
|
|
38
46
|
### v0.25.2 / 2023-06-05
|
39
47
|
|
40
|
-
|
48
|
+
- FIXED: Base config options
|
41
49
|
|
42
50
|
### v0.25.1 / 2023-06-01
|
43
51
|
|
44
|
-
|
52
|
+
- FIXED: Regex non-match with obfuscation limit (issue #486)
|
45
53
|
|
46
54
|
### v0.25.0 / 2023-05-25
|
47
55
|
|
48
|
-
|
56
|
+
- ADDED: Add config[:obfuscation_limit] to pg and mysql2
|
49
57
|
|
50
58
|
### v0.24.0 / 2023-04-17
|
51
59
|
|
52
|
-
|
60
|
+
- BREAKING CHANGE: Drop support for EoL Ruby 2.7
|
53
61
|
|
54
|
-
|
62
|
+
- ADDED: Drop support for EoL Ruby 2.7
|
55
63
|
|
56
64
|
### v0.23.0 / 2023-01-14
|
57
65
|
|
58
|
-
|
66
|
+
- BREAKING CHANGE: Removed deprecated instrumentation options
|
59
67
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
68
|
+
- ADDED: Removed deprecated instrumentation options
|
69
|
+
- FIXED: Reduce Hash Allocations in PG Instrumentation
|
70
|
+
- DOCS: Fix gem homepage
|
71
|
+
- DOCS: More gem documentation fixes
|
64
72
|
|
65
73
|
### v0.22.3 / 2022-12-06
|
66
74
|
|
67
|
-
|
75
|
+
- FIXED: Use attributes from the active PG connection
|
68
76
|
|
69
77
|
### v0.22.2 / 2022-11-10
|
70
78
|
|
71
|
-
|
79
|
+
- FIXED: Safeguard against host being nil
|
72
80
|
|
73
81
|
### v0.22.1 / 2022-10-27
|
74
82
|
|
75
|
-
|
83
|
+
- FIXED: Only take the first item in a comma-separated list for pg attrs
|
76
84
|
|
77
85
|
### v0.22.0 / 2022-10-04
|
78
86
|
|
79
|
-
|
87
|
+
- ADDED: Add `with_attributes` context propagation for PG instrumentation
|
80
88
|
|
81
89
|
### v0.21.0 / 2022-06-09
|
82
90
|
|
83
|
-
|
84
|
-
|
91
|
+
- Upgrading Base dependency version
|
92
|
+
- FIXED: Broken test file requirements
|
85
93
|
|
86
94
|
### v0.20.0 / 2022-05-02
|
87
95
|
|
88
|
-
|
89
|
-
|
90
|
-
|
96
|
+
- ADDED: Validate Using Enums
|
97
|
+
- FIXED: Update pg instrumentation to handle non primitive argument
|
98
|
+
- FIXED: RubyGems Fallback
|
91
99
|
|
92
100
|
### v0.19.2 / 2021-12-02
|
93
101
|
|
94
|
-
|
102
|
+
- (No significant changes)
|
95
103
|
|
96
104
|
### v0.19.1 / 2021-09-29
|
97
105
|
|
98
|
-
|
106
|
+
- (No significant changes)
|
99
107
|
|
100
108
|
### v0.19.0 / 2021-08-12
|
101
109
|
|
102
|
-
|
103
|
-
|
110
|
+
- ADDED: Add db_statement toggle for postgres
|
111
|
+
- DOCS: Update docs to rely more on environment variable configuration
|
104
112
|
|
105
113
|
### v0.18.1 / 2021-06-23
|
106
114
|
|
107
|
-
|
115
|
+
- (No significant changes)
|
108
116
|
|
109
117
|
### v0.18.0 / 2021-05-21
|
110
118
|
|
111
|
-
|
112
|
-
|
119
|
+
- ADDED: Updated API dependency for 1.0.0.rc1
|
120
|
+
- ADDED: Add option to postgres instrumentation to disable db.statement
|
113
121
|
|
114
122
|
### v0.17.1 / 2021-04-23
|
115
123
|
|
116
|
-
|
117
|
-
|
124
|
+
- Initial release.
|
125
|
+
- ADDED: Initial postgresql instrumentation
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ The OpenTelemetry PG Ruby gem is a community maintained instrumentation for [PG]
|
|
6
6
|
|
7
7
|
Install the gem using:
|
8
8
|
|
9
|
-
```
|
9
|
+
```console
|
10
10
|
gem install opentelemetry-instrumentation-pg
|
11
11
|
```
|
12
12
|
|
@@ -66,7 +66,7 @@ An example of usage can be seen in [`example/pg.rb`](https://github.com/open-tel
|
|
66
66
|
|
67
67
|
The `opentelemetry-instrumentation-pg` gem source is [on github][repo-github], along with related gems including `opentelemetry-api` and `opentelemetry-sdk`.
|
68
68
|
|
69
|
-
The OpenTelemetry Ruby gems are maintained by the OpenTelemetry
|
69
|
+
The OpenTelemetry Ruby gems are maintained by the OpenTelemetry Ruby special interest group (SIG). You can get involved by joining us on our [GitHub Discussions][discussions-url], [Slack Channel][slack-channel] or attending our weekly meeting. See the [meeting calendar][community-meetings] for dates and times. For more information on this and other language SIGs, see the OpenTelemetry [community page][ruby-sig].
|
70
70
|
|
71
71
|
## License
|
72
72
|
|
@@ -78,4 +78,6 @@ The `opentelemetry-instrumentation-pg` gem is distributed under the Apache 2.0 l
|
|
78
78
|
[license-github]: https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/LICENSE
|
79
79
|
[ruby-sig]: https://github.com/open-telemetry/community#ruby-sig
|
80
80
|
[community-meetings]: https://github.com/open-telemetry/community#community-meetings
|
81
|
-
[
|
81
|
+
[slack-channel]: https://cloud-native.slack.com/archives/C01NWKKMKMY
|
82
|
+
[discussions-url]: https://github.com/open-telemetry/opentelemetry-ruby/discussions
|
83
|
+
|
@@ -14,6 +14,9 @@ module OpenTelemetry
|
|
14
14
|
module Patches
|
15
15
|
# Module to prepend to PG::Connection for instrumentation
|
16
16
|
module Connection # rubocop:disable Metrics/ModuleLength
|
17
|
+
# Capture the first word (including letters, digits, underscores, & '.', ) that follows common table commands
|
18
|
+
TABLE_NAME = /\b(?:FROM|INTO|UPDATE|CREATE\s+TABLE(?:\s+IF\s+NOT\s+EXISTS)?|DROP\s+TABLE(?:\s+IF\s+EXISTS)?|ALTER\s+TABLE(?:\s+IF\s+EXISTS)?)\s+([\w\.]+)/i
|
19
|
+
|
17
20
|
PG::Constants::EXEC_ISH_METHODS.each do |method|
|
18
21
|
define_method method do |*args, &block|
|
19
22
|
span_name, attrs = span_attrs(:query, *args)
|
@@ -86,11 +89,13 @@ module OpenTelemetry
|
|
86
89
|
# module size limit! We can't win here unless we want to start
|
87
90
|
# abstracting things into a million pieces.
|
88
91
|
def span_attrs(kind, *args)
|
92
|
+
text = args[0]
|
93
|
+
|
89
94
|
if kind == :query
|
90
|
-
operation = extract_operation(
|
91
|
-
sql = obfuscate_sql(
|
95
|
+
operation = extract_operation(text)
|
96
|
+
sql = obfuscate_sql(text).to_s
|
92
97
|
else
|
93
|
-
statement_name =
|
98
|
+
statement_name = text
|
94
99
|
|
95
100
|
if kind == :prepare
|
96
101
|
sql = obfuscate_sql(args[1]).to_s
|
@@ -104,6 +109,7 @@ module OpenTelemetry
|
|
104
109
|
|
105
110
|
attrs = { 'db.operation' => validated_operation(operation), 'db.postgresql.prepared_statement_name' => statement_name }
|
106
111
|
attrs['db.statement'] = sql unless config[:db_statement] == :omit
|
112
|
+
attrs['db.collection.name'] = collection_name(text)
|
107
113
|
attrs.merge!(OpenTelemetry::Instrumentation::PG.attributes)
|
108
114
|
attrs.compact!
|
109
115
|
|
@@ -125,6 +131,12 @@ module OpenTelemetry
|
|
125
131
|
operation if PG::Constants::SQL_COMMANDS.include?(operation)
|
126
132
|
end
|
127
133
|
|
134
|
+
def collection_name(text)
|
135
|
+
text.scan(TABLE_NAME).flatten[0]
|
136
|
+
rescue StandardError
|
137
|
+
nil
|
138
|
+
end
|
139
|
+
|
128
140
|
def client_attributes
|
129
141
|
attributes = {
|
130
142
|
'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.29.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: 2024-
|
11
|
+
date: 2024-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -56,16 +56,16 @@ dependencies:
|
|
56
56
|
name: activerecord
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 6.1.0
|
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:
|
68
|
+
version: 6.1.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: appraisal
|
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.
|
173
|
+
version: 1.66.0
|
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.
|
180
|
+
version: 1.66.0
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: rubocop-performance
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -243,10 +243,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
|
|
243
243
|
licenses:
|
244
244
|
- Apache-2.0
|
245
245
|
metadata:
|
246
|
-
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-pg/0.
|
246
|
+
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-pg/0.29.0/file/CHANGELOG.md
|
247
247
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/pg
|
248
248
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
|
249
|
-
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-pg/0.
|
249
|
+
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-pg/0.29.0
|
250
250
|
post_install_message:
|
251
251
|
rdoc_options: []
|
252
252
|
require_paths:
|