opentelemetry-instrumentation-pg 0.22.2 → 0.22.3
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: e14d3c31673280352523e2c65a63630dd011198b2a5f80050c78498566028731
|
4
|
+
data.tar.gz: 7d6837fb749ecaa4603eaddbf6b7bf1e984d5da8592789e0dc8e8d2812b098d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0ae9029f10e93984a7e042a1703e5d1516ad8452c3bf3a7e777952309d0a394eacbbf950cee24df15d4bf51ed9b0396c762786fa63a346ed29bf5120d382bc8
|
7
|
+
data.tar.gz: fa0c955f672a5bc52743f64116a0c2b4f48edec1679d1924d0135db3079c7d4e38350e7aba7ec35bd8e6b5f68a465cdf162d50c9a946376fe60ca846ed1e754b
|
data/CHANGELOG.md
CHANGED
@@ -97,7 +97,7 @@ module OpenTelemetry
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def span_name(operation)
|
100
|
-
[validated_operation(operation),
|
100
|
+
[validated_operation(operation), db].compact.join(' ')
|
101
101
|
end
|
102
102
|
|
103
103
|
def validated_operation(operation)
|
@@ -123,43 +123,56 @@ module OpenTelemetry
|
|
123
123
|
@generated_postgres_regex ||= Regexp.union(PG::Constants::POSTGRES_COMPONENTS.map { |component| PG::Constants::COMPONENTS_REGEX_MAP[component] })
|
124
124
|
end
|
125
125
|
|
126
|
-
def database_name
|
127
|
-
conninfo_hash[:dbname]&.to_s
|
128
|
-
end
|
129
|
-
|
130
|
-
def first_in_list(item)
|
131
|
-
return unless item
|
132
|
-
|
133
|
-
if (idx = item.index(','))
|
134
|
-
item[0...idx]
|
135
|
-
else
|
136
|
-
item
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
126
|
def client_attributes
|
141
127
|
attributes = {
|
142
128
|
'db.system' => 'postgresql',
|
143
|
-
'db.user' =>
|
144
|
-
'db.name' =>
|
145
|
-
'net.peer.name' => first_in_list(conninfo_hash[:host]&.to_s)
|
129
|
+
'db.user' => user,
|
130
|
+
'db.name' => db
|
146
131
|
}
|
147
132
|
attributes['peer.service'] = config[:peer_service] if config[:peer_service]
|
148
133
|
|
149
134
|
attributes.merge(transport_attrs).reject { |_, v| v.nil? }
|
150
135
|
end
|
151
136
|
|
137
|
+
def transport_addr
|
138
|
+
# The hostaddr method is available when the gem is built against
|
139
|
+
# a recent version of libpq.
|
140
|
+
return hostaddr if defined?(hostaddr)
|
141
|
+
|
142
|
+
# As a fallback, we can use the hostaddr of the parsed connection
|
143
|
+
# string when there is only one. Some older versions of libpq allow
|
144
|
+
# multiple without any way to discern which is presently connected.
|
145
|
+
addr = conninfo_hash[:hostaddr]
|
146
|
+
return addr unless addr&.include?(',')
|
147
|
+
end
|
148
|
+
|
152
149
|
def transport_attrs
|
153
|
-
|
154
|
-
|
150
|
+
h = host
|
151
|
+
if h&.start_with?('/')
|
152
|
+
{
|
153
|
+
'net.sock.family' => 'unix',
|
154
|
+
'net.peer.name' => h
|
155
|
+
}
|
155
156
|
else
|
156
157
|
{
|
157
|
-
'net.transport' => '
|
158
|
-
'net.peer.
|
159
|
-
'net.peer.
|
158
|
+
'net.transport' => 'ip_tcp',
|
159
|
+
'net.peer.name' => h,
|
160
|
+
'net.peer.ip' => transport_addr,
|
161
|
+
'net.peer.port' => transport_port
|
160
162
|
}
|
161
163
|
end
|
162
164
|
end
|
165
|
+
|
166
|
+
def transport_port
|
167
|
+
# The port method can fail in older versions of the gem. It is
|
168
|
+
# accurate and safe to use when the DEF_PGPORT constant is defined.
|
169
|
+
return port if defined?(::PG::DEF_PGPORT)
|
170
|
+
|
171
|
+
# As a fallback, we can use the port of the parsed connection
|
172
|
+
# string when there is exactly one.
|
173
|
+
p = conninfo_hash[:port]
|
174
|
+
return p.to_i unless p.nil? || p.empty? || p.include?(',')
|
175
|
+
end
|
163
176
|
end
|
164
177
|
end
|
165
178
|
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.22.
|
4
|
+
version: 0.22.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenTelemetry Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -243,10 +243,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-contrib
|
|
243
243
|
licenses:
|
244
244
|
- Apache-2.0
|
245
245
|
metadata:
|
246
|
-
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby-contrib/opentelemetry-instrumentation-pg/v0.22.
|
246
|
+
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby-contrib/opentelemetry-instrumentation-pg/v0.22.3/file.CHANGELOG.html
|
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://open-telemetry.github.io/opentelemetry-ruby-contrib/opentelemetry-instrumentation-pg/v0.22.
|
249
|
+
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby-contrib/opentelemetry-instrumentation-pg/v0.22.3
|
250
250
|
post_install_message:
|
251
251
|
rdoc_options: []
|
252
252
|
require_paths:
|