opentelemetry-instrumentation-pg 0.27.3 → 0.28.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: da089229dce97d7a2b910b1e74cbb247ca1a527c6789f94293187d7b6c210067
4
- data.tar.gz: 0771762b5fab0d4ae9b453389b0657f808455ff76f255dcdfd36644879fecb37
3
+ metadata.gz: cd590dfd1d522e383d0ddfa5cebfe6aed7eff09c632bc883d757542e1bc13cbd
4
+ data.tar.gz: 1e92bbd9721812c0a84dee04d65e8a309e43f0f7339dde999043314e82c9c4ba
5
5
  SHA512:
6
- metadata.gz: 584ec4104a7fe209024823f01054087f3ec9ef8dc145a2585b17f2901f9720aa67be4e6e9ebe4c45bcd4468a211bb1d4575aaffe3bdf25dd789be96662bd8806
7
- data.tar.gz: c9045e9ebb8a1e06590c3956372ab9da55aaaa911ead75aaa32ddcf876a8acb13e53dd5c0545b18fa5e75273481c20f2811100c74fd6994d4a41818525f92a8c
6
+ metadata.gz: 7c35f30669b2d8061047eb99b968b7d5483ea074b31d1715e0606b201aebf51d88038ee1db72ad72e7e2ead657e4adcf5f8f4b6e340196964aecd09625e2492e
7
+ data.tar.gz: 9de710fac153a36bae0f105b9ba4db66c8db5d25861679fa6849eb61006d3d53d50b05712594f8a1d182dbc5df5f3b1cde5dca87eb5ce6def46ce6dfe57bb187
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Release History: opentelemetry-instrumentation-pg
2
2
 
3
+ ### v0.28.0 / 2024-08-15
4
+
5
+ * ADDED: Collect pg db.collection_name attribute
6
+ * FIXED: Update versions to be tested (includes drop support for pg 1.2)
7
+
8
+ ### v0.27.4 / 2024-07-23
9
+
10
+ * DOCS: Add cspell to CI
11
+
3
12
  ### v0.27.3 / 2024-05-11
4
13
 
5
14
  * ADDED: Support prepend SQL comment for PG instrumentation
@@ -104,7 +113,7 @@
104
113
 
105
114
  ### v0.18.0 / 2021-05-21
106
115
 
107
- * ADDED: Updated API depedency for 1.0.0.rc1
116
+ * ADDED: Updated API dependency for 1.0.0.rc1
108
117
  * ADDED: Add option to postgres instrumentation to disable db.statement
109
118
 
110
119
  ### v0.17.1 / 2021-04-23
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-Ruby special interest group (SIG). You can get involved by joining us on our [gitter channel][ruby-gitter] 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].
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
- [ruby-gitter]: https://gitter.im/open-telemetry/opentelemetry-ruby
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(args[0])
91
- sql = obfuscate_sql(args[0]).to_s
95
+ operation = extract_operation(text)
96
+ sql = obfuscate_sql(text).to_s
92
97
  else
93
- statement_name = args[0]
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',
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module PG
10
- VERSION = '0.27.3'
10
+ VERSION = '0.28.0'
11
11
  end
12
12
  end
13
13
  end
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.27.3
4
+ version: 0.28.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-05-11 00:00:00.000000000 Z
11
+ date: 2024-08-15 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: '0'
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: '0'
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.62'
173
+ version: 1.65.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.62'
180
+ version: 1.65.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.27.3/file/CHANGELOG.md
246
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-pg/0.28.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.27.3
249
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-pg/0.28.0
250
250
  post_install_message:
251
251
  rdoc_options: []
252
252
  require_paths: